line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MakeMethods::Attribute; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5.006; |
4
|
1
|
|
|
1
|
|
19333
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
6
|
1
|
|
|
1
|
|
6
|
use Attribute::Handlers; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
755
|
use Class::MakeMethods; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
811
|
use Class::MakeMethods::Utility::Inheritable 'get_vvalue'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 1.005; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our %DefaultMaker; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
1
|
|
|
1
|
|
9
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
33
|
|
|
11
|
if ( scalar @_ and $_[0] =~ m/^\d/ ) { |
19
|
0
|
|
|
|
|
0
|
Class::MakeMethods::_import_version( $class, shift ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
5
|
if ( scalar @_ == 1 ) { |
23
|
1
|
|
|
|
|
7
|
my $target_class = ( caller(0) )[0]; |
24
|
1
|
|
|
|
|
36
|
$DefaultMaker{ $target_class } = shift; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub UNIVERSAL::MakeMethod :ATTR(CODE) { |
29
|
4
|
|
|
4
|
0
|
4338
|
my ($package, $symbol, $referent, $attr, $data) = @_; |
30
|
4
|
50
|
33
|
|
|
33
|
if ( $symbol eq 'ANON' or $symbol eq 'LEXICAL' ) { |
31
|
0
|
|
|
|
|
0
|
croak "Can't apply MakeMethod attribute to $symbol declaration." |
32
|
|
|
|
|
|
|
} |
33
|
4
|
50
|
|
|
|
10
|
if ( ! $data ) { |
34
|
0
|
|
|
|
|
0
|
croak "No method type provided for MakeMethod attribute." |
35
|
|
|
|
|
|
|
} |
36
|
4
|
|
|
|
|
7
|
my $symname = *{$symbol}{NAME}; |
|
4
|
|
|
|
|
9
|
|
37
|
4
|
50
|
|
|
|
15
|
if ( ref $data eq 'ARRAY' ) { |
38
|
4
|
|
|
|
|
6
|
local $_ = shift @$data; |
39
|
4
|
|
|
|
|
9
|
$symname = [ @$data, $symname ]; |
40
|
4
|
|
|
|
|
8
|
$data = $_; |
41
|
|
|
|
|
|
|
} |
42
|
4
|
100
|
|
|
|
11
|
unless ( $DefaultMaker{$package} ) { |
43
|
1
|
|
|
|
|
6
|
local $_ = get_vvalue( \%DefaultMaker, $package ); |
44
|
1
|
50
|
|
|
|
6
|
$DefaultMaker{$package} = $_ if ( $_ ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
Class::MakeMethods->make( |
47
|
4
|
50
|
|
|
|
35
|
-TargetClass => $package, |
48
|
|
|
|
|
|
|
-ForceInstall => 1, |
49
|
|
|
|
|
|
|
( $DefaultMaker{$package} ? ('-MakerClass'=>$DefaultMaker{$package}) : () ), |
50
|
|
|
|
|
|
|
$data => $symname |
51
|
|
|
|
|
|
|
); |
52
|
1
|
|
|
1
|
|
7
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |