line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package B::Utils::OP; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.006; |
4
|
1
|
|
|
1
|
|
2604
|
use Carp 'croak'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
49
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
7
|
use B::Utils (); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
101
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = 'Exporter'; |
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
our $VERSION = '0.26'; |
12
|
|
|
|
|
|
|
our @EXPORT = qw(parent_op return_op); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
push @ISA, 'DynaLoader'; |
16
|
|
|
|
|
|
|
# the boot symbol is in B::Utils. bootstrap doesn't like it, so we |
17
|
|
|
|
|
|
|
# need to load it manually. |
18
|
|
|
|
|
|
|
my $bootname = 'boot_B__Utils__OP'; |
19
|
|
|
|
|
|
|
if (my $boot_symbol_ref = DynaLoader::dl_find_symbol_anywhere($bootname)) { |
20
|
|
|
|
|
|
|
DynaLoader::dl_install_xsub(__PACKAGE__."::bootstrap", $boot_symbol_ref, __FILE__)->(__PACKAGE__, $VERSION); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
B::Utils::OP - op related utility functions for perl |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
version 0.26 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use B::Utils::OP qw(parent_op return_op); |
34
|
|
|
|
|
|
|
sub foo { |
35
|
|
|
|
|
|
|
my $pop = parent_op(0); |
36
|
|
|
|
|
|
|
my $rop = return_op(0); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub foo { |
42
|
|
|
|
|
|
|
dothis(1); |
43
|
|
|
|
|
|
|
find_things(); |
44
|
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has the following optree: |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
d <1> leavesub[1 ref] K/REFC,1 ->(end) |
50
|
|
|
|
|
|
|
- <@> lineseq KP ->d |
51
|
|
|
|
|
|
|
1 <;> nextstate(main -371 bah.pl:8) v/2 ->2 |
52
|
|
|
|
|
|
|
5 <1> entersub[t2] vKS/TARG,3 ->6 |
53
|
|
|
|
|
|
|
- <1> ex-list K ->5 |
54
|
|
|
|
|
|
|
2 <0> pushmark s ->3 |
55
|
|
|
|
|
|
|
3 <$> const[IV 1] sM ->4 |
56
|
|
|
|
|
|
|
- <1> ex-rv2cv sK/3 ->- |
57
|
|
|
|
|
|
|
4 <#> gv[*dothis] s ->5 |
58
|
|
|
|
|
|
|
6 <;> nextstate(main -371 bah.pl:9) v/2 ->7 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
9 <1> entersub[t4] vKS/TARG,3 ->a |
61
|
|
|
|
|
|
|
- <1> ex-list K ->9 |
62
|
|
|
|
|
|
|
7 <0> pushmark s ->8 |
63
|
|
|
|
|
|
|
- <1> ex-rv2cv sK/3 ->- |
64
|
|
|
|
|
|
|
8 <#> gv[*find_things] s/EARLYCV ->9 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
a <;> nextstate(main -371 bah.pl:10) v/2 ->b |
67
|
|
|
|
|
|
|
c <@> return K ->d |
68
|
|
|
|
|
|
|
b <0> pushmark s ->c |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
The C in C is called in the C in #9. If |
71
|
|
|
|
|
|
|
you call C function with level 0, you get the C |
72
|
|
|
|
|
|
|
op that is before the entersub, which is #6. And C gives |
73
|
|
|
|
|
|
|
you the next op that the caller is returning to, in this case, the |
74
|
|
|
|
|
|
|
C in #a. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 EXPORTED PERL FUNCTIONS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item parent_op($lv) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
In runtime, returns the L object whose next is the C of the current context up level C<$lv> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item return_op($lv) |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
In runtime, returns the L object that the current context is returning to at level C<$lv> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 B::CV METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item $cv->NEW_with_start($root, $start) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Clone the C<$cv> but with different C<$root> and C<$start> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHORS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Chia-liang Kao Eclkao@clkao.orgE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Copyright 2008 by Chia-liang Kao |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
109
|
|
|
|
|
|
|
under the same terms as Perl itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
See L |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |