Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

XML::Simple -> XMLin() requires either XML::SAX or XML::Parser

by tptass (Sexton)
on Aug 06, 2008 at 15:42 UTC ( #702668=perlquestion: print w/replies, xml ) Need Help??

tptass has asked for the wisdom of the Perl Monks concerning the following question:

Something really weird is going on...I have created a Perl CGI site and it has been up and running on multiple linux machines for a long time. But all of a sudden I have started receiving the following error in my a few of my apache error logs:

  • "XMLin() requires either XML::SAX or XML::Parser are /PerlApp/lib/Globals.pm"

The CGI files are all compiled using perlapp, and the following module versions for XML use:

  • XML::Simple 2.15
  • XML::Parser 2.34

I have completely removed all existence of my site and apache, and reinstalled everything but I still am receiving the same error. I can install onto another machine with the same installation script and everything works fine. There is something corrupt or misconfigured on the actual machine, but I thought XML::Parser did not depend on any physical libraries.

The only thing that I have found that works is a complete reinstall of the OS on the broken machine, but I really need to find out what is causing this issue to fix the other few machines without a complete OS install.

Does anyone have any ideas on what is causing this, or how I could get a working machine into this state?

Thanks in advance Monks!

  • Comment on XML::Simple -> XMLin() requires either XML::SAX or XML::Parser

Replies are listed 'Best First'.
Re: XML::Simple -> XMLin() requires either XML::SAX or XML::Parser
by grantm (Parson) on Aug 07, 2008 at 01:29 UTC
      "XMLin() requires either XML::SAX or XML::Parser are /PerlApp/lib/Globals.pm"

    That message makes no sense at all - I'd expect it to read more like:

      "XMLin() requires either XML::SAX or XML::Parser at <some module file name> line <line number>"

    Anyway XML::Simple would die with the "XMLin() requires either XML::SAX or XML::Parser" message if neither XML::SAX nor XML::Parser could be loaded.

    Do you have shell access to the server? Are either of those modules available?

    Is there something different about the environment the web server runs in that would cause it to not be able to see the parser modules?

      I have shell access to the server, these modules will not be available on the server. The Perl-CGI page and .pl scripts being invoked are compiled using PerlApp.

      The weird thing is that it was working and all of a sudden it has stopped. Some environment changes may have taken place, but according to ActiveState when you compile using PerlApp you compile all necessary Perl Modules into your .pl and/or cgi scripts. This has worked for me in the past and still works today. However, for some reason I believe a library XML::Simple or the XML::Parser relies on has disappear...the problem is I have no clue what linux libraries it would possibly need besides expat.

        If you have XML::SAX (which includes a PurePerl parser) then no external libraries are required for XML::Simple to work. If you want better parsing speed then by all means use XML::Parser (or XML::SAX::ExpatXS) but either of these Perl modules will need access to libexpat. No other external libraries are required.

        If I were trying to diagnose it, I'd probably use the strace tool (on Linux) to log the system calls that the application is making. The log would probably show an attempt to open a file that doesn't exist.

        The other thing you could do is rebuild your PerlApp compilation with a modified copy of XML::Simple. Find the line that generates that error and modify the error string to include $@ - the text of the error that caused the parser load to fail. E.g.:

        croak "XMLin() requires either XML::SAX or XML::Parser ($@)";
Re: XML::Simple -> XMLin() requires either XML::SAX or XML::Parser
by JadeNB (Chaplain) on Aug 06, 2008 at 19:36 UTC
    There is something corrupt or misconfigured on the actual machine, but I thought XML::Parser did not depend on any physical libraries.
    While I have no idea if it would cause the problem that you're seeing, note that XML::Parser needs the expat library (which may or may not count as 'physical' :-) ).

      I did think of that too, and I tried reinstalling the OS expat libraries. That did not work, so being curious I tried removing the expat libraries but of course apache relays on them to restart it. So that didn't work very well at all.

Re: XML::Simple -> XMLin() requires either XML::SAX or XML::Parser
by tptass (Sexton) on Aug 07, 2008 at 23:11 UTC

    I reinstalled Expat (again), perl-XML-Parser, perl-HTML-Parser, perl-Parse-Yapp... and it WORKED!

    After some thinking and reading the comments everyone has posted, I realized after looking at my perl code again that I do not specify a Parser which means it will use the expat parser. So I reinstalled everything I could think of and one of them was corrupt, don't know exactly which one it was, but I'm guessing the perl-XML-Parser has a local library it installs besides the main expat library.

      just set LD_LIBRARY_PATH env variable to the path where libexpat is installed (/usr/local/lib) in your profile or bashrc, so that perl can find the library when needed.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://702668]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2023-12-03 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (20 votes). Check out past polls.

    Notices?