line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package UNIVERSAL::isa; |
3
|
16
|
|
|
16
|
|
75
|
|
|
16
|
|
|
|
|
28
|
|
|
16
|
|
|
|
|
693
|
|
4
|
16
|
|
|
16
|
|
74
|
use strict; |
|
16
|
|
|
|
|
42
|
|
|
16
|
|
|
|
|
646
|
|
5
|
|
|
|
|
|
|
use vars qw( $VERSION $recursing ); |
6
|
16
|
|
|
16
|
|
15382
|
|
|
16
|
|
|
|
|
221
|
|
|
16
|
|
|
|
|
359
|
|
7
|
|
|
|
|
|
|
use UNIVERSAL (); |
8
|
16
|
|
|
16
|
|
83
|
|
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
728
|
|
9
|
16
|
|
|
16
|
|
88
|
use Scalar::Util 'blessed'; |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
2687
|
|
10
|
|
|
|
|
|
|
use warnings::register; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '1.03'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ( $orig, $verbose_warning ); |
15
|
16
|
|
|
16
|
|
306
|
|
16
|
|
|
|
|
|
|
BEGIN { $orig = \&UNIVERSAL::isa } |
17
|
16
|
|
|
16
|
|
79
|
|
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
1108
|
|
18
|
|
|
|
|
|
|
no warnings 'redefine'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import |
21
|
16
|
|
|
16
|
|
35
|
{ |
22
|
16
|
|
|
16
|
|
93
|
my $class = shift; |
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
8265
|
|
23
|
|
|
|
|
|
|
no strict 'refs'; |
24
|
16
|
|
|
|
|
323
|
|
25
|
|
|
|
|
|
|
for my $arg (@_) |
26
|
0
|
0
|
|
|
|
0
|
{ |
|
0
|
|
|
|
|
0
|
|
27
|
0
|
0
|
|
|
|
0
|
*{ caller() . '::isa' } = \&UNIVERSAL::isa if $arg eq 'isa'; |
28
|
|
|
|
|
|
|
$verbose_warning = 1 if $arg eq 'verbose'; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub UNIVERSAL::isa |
33
|
162660
|
100
|
|
162660
|
1
|
598049
|
{ |
34
|
153432
|
|
|
|
|
255708
|
goto &$orig if $recursing; |
35
|
153432
|
|
|
|
|
372171
|
my $type = invocant_type(@_); |
36
|
|
|
|
|
|
|
$type->(@_); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub invocant_type |
40
|
153432
|
|
|
153432
|
0
|
189802
|
{ |
41
|
153432
|
50
|
|
|
|
283636
|
my $invocant = shift; |
42
|
153432
|
100
|
|
|
|
440061
|
return \&nonsense unless defined($invocant); |
43
|
144471
|
100
|
|
|
|
263317
|
return \&object_or_class if blessed($invocant); |
44
|
144002
|
50
|
|
|
|
253290
|
return \&reference if ref($invocant); |
45
|
144002
|
|
|
|
|
283501
|
return \&nonsense unless $invocant; |
46
|
|
|
|
|
|
|
return \&object_or_class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub nonsense |
50
|
0
|
0
|
|
0
|
0
|
0
|
{ |
51
|
0
|
|
|
|
|
0
|
report_warning('on invalid invocant') if $verbose_warning; |
52
|
|
|
|
|
|
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub object_or_class |
56
|
|
|
|
|
|
|
{ |
57
|
152963
|
|
|
152963
|
0
|
169573
|
|
58
|
152963
|
|
|
|
|
178933
|
local $@; |
59
|
|
|
|
|
|
|
local $recursing = 1; |
60
|
152963
|
50
|
|
|
|
203014
|
|
|
152963
|
|
|
|
|
522113
|
|
61
|
|
|
|
|
|
|
if ( my $override = eval { $_[0]->can('isa') } ) |
62
|
152963
|
50
|
|
|
|
392372
|
{ |
63
|
|
|
|
|
|
|
unless ( $override == \&UNIVERSAL::isa ) |
64
|
0
|
|
|
|
|
0
|
{ |
65
|
0
|
|
|
|
|
0
|
report_warning(); |
66
|
0
|
|
|
|
|
0
|
my $obj = shift; |
67
|
|
|
|
|
|
|
return $obj->$override(@_); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
152963
|
50
|
|
|
|
354638
|
|
71
|
152963
|
|
|
|
|
1463309
|
report_warning() if $verbose_warning; |
72
|
|
|
|
|
|
|
goto &$orig; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub reference |
76
|
469
|
50
|
|
469
|
0
|
1210
|
{ |
77
|
|
|
|
|
|
|
report_warning('Did you mean to use Scalar::Util::reftype() instead?') |
78
|
469
|
|
|
|
|
3544
|
if $verbose_warning; |
79
|
|
|
|
|
|
|
goto &$orig; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub report_warning |
83
|
0
|
|
|
0
|
0
|
|
{ |
84
|
0
|
0
|
|
|
|
|
my $extra = shift; |
85
|
|
|
|
|
|
|
$extra = $extra ? " ($extra)" : ''; |
86
|
0
|
0
|
|
|
|
|
|
87
|
|
|
|
|
|
|
if ( warnings::enabled() ) |
88
|
0
|
|
0
|
|
|
|
{ |
89
|
0
|
0
|
|
|
|
|
my $calling_sub = ( caller(3) )[3] || ''; |
90
|
0
|
|
|
|
|
|
return if $calling_sub =~ /::isa$/; |
91
|
|
|
|
|
|
|
warnings::warn( |
92
|
|
|
|
|
|
|
"Called UNIVERSAL::isa() as a function, not a method$extra" ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__PACKAGE__; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |