Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Perhaps eval (); should be eval { };?

    use XML::RSS;
    my $f = XML::RSS->new;
    eval { $f->parse( 'x' ); };
    print 'okay';
    • Unless you mis-transcribed, LTJake is right. What you're doing is "eval EXPR" which evaluates the expression normally, then assumes it's a string containing Perl code and evaluates that. What you want is "eval BLOCK" which runs the block of code, catching exceptions.
      • Yep, that's exactly what it is. The only mis-transcription was that I'd formatted it all pretty in my code just like it was a block, and it never once registered that hey, those are awfully rounded curly-braces. Not even when I left it all on one line in my rant. (And I guess that parse() must return a 1 or something equally harmless on success.)

        Bah, decongestants. This is why I'm not working on production code today. And clearly should not even be let near even the quick hack stuff, either.

        Thanks, g