Hey all, I have this block of code: sub is_valid_xml { > my ($content) = @_; > > eval { > my $xs = XML::Simple->new(); > my $ref = $xs->parse_string($content); > }; > > return 1 unless ($@); > } >
and when I pass in 'blahblahblah' as an argument, I get: syntax error at line 1, column 0, byte 0 at /usr/lib/perl5/XML/Parser.pm > line 187 I would like to trap this syntax error, but don't know how. I've tried each of these statements individually: local $SIG{'__DIE__'}; > local $SIG{'__WARN__'}; > no warnings 'all'; > to no avail. Would someone kindly help me out? Thanks, Jon