This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document PL_opfreehook
authorVincent Pit <vince@profvince.com>
Wed, 15 Jul 2009 20:32:36 +0000 (22:32 +0200)
committerVincent Pit <perl@profvince.com>
Wed, 15 Jul 2009 20:44:57 +0000 (22:44 +0200)
intrpvar.h

index 975bab0..9f8e443 100644 (file)
@@ -170,6 +170,18 @@ PERLVARA(Icolors,6,        char *)         /* from regcomp.c */
 PERLVARI(Ipeepp,       peep_t, MEMBER_TO_FPTR(Perl_peep))
                                        /* Pointer to peephole optimizer */
 
+/*
+=for apidoc Amn|Perl_ophook_t|PL_opfreehook
+
+When non-C<NULL>, the function pointed by this variable will be called each time an OP is freed with the corresponding OP as the argument.
+This allows extensions to free any extra attribute they have locally attached to an OP.
+It is also assured to first fire for the parent OP and then for its kids.
+
+When you replace this variable, it is considered a good practice to store the possibly previously installed hook and that you recall it inside your own.
+
+=cut
+*/
+
 PERLVARI(Iopfreehook,  Perl_ophook_t, 0) /* op_free() hook */
 
 PERLVARI(Imaxscream,   I32,    -1)