Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Your BEGIN, CHECK, INIT, and END blocks are present in the arrays Perl_(begin|check|init|end)av[]. You will need to set some variable like Perl_savebegin or somesuch to have anything to look at in Perl_beginav[].

    There might not be an array for UNITCHECK.

    Manip::END lets you muck with END blocks from perl-space. There's another one which does other blocks but I forget its name.
    • Aw, crap. My XS skills are week. However, the code itself doesn't look too difficult. I'll play with it. Right now it appears to work, but the code itself isn't too useful because of the 'naked' code reference:

      #!/usr/bin/perl -l

      use strict;
      use warnings;

      use Data::Dumper;
      use Manip::END;
      use Sub::Information;

      {
          package Foo;

          END { print 'end!' }
      }

      my $ends = Manip::END->new;
      print Dumper($ends);
      print $ends->[0]->();
      print inspect( $ends->[0] )->code;

      That produces: