You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by James Orr <ja...@orrwhat.net> on 2005/03/17 15:23:26 UTC

mod_perl and XML::LibXML

Hi,

I have an occaisional error happening with a module i'm using from a
mod_perl script.  This is in my "new" method ...

my $ifh = IO::File->new($project_dir.'/info.xml') || die "Can't open
info file: $!";
$data->{'info'} = $parser->parse_fh($ifh);

And the error it gives is ...

read on filehandle failed: Can't use an undefined value as a symbol
reference at /usr/lib/perl5/site_perl/5.8.4/i686-linux/XML/LibXML.pm
line 336.

By occaisional I mean that this error has occured 21 times in over
21,000 hits.

-- 
James Orr <ja...@orrwhat.net>

Losing POST data (was: mod_perl and XML::LibXML)

Posted by James Orr <ja...@orrwhat.net>.
On Fri, 2005-03-18 at 03:15 -0600, D. Hageman wrote:
> On Thu, 17 Mar 2005, Stas Bekman wrote:
> 
> > James Orr wrote:
> >> Hi,
> >> 
> >> I have an occaisional error happening with a module i'm using from a
> >> mod_perl script.  This is in my "new" method ...
> >> 
> >> my $ifh = IO::File->new($project_dir.'/info.xml') || die "Can't open
> >> info file: $!";
> >> $data->{'info'} = $parser->parse_fh($ifh);
> >> 
> >> And the error it gives is ...
> >> 
> >> read on filehandle failed: Can't use an undefined value as a symbol
> >> reference at /usr/lib/perl5/site_perl/5.8.4/i686-linux/XML/LibXML.pm
> >> line 336.
> >> 
> >> By occaisional I mean that this error has occured 21 times in over
> >> 21,000 hits.
> >
> > James, assuming that you don't use any eval {} blocks, try to install:
> >
> > use Carp;
> > $SIG{__DIE__} = \&Carp::confess;
> >
> > (e.g. at the startup or your script)
> >
> > so the next time it fails you will see the exact calls trace. You can further 
> > expand that sighandler to dump more information to figure out what triggers 
> > the problem, helping you to define a reproduceable at will test program which 
> > can them be easily solved.
> 
> Stas does have a good recommendation here, so please don't discount it.  I 
> should point out the XML::LibXML module can read directly from a file.  Is 
> there a specific reason why you don't use that method?  Search for the 
> parse_file( $filename ) method.  I am interested in seeing if a specific 
> problem exists in the XML::LibXML module though as it is a module I 
> generally track and use quite often.  Currently it is using methods that 
> are deprecated in the C library and it needs to be transitioned to a new 
> logic.  As time permits of course ...

I used to use parse_file but I was running into problems with
XML::LibXML not closing the file properly.  Using IO::File and then
parse_fh solved that problem.

I found out a little more about my problem ... it's not anything to do
with XML::LibXML at all.  It seems that sometimes i'm losing my POST
data.  A few times i'm seeing GETs where they should be POSTs as well,
this could also be explained by the user bookmarking and then trying to
return to the bookmark, but that doesn't explain the times it happens
with a POST request.

My mod_perl version is 1.29 running on apache 1.3.33.

-- 
James Orr <ja...@orrwhat.net>

Re: mod_perl and XML::LibXML

Posted by "D. Hageman" <dh...@dracken.com>.
On Thu, 17 Mar 2005, Stas Bekman wrote:

> James Orr wrote:
>> Hi,
>> 
>> I have an occaisional error happening with a module i'm using from a
>> mod_perl script.  This is in my "new" method ...
>> 
>> my $ifh = IO::File->new($project_dir.'/info.xml') || die "Can't open
>> info file: $!";
>> $data->{'info'} = $parser->parse_fh($ifh);
>> 
>> And the error it gives is ...
>> 
>> read on filehandle failed: Can't use an undefined value as a symbol
>> reference at /usr/lib/perl5/site_perl/5.8.4/i686-linux/XML/LibXML.pm
>> line 336.
>> 
>> By occaisional I mean that this error has occured 21 times in over
>> 21,000 hits.
>
> James, assuming that you don't use any eval {} blocks, try to install:
>
> use Carp;
> $SIG{__DIE__} = \&Carp::confess;
>
> (e.g. at the startup or your script)
>
> so the next time it fails you will see the exact calls trace. You can further 
> expand that sighandler to dump more information to figure out what triggers 
> the problem, helping you to define a reproduceable at will test program which 
> can them be easily solved.

Stas does have a good recommendation here, so please don't discount it.  I 
should point out the XML::LibXML module can read directly from a file.  Is 
there a specific reason why you don't use that method?  Search for the 
parse_file( $filename ) method.  I am interested in seeing if a specific 
problem exists in the XML::LibXML module though as it is a module I 
generally track and use quite often.  Currently it is using methods that 
are deprecated in the C library and it needs to be transitioned to a new 
logic.  As time permits of course ...

//========================================================\\
||  D. Hageman                    <dh...@dracken.com>  ||
\\========================================================//

Re: mod_perl and XML::LibXML

Posted by Stas Bekman <st...@stason.org>.
James Orr wrote:
> Hi,
> 
> I have an occaisional error happening with a module i'm using from a
> mod_perl script.  This is in my "new" method ...
> 
> my $ifh = IO::File->new($project_dir.'/info.xml') || die "Can't open
> info file: $!";
> $data->{'info'} = $parser->parse_fh($ifh);
> 
> And the error it gives is ...
> 
> read on filehandle failed: Can't use an undefined value as a symbol
> reference at /usr/lib/perl5/site_perl/5.8.4/i686-linux/XML/LibXML.pm
> line 336.
> 
> By occaisional I mean that this error has occured 21 times in over
> 21,000 hits.

James, assuming that you don't use any eval {} blocks, try to install:

use Carp;
$SIG{__DIE__} = \&Carp::confess;

(e.g. at the startup or your script)

so the next time it fails you will see the exact calls trace. You can 
further expand that sighandler to dump more information to figure out what 
triggers the problem, helping you to define a reproduceable at will test 
program which can them be easily solved.




-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com