Re: Shortcutting a SAX parser

Michael Ludwig <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Jenda Krynicky schrieb:
> From:           	Michael Ludwig <[email protected]>

>>    eval { die 'Gurke' };
>>    print $@ if $@;
>
> Compare
>
>     eval { die "Gurke\n" };
>     print $@ if $@;

I know, add a newline to prevent the line number from being tagged unto
the end of the string. I should have written that in the example I gave.

In the case of the example script I posted, however, this doesn't help,
as something gets in the way and stringifies the exception, which is a
reference blessed into a class.

>> Second, the documentation I referred to above does not describe the
>> behaviour I'm observing. $@ is not a blessed hash reference, but a
>> simple string. Maybe that has to do with the fact that the class
>> overloads "", but then, I don't know how to get at the object.
>
>   use XML::SAX::Exception;
>   @XML::SAX::Exception::Done::ISA = ('XML::SAX::Exception');
>
>   use Data::Dumper;
>   eval { throw XML::SAX::Exception::Done( Message => 'Doc done' ); };
>   print Dumper($@) if $@;
>
> seems to work for me.

Same for me.

> If it doesn't for you, someone must be catching and rethrowing the
> exception and stringifying it along the way.

Yes, exactly.

Michael Ludwig
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.