1B::Utils::OP(3) User Contributed Perl Documentation B::Utils::OP(3)
2
3
4
6 B::Utils::OP - op related utility functions for perl
7
9 version 0.27
10
12 use B::Utils::OP qw(parent_op return_op);
13 sub foo {
14 my $pop = parent_op(0);
15 my $rop = return_op(0);
16 }
17
19 sub foo {
20 dothis(1);
21 find_things();
22 return;
23 }
24
25 has the following optree:
26
27 d <1> leavesub[1 ref] K/REFC,1 ->(end)
28 - <@> lineseq KP ->d
29 1 <;> nextstate(main -371 bah.pl:8) v/2 ->2
30 5 <1> entersub[t2] vKS/TARG,3 ->6
31 - <1> ex-list K ->5
32 2 <0> pushmark s ->3
33 3 <$> const[IV 1] sM ->4
34 - <1> ex-rv2cv sK/3 ->-
35 4 <#> gv[*dothis] s ->5
36 6 <;> nextstate(main -371 bah.pl:9) v/2 ->7
37
38 9 <1> entersub[t4] vKS/TARG,3 ->a
39 - <1> ex-list K ->9
40 7 <0> pushmark s ->8
41 - <1> ex-rv2cv sK/3 ->-
42 8 <#> gv[*find_things] s/EARLYCV ->9
43
44 a <;> nextstate(main -371 bah.pl:10) v/2 ->b
45 c <@> return K ->d
46 b <0> pushmark s ->c
47
48 The "find_things" in "foo" is called in the "entersub" in #9. If you
49 call "parent_op" function with level 0, you get the "nextstate" op that
50 is before the entersub, which is #6. And "return_op" gives you the
51 next op that the caller is returning to, in this case, the "nextstate"
52 in #a.
53
54 EXPORTED PERL FUNCTIONS
55 parent_op($lv)
56 In runtime, returns the B::OP object whose next is the "entersub"
57 of the current context up level $lv
58
59 return_op($lv)
60 In runtime, returns the B::OP object that the current context is
61 returning to at level $lv
62
63 B::CV METHODS
64 $cv->NEW_with_start($root, $start)
65 Clone the $cv but with different $root and $start
66
68 Chia-liang Kao <clkao@clkao.org>
69
71 Copyright 2008 by Chia-liang Kao
72
73 This program is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75
76 See <http://www.perl.com/perl/misc/Artistic.html>
77
78
79
80perl v5.28.0 2015-07-22 B::Utils::OP(3)