line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::Previous; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
23718
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
159
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
142
|
|
5
|
4
|
|
|
4
|
|
31
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
538
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
4
|
|
|
4
|
|
23
|
use base 'Exporter'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
3278
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "1.1012"; |
11
|
|
|
|
|
|
|
our @EXPORT = qw(previous_object); ## no critic |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub previous_object {}; |
14
|
|
|
|
|
|
|
sub import { |
15
|
4
|
100
|
66
|
4
|
|
56
|
if( @_==1 or $_[1] !~ m/(:?pure|perl|pl)/ ) { |
16
|
3
|
|
|
|
|
6
|
eval { |
17
|
3
|
|
|
|
|
17
|
require XSLoader; |
18
|
3
|
|
|
|
|
2627
|
XSLoader::load('Object::Previous', $VERSION); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
3
|
50
|
|
|
|
28
|
if( $@ ) { |
22
|
0
|
|
|
|
|
0
|
warn "couldn't load _xs version: $@"; |
23
|
0
|
|
|
|
|
0
|
*previous_object = *previous_object_pl; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} else { |
26
|
3
|
|
|
|
|
19
|
*previous_object = *previous_object_xs; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} else { |
30
|
1
|
|
|
|
|
3
|
splice @_, 1, 1; |
31
|
1
|
|
|
|
|
6
|
*previous_object = *previous_object_pl; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
4
|
|
|
|
|
8722
|
goto &Exporter::import; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub previous_object_pl { |
38
|
1
|
|
|
1
|
0
|
455
|
my @foo = do { package DB; @DB::args=(); caller(2) }; ## no critic |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
11
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# NOTE: this doesn't work if, in that previous object, you were to do this: |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
# unshift @_, "borked". |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
# The result is that you'd get "borked" instead of the blessed ref of the caller object |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# NOTE: I call this pure-perl vesion The Chromatic Way, but it's really the Devel::StackTrace way see: |
47
|
|
|
|
|
|
|
# - http://perlmonks.org/?node_id=690713 |
48
|
|
|
|
|
|
|
# - http://perlmonks.org/?node_id=690795 |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
5
|
return $DB::args[0]; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |