Parsing XML File using Perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sainiamit25
    New Member
    • Jul 2007
    • 40

    Parsing XML File using Perl

    Hi,

    I am trying to set up environment for XML parsing using perl. I downloaded XML::Simple and installed it too. When i try to run my program, it says, you need to install parser. When i try to install XML::Parser, it says i need to install expact parser. But when i do not how to install and set up that. Can anybody help me know the shortest and quickest way to run my perl script which is ready to parse a xml file. Also i have installed XML::SAX by mistake which is half done,can anybody tell me how to uninstall that?

    Regards,
    Amit
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    First, if you go to the CPAN pages for the modules, you will generally find that near the bottom of the page the authors typically put documentation of the pre-requisites for the module. This may help at times in resolving dependencies.

    Did you try installing "XML::Parser::E xpat"?

    One other thing. A tip that has saved me many times from dependencies. When you first run the command "perl -MCPAN -e shell", you will be prompted with a whole series of questions. One particular question asks you how you want to handle dependencies. I always answer this with "follow" instead of the default "ask". This way, when I install a module, Perl goes ahead and automatically installs any and all dependencies quietly, without asking about it first.

    Sorry I couldn't be more help with the Expat piece. Maybe one of the others will know the answer.

    Regards,

    Jeff

    Comment

    • sainiamit25
      New Member
      • Jul 2007
      • 40

      #3
      Thanks Jeff,

      Extending this topic again...

      I want to install XML::Parser for perl. When i tried installing that package, it gave me error saying XML::expact need to be installed. I downloaded XML::Expact and when i tried to install it, it asked me to install gcc.

      Can anybody give me the link for downloading gcc from internet. i downloaded the gcc package from sunfreeware.com (package name gcc_small-3.3.2-sol9-intel-local.gz) by following the following steps:-

      To decompress the downloaded package file:

      # cd /opt/temp
      # gunzip gcc*
      # cd /opt/temp
      # pkgadd -d gcc*

      everything looks to be fine, but when i try to run expact, i get the following error:--
      checking build system type... sparc-sun-solaris2.9
      checking host system type... sparc-sun-solaris2.9
      checking for gcc... gcc
      checking for C compiler default output... configure: error: C compiler cannot create executables

      Does it mean that gcc has not been installed properly? If my gcc has not been installed properly, please let me know the proper way to install it properly.

      Needless to say, thanks in advance to all of you for your help.

      Cheers,
      Amit

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        First thing I want to say is that it looks like you are trying to install modules that way that Miller had described in the other article that you had cross posted to. I agree with Miller that you should really use the package management system to install modules and use actually building the modules locally as a last resort if you don't have root access to the system. If you do NOT have root access, then installing gcc with its default locations won't work as the executables get written to a directory or directories that only root has permissions to write to. You would again be out of luck. If you are in that type of situation where you don't have root access, you would have to make modifications to the installation package of gcc to have it install into a directory that you DO have access to write to.

        That said, if you do have root access, then you should really consider using something like the following convention to install your package(s):

        perl -MCPAN -e 'install <package_name >'

        If you haven't run this command before, you will have to probably not only have to go through the CPAN configuration, it will be suggested after you set it you to install Bundle::CPAN before going further. This will bring your base module system up to date or install it.

        Also, when going through the CPAN configuration, I always suggest to people that when asked about how to handle dependencies, I recomend the option of "follow" so it automatically installs package dependencies for you.

        That said, hopefully this helps or gets you a little further.

        Regards,

        Jeff

        Comment

        Working...