line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlX::Perform; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
70402
|
use 5.006; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
144
|
|
4
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
482
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS, @ISA); |
7
|
|
|
|
|
|
|
BEGIN { |
8
|
3
|
|
|
3
|
|
7
|
$PerlX::Perform::AUTHORITY = 'cpan:TOBYINK'; |
9
|
3
|
|
|
|
|
16
|
$PerlX::Perform::VERSION = '0.006'; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
14
|
require Exporter; |
12
|
3
|
|
|
|
|
42
|
@ISA = qw/Exporter/; |
13
|
3
|
|
|
|
|
9
|
@EXPORT = qw/perform wherever/; |
14
|
3
|
|
|
|
|
7
|
@EXPORT_OK = qw/perform wherever whenever/; |
15
|
3
|
|
|
|
|
993
|
%EXPORT_TAGS = ( |
16
|
|
|
|
|
|
|
default => \@EXPORT, |
17
|
|
|
|
|
|
|
all => \@EXPORT_OK, |
18
|
|
|
|
|
|
|
wherever => [qw/perform wherever/], |
19
|
|
|
|
|
|
|
whenever => [qw/perform whenever/], |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub blessed ($) |
24
|
|
|
|
|
|
|
{ |
25
|
30
|
|
|
30
|
1
|
37
|
my $thing = shift; |
26
|
30
|
100
|
66
|
|
|
345
|
if (ref $thing and UNIVERSAL::can($thing, 'can')) |
27
|
|
|
|
|
|
|
{ |
28
|
10
|
|
50
|
|
|
104
|
return (ref($thing) || $thing || 1); |
29
|
|
|
|
|
|
|
} |
30
|
20
|
|
|
|
|
92
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub perform (&;$) |
34
|
|
|
|
|
|
|
{ |
35
|
30
|
|
|
30
|
1
|
89
|
my ($coderef, $thing) = @_; |
36
|
30
|
100
|
|
|
|
95
|
if (defined $thing) |
37
|
|
|
|
|
|
|
{ |
38
|
12
|
|
|
|
|
15
|
$_ = $thing; |
39
|
12
|
|
|
|
|
23
|
@_ = (); |
40
|
12
|
|
|
|
|
38
|
goto $coderef; |
41
|
|
|
|
|
|
|
} |
42
|
18
|
100
|
|
|
|
48
|
if (@_ == 1) |
43
|
|
|
|
|
|
|
{ |
44
|
16
|
|
|
|
|
143
|
return PerlX::Perform::Manifesto->new($coderef); |
45
|
|
|
|
|
|
|
} |
46
|
2
|
|
|
|
|
13
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub wherever ($;@) |
50
|
|
|
|
|
|
|
{ |
51
|
26
|
|
|
26
|
1
|
38
|
my $thing = shift; |
52
|
26
|
100
|
100
|
|
|
130
|
if (@_ and !ref $_[0] and $_[0] eq 'perform') |
|
|
|
66
|
|
|
|
|
53
|
|
|
|
|
|
|
{ |
54
|
4
|
|
|
|
|
7
|
shift; |
55
|
|
|
|
|
|
|
} |
56
|
26
|
100
|
100
|
|
|
139
|
if (@_ and blessed $_[0] and $_[0]->isa('PerlX::Perform::Manifesto')) |
|
|
100
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
57
|
|
|
|
|
|
|
{ |
58
|
10
|
|
|
|
|
15
|
my $manifesto = shift; |
59
|
10
|
|
|
|
|
23
|
@_ = ($thing); |
60
|
10
|
|
|
|
|
25
|
goto $manifesto; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
elsif (@_ and ref $_[0] eq 'CODE') |
63
|
|
|
|
|
|
|
{ |
64
|
4
|
|
|
|
|
11
|
my $manifesto = &perform(shift); |
65
|
4
|
|
|
|
|
9
|
@_ = ($thing); |
66
|
4
|
|
|
|
|
16
|
goto $manifesto; |
67
|
|
|
|
|
|
|
} |
68
|
12
|
|
|
|
|
43
|
return $thing; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
*whenever = \&wherever; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
package PerlX::Perform::Manifesto; |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
3
|
|
42
|
use 5.006; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
108
|
|
76
|
3
|
|
|
3
|
|
13
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
370
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new |
79
|
|
|
|
|
|
|
{ |
80
|
16
|
|
|
16
|
|
31
|
my ($class, $code) = @_; |
81
|
|
|
|
|
|
|
|
82
|
16
|
50
|
33
|
|
|
32
|
if (PerlX::Perform::blessed $code and $code->isa(__PACKAGE__)) |
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
0
|
return $code; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
bless sub { |
88
|
14
|
|
|
14
|
|
18
|
my $thing = shift; |
89
|
14
|
100
|
|
|
|
44
|
return unless defined $thing; |
90
|
8
|
|
|
|
|
11
|
$_ = $thing; |
91
|
8
|
|
|
|
|
14
|
@_ = (); |
92
|
8
|
|
|
|
|
25
|
goto $code; |
93
|
16
|
|
|
|
|
126
|
}, $class; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__FILE__ |
97
|
|
|
|
|
|
|
__END__ |