Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: What magic is this?

by RMGir (Prior)
on Oct 26, 2006 at 12:09 UTC ( [id://580740]=note: print w/replies, xml ) Need Help??


in reply to What magic is this?

No. But it's very interesting!

What happens if you put

use Carp; # or Coy, if you want humour
in your first script (the one without the $SIG{__WARN__} and $SIG{__DIE__} settings)?

I'm curious to see if those modules (which must set those signals themselves) also trigger the misbehaviour.

Also, if you look at line 451 of Expat.pm, does it really try to use a symbolic ref?


Mike

Replies are listed 'Best First'.
Re^2: What magic is this?
by Jonathan (Curate) on Oct 26, 2006 at 12:38 UTC
    You have an interesting take on the word 'interesting' :-)

    Expat.pm has use Carp in it, when I added it to my first script it made no difference. It still ran without complaining.

    Line 451...

    if (defined $arg) { if (ref($arg) and UNIVERSAL::isa($arg, 'IO::Handler')) { $ioref = $arg; } else { eval { --> $ioref = *{$arg}{IO}; }; undef $@; } }
    I've tried eval'ing the call in my code but the error message still gets through. As its stands I'm going to have to amend my log_die sub-routine to ignore messages with Expat in them (which is horrible).
      That code block in my Expat.pm (version 2.34) looks like
      if (defined $arg) { if (ref($arg) and UNIVERSAL::isa($arg, 'IO::Handle')) { $ioref = $arg; } elsif (tied($arg)) { my $class = ref($arg); no strict 'refs'; $ioref = $arg if defined &{"${class}::TIEHANDLE"}; } else { require IO::Handle; eval { no strict 'refs'; $ioref = *{$arg}{IO} if defined *{$arg}; }; undef $@; } }

      but to me it looks equally scary. undef $@ after eval? wtf?

      At least, there's no strict 'refs'; inside the eval (but isn't it another wtf?)

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://580740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-23 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found