line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aspect::Legacy; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Aspect::Legacy - Legacy Compatibility for Aspect.pm |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
B implements emulated support for the L module as it |
12
|
|
|
|
|
|
|
existed in various forms prior to the 1.00 release in 2010. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This includes both full legacy support for the original Ran Eilam release series |
15
|
|
|
|
|
|
|
ending in release 0.12, and for code written against the 0.16 to 0.99 |
16
|
|
|
|
|
|
|
development release series. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
In it's default usage, it is intended as a drop-in upgrade for any old |
19
|
|
|
|
|
|
|
Aspect-oriented code broken by changes in the second-generation |
20
|
|
|
|
|
|
|
(version 0.90 or later) implementation created during 2010. To upgrade our old |
21
|
|
|
|
|
|
|
code, simple change C |
22
|
|
|
|
|
|
|
continue to function as normal. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
4
|
|
28106
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
139
|
|
27
|
4
|
|
|
4
|
|
816
|
use Aspect (); |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
69
|
|
28
|
4
|
|
|
4
|
|
22
|
use Exporter (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2428
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
31
|
|
|
|
|
|
|
our @ISA = 'Exporter'; |
32
|
|
|
|
|
|
|
our @EXPORT = qw( aspect before after call cflow ); |
33
|
|
|
|
|
|
|
our $INSTALLED = 0; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Install deprecated functionality |
36
|
|
|
|
|
|
|
*Aspect::after_throwing = *Aspect::Legacy::after_throwing; |
37
|
|
|
|
|
|
|
*Aspect::after_returning = *Aspect::Legacy::after_returning; |
38
|
|
|
|
|
|
|
*Aspect::Point::params = *Aspect::Legacy::params; |
39
|
|
|
|
|
|
|
*Aspect::Point::params_ref = *Aspect::Legacy::params_ref; |
40
|
|
|
|
|
|
|
*Aspect::Point::append_param = *Aspect::Legacy::append_param; |
41
|
|
|
|
|
|
|
*Aspect::Point::append_params = *Aspect::Legacy::append_params; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Namespace aliasing to old names |
44
|
|
|
|
|
|
|
*Aspect::if_true = *Aspect::true; |
45
|
|
|
|
|
|
|
*Aspect::Point::short_sub_name = *Aspect::Point::short_name; |
46
|
|
|
|
|
|
|
*Aspect::Point::run_original = *Aspect::Point::proceed; |
47
|
|
|
|
|
|
|
*Aspect::Modular::params = *Aspect::Modular::args; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Copy original functions into this namespace so they can be exported |
50
|
|
|
|
|
|
|
*Aspect::Legacy::call = *Aspect::call; |
51
|
|
|
|
|
|
|
*Aspect::Legacy::cflow = *Aspect::cflow; |
52
|
|
|
|
|
|
|
*Aspect::Legacy::before = *Aspect::before; |
53
|
|
|
|
|
|
|
*Aspect::Legacy::after = *Aspect::Legacy::after_returning; |
54
|
|
|
|
|
|
|
*Aspect::Legacy::aspect = *Aspect::aspect; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
###################################################################### |
61
|
|
|
|
|
|
|
# Deprecated Functionality |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Aspect::advice |
64
|
|
|
|
|
|
|
sub advice { |
65
|
0
|
|
|
0
|
0
|
0
|
my $type = shift; |
66
|
0
|
0
|
|
|
|
0
|
if ( $type eq 'before' ) { |
67
|
0
|
|
|
|
|
0
|
return before(@_); |
68
|
|
|
|
|
|
|
} else { |
69
|
0
|
|
|
|
|
0
|
return after(@_); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Aspect::after_returning |
74
|
|
|
|
|
|
|
sub after_returning (&$) { |
75
|
18
|
|
|
18
|
0
|
218
|
Aspect::Advice::After->new( |
76
|
|
|
|
|
|
|
lexical => defined wantarray, |
77
|
|
|
|
|
|
|
code => $_[0], |
78
|
|
|
|
|
|
|
pointcut => Aspect::Pointcut::And->new( |
79
|
|
|
|
|
|
|
Aspect::Pointcut::Returning->new, |
80
|
|
|
|
|
|
|
$_[1], |
81
|
|
|
|
|
|
|
), |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Aspect::after_throwing |
86
|
|
|
|
|
|
|
sub after_throwing (&$) { |
87
|
16
|
|
|
16
|
0
|
205
|
Aspect::Advice::After->new( |
88
|
|
|
|
|
|
|
lexical => defined wantarray, |
89
|
|
|
|
|
|
|
code => $_[0], |
90
|
|
|
|
|
|
|
pointcut => Aspect::Pointcut::And->new( |
91
|
|
|
|
|
|
|
Aspect::Pointcut::Throwing->new, |
92
|
|
|
|
|
|
|
$_[1], |
93
|
|
|
|
|
|
|
), |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# Aspect::Point::params_ref |
98
|
|
|
|
|
|
|
sub params_ref { |
99
|
0
|
|
|
0
|
0
|
0
|
$_[0]->{args}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Aspect::Point::params |
103
|
|
|
|
|
|
|
sub params { |
104
|
1
|
50
|
|
1
|
0
|
22
|
$_[0]->{args} = [ @_[1..$#_] ] if @_ > 1; |
105
|
|
|
|
|
|
|
return CORE::wantarray |
106
|
1
|
50
|
|
|
|
8
|
? @{$_[0]->{args}} |
|
0
|
|
|
|
|
0
|
|
107
|
|
|
|
|
|
|
: $_[0]->{args}; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Aspect::Point::append_param |
111
|
|
|
|
|
|
|
sub append_param { |
112
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
113
|
1
|
|
|
|
|
17
|
$self->args( $self->args, @_ ); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Aspect::Point::append_params |
117
|
|
|
|
|
|
|
sub append_params { |
118
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
119
|
1
|
|
|
|
|
4
|
$self->args( $self->args, @_ ); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=pod |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHORS |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Copyright 2009 - 2013 Adam Kennedy. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
133
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |