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.
  • I've got a bloody good mind to write Break::Mouse which will delete that subroutine if it ever spots that it's been created. And load it into my CPAN-testing machines.

    This shows why monkey-patching is generally a bad idea.

    package Break::Mouse;

    use Time::HiRes qw(setitimer ITIMER_VIRTUAL);
    setitimer(ITIMER_VIRTUAL, 1, 1);
    $SIG{VTALRM} = sub {
        eval 'sub UNIVERSAL::a_sub_not_likely_to_be_here { die("Monkey-patching is bad\n")';

    • Evil indeed.

      So how do we implement blessed without XS? As I said in a sibling comment, Mouse doesn't do this any more, it now just depends on Scalar::Util. But since I just took the code from Scalar::Util, so your package should be named Break::Scalar::Util.

      • Check to see if it's a reference and *isn't* a reference to a scalar/array/hash/sub etc. The list of magic values returned by ref() for all the built-in types is in perldoc -f ref.

        • Seems silly to reinvent the wheel when Scalar::Util already has a nice shiny round one in the core.
      • UNIVERSAL::can( $foo, 'can' )