problem with XML::Parser dying on errors...

  • Thread starter Bruno Boettcher
  • Start date
B

Bruno Boettcher

hello!

i have a little daemon which fetches regularly some rss feeds, now for
some time that daemon keeps crashing on me with the message:
not well-formed (invalid token) at line 80, column 45, byte 4904 at
/usr/lib/perl5/XML/Parser.pm line 187
from the cpan shell:
XML::parser is up to date (2.34).

i mean i would like to deal with the error myself, e.g. spit out the
data that caused that error... but at the moment i seem unable to stop
XML::parser or expat to die on my with no usable info on what is going
wrong....

anyway since that thing is supposed to be a daemon, i can't have modules
dying nad compromising the whole functionality...
is there any way to stop it from doing that?
 
X

xhoster

hello!

i have a little daemon which fetches regularly some rss feeds, now for
some time that daemon keeps crashing on me with the message:
not well-formed (invalid token) at line 80, column 45, byte 4904 at
/usr/lib/perl5/XML/Parser.pm line 187
from the cpan shell:
XML::parser is up to date (2.34).

i mean i would like to deal with the error myself, e.g. spit out the
data that caused that error... but at the moment i seem unable to stop
XML::parser or expat to die on my with no usable info on what is going
wrong....

You trap XML::parser dies the same way you trap any other dies in Perl,
by using eval BLOCK. See perldoc -f eval. Once you trap the die, I don't
know how you get the data which caused it in a nice format for printing.
Perhaps you should pass your data through a validator before giving it to
XML::parser.

Xho
 
T

Tad McClellan

Bruno Boettcher said:
not well-formed (invalid token) at line 80, column 45, byte 4904 at
/usr/lib/perl5/XML/Parser.pm line 187
from the cpan shell:
XML::parser is up to date (2.34).

i mean i would like to deal with the error myself, e.g. spit out the
data that caused that error... but at the moment i seem unable to stop
XML::parser or expat to die on my with no usable info on what is going
wrong....

anyway since that thing is supposed to be a daemon, i can't have modules
dying nad compromising the whole functionality...
is there any way to stop it from doing that?


You use "eval BLOCK" to handle exceptions in Perl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top