1B::Utils::OP(3)       User Contributed Perl Documentation      B::Utils::OP(3)
2
3
4

NAME

6       B::Utils::OP - op related utility functions for perl
7

SYNOPSIS

9         use B::Utils::OP qw(parent_op return_op);
10         sub foo {
11           my $pop = parent_op(0);
12           my $rop = return_op(0);
13         }
14

DESCRIPTION

16         sub foo {
17           dothis(1);
18           find_things();
19           return;
20         }
21
22       has the following optree:
23
24        d  <1> leavesub[1 ref] K/REFC,1 ->(end)
25        -     <@> lineseq KP ->d
26        1        <;> nextstate(main -371 bah.pl:8) v/2 ->2
27        5        <1> entersub[t2] vKS/TARG,3 ->6
28        -           <1> ex-list K ->5
29        2              <0> pushmark s ->3
30        3              <$> const[IV 1] sM ->4
31        -              <1> ex-rv2cv sK/3 ->-
32        4                 <#> gv[*dothis] s ->5
33        6        <;> nextstate(main -371 bah.pl:9) v/2 ->7
34
35        9        <1> entersub[t4] vKS/TARG,3 ->a
36        -           <1> ex-list K ->9
37        7              <0> pushmark s ->8
38        -              <1> ex-rv2cv sK/3 ->-
39        8                 <#> gv[*find_things] s/EARLYCV ->9
40
41        a        <;> nextstate(main -371 bah.pl:10) v/2 ->b
42        c        <@> return K ->d
43        b           <0> pushmark s ->c
44
45       The "find_things" in "foo" is called in the "entersub" in #9.  If you
46       call "parent_op" function with level 0, you get the "nextstate" op that
47       is before the entersub, which is #6.  And "return_op" gives you the
48       next op that the caller is returning to, in this case, the "nextstate"
49       in #a.
50
51   EXPORTED PERL FUNCTIONS
52       parent_op($lv)
53           In runtime, returns the B::OP object whose next is the "entersub"
54           of the current context up level $lv
55
56       return_op($lv)
57           In runtime, returns the B::OP object that the current context is
58           returning to at level $lv
59
60   B::CV METHODS
61       $cv->NEW_with_start($root, $start)
62           Clone the $cv but with different $root and $start
63

AUTHORS

65       Chia-liang Kao <clkao@clkao.org>
66
68       Copyright 2008 by Chia-liang Kao
69
70       This program is free software; you can redistribute it and/or modify it
71       under the same terms as Perl itself.
72
73       See <http://www.perl.com/perl/misc/Artistic.html>
74
75
76
77perl v5.12.0                      2010-01-12                   B::Utils::OP(3)
Impressum