DrSax has asked for the wisdom of the Perl Monks concerning the following question:
I have written a module that reads in log files (which are in XML) and parses them
for various conditions to provide some reporting on my EAI engine (all Perl, all the time).
The package uses mirod's XML::Twig to set up handlers for different conditions to
report on, and I use it to create a web page that our users can view to see errors and
successes, and to post-process the results.
After I developed the module I tested it
with a script and everything works just fine. When I call the same package from a CGI program
I get an error from XML::Expat
Here is the error message that I am getting from XML::Expat:
If you look at the code at that point, you will see the following:Can't use string ('<myXMLString><myElement name="foo"-') as a symbol ref while "strict refs" in use at .../perl5/site_perl/5.6.0/sun4-solaris-thread/XML/Parser/Expat.pm line 456.
So the offending line is where "$ioref = *{$arg}{IO};". In this case, $arg happens to be my XML string, which is the correct thing for it to be. If you push the scripty version of this though the debugger, all values appear correct, and the globbing works fine under use strict.sub parse { my $self = shift; my $arg = shift; croak "Parse already in progress (Expat)" if $self->{_State_}; $self->{_State_} = 1; my $parser = $self->{Parser}; my $ioref; my $result = 0; if (defined $arg) { if (ref($arg) and UNIVERSAL::isa($arg, 'IO::Handle')) { $ioref = $arg; } elsif (tied($arg)) { my $class = ref($arg); no strict 'refs'; $ioref = $arg if defined &{"${class}::TIEHANDLE"}; } else { eval { $ioref = *{$arg}{IO}; # This is line 456 }; undef $@; } }
If anyone else has any ideas I would appreciate it. Thanks so much to those who have already made suggestions.
Edited 2001-05-29 by Ovid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Expat - error from browser
by Anonymous Monk on May 29, 2001 at 20:58 UTC | |
by DrSax (Sexton) on May 29, 2001 at 23:14 UTC | |
by Anonymous Monk on May 30, 2001 at 00:02 UTC | |
by Anonymous Monk on May 29, 2001 at 23:59 UTC | |
by DrSax (Sexton) on May 29, 2001 at 21:24 UTC | |
by Anonymous Monk on May 29, 2001 at 21:39 UTC | |
by Anonymous Monk on May 29, 2001 at 21:42 UTC |