[Jifty-commit] r5661 - in B-OPCheck: lib/B

Jifty commits jifty-commit at lists.jifty.org
Mon Aug 4 14:15:34 EDT 2008


Author: nothingmuch
Date: Mon Aug  4 14:15:34 2008
New Revision: 5661

Modified:
   B-OPCheck/lib/B/OPCheck.pm
   B-OPCheck/t/entersub.t

Log:
docs

Modified: B-OPCheck/lib/B/OPCheck.pm
==============================================================================
--- B-OPCheck/lib/B/OPCheck.pm	(original)
+++ B-OPCheck/lib/B/OPCheck.pm	Mon Aug  4 14:15:34 2008
@@ -41,5 +41,83 @@
     $^H &= ~0x120000;
 }
 
-
 1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+B::OPCheck - PL_check hacks using Perl callbacks
+
+=head1 SYNOPSIS
+
+    use B::Generate; # to change things
+
+    use B::OPCheck entersub => check => sub {
+        my $op = shift; # op has been checked by normal PL_check
+        sodomize($op);
+    };
+
+    foo(); # this entersub will have the callback triggered
+
+=head1 DESCRIPTION
+
+PL_check is an array indexed by opcode number (op_type) that contains function
+pointers invoked as the last stage of optree compilation, per op.
+
+This hook is called in bottom up order, as the code is parsed and the optree is
+prepared.
+
+This is how modules like L<autobox> do their magic
+
+This module provides an api for registering PL_check hooks lexically, allowing
+you to alter the behavior of certain ops using L<B::Generate> from perl space.
+
+=head1 CHECK TYPES
+
+=over 4
+
+=item check
+
+Called after normal PL_checking. The return value is ignored.
+
+=item after
+
+Not yet implemented.
+
+Allows you to return a processed B::OP. The op has been processed by PL_check
+already.
+
+=item before
+
+Not yet implemented.
+
+Allows you to return a processed B::OP to be passed to normal PL_check.
+
+=item replace
+
+Not yet implemented.
+
+Allows you to return a processed B::OP yourself, skipping normal PL_check
+handling completely.
+
+=back
+
+=head1 AUTHORS
+
+Chia-liang Kao E<lt>clkao at clkao.orgE<gt>
+Yuval Kogman E<lt>nothingmuch at woobling.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright 2008 by Chia-liang Kao, Yuval Kogman
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
+

Modified: B-OPCheck/t/entersub.t
==============================================================================
--- B-OPCheck/t/entersub.t	(original)
+++ B-OPCheck/t/entersub.t	Mon Aug  4 14:15:34 2008
@@ -12,7 +12,7 @@
 }
 
 sub test {
-    use B::OPCheck entersub => 'replace', \&dothis;
+    use B::OPCheck entersub => check => \&dothis;
     foo(1,2);
     printf "foo";
     foo("dancing");


More information about the Jifty-commit mailing list