| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This file is a modified copy of MooseX/Attribute/Chained.pm |
|
2
|
|
|
|
|
|
|
# Carl Franks 2014 |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This file is part of MooseX-Attribute-Chained |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# This software is copyright (c) 2012 by Moritz Onken. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
10
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
package MooseX::Attribute::FormFuChained; |
|
13
|
|
|
|
|
|
|
|
|
14
|
401
|
|
|
401
|
|
1684
|
use strict; |
|
|
401
|
|
|
|
|
586
|
|
|
|
401
|
|
|
|
|
16438
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# ABSTRACT: Attribute that returns the instance to allow for chaining |
|
18
|
401
|
|
|
401
|
|
1557
|
use Moose::Util; |
|
|
401
|
|
|
|
|
470
|
|
|
|
401
|
|
|
|
|
2686
|
|
|
19
|
|
|
|
|
|
|
Moose::Util::meta_attribute_alias( |
|
20
|
|
|
|
|
|
|
FormFuChained => 'MooseX::Traits::Attribute::FormFuChained' ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package MooseX::Traits::Attribute::FormFuChained; |
|
23
|
|
|
|
|
|
|
|
|
24
|
401
|
|
|
401
|
|
57433
|
use strict; |
|
|
401
|
|
|
|
|
543
|
|
|
|
401
|
|
|
|
|
12653
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
|
26
|
|
|
|
|
|
|
|
|
27
|
401
|
|
|
401
|
|
165446
|
use Moose::Role; |
|
|
401
|
|
|
|
|
1167364
|
|
|
|
401
|
|
|
|
|
1239
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
override accessor_metaclass => sub { |
|
30
|
|
|
|
|
|
|
'MooseX::Attribute::FormFuChained::Method::Accessor'; |
|
31
|
|
|
|
|
|
|
}; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package MooseX::Attribute::FormFuChained::Method::Accessor; |
|
34
|
|
|
|
|
|
|
|
|
35
|
401
|
|
|
401
|
|
1424438
|
use strict; |
|
|
401
|
|
|
|
|
609
|
|
|
|
401
|
|
|
|
|
13411
|
|
|
36
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
|
37
|
|
|
|
|
|
|
|
|
38
|
401
|
|
|
401
|
|
1416
|
use Carp qw(confess); |
|
|
401
|
|
|
|
|
487
|
|
|
|
401
|
|
|
|
|
18289
|
|
|
39
|
401
|
|
|
401
|
|
1534
|
use Try::Tiny; |
|
|
401
|
|
|
|
|
465
|
|
|
|
401
|
|
|
|
|
22049
|
|
|
40
|
401
|
|
|
401
|
|
1648
|
use base 'Moose::Meta::Method::Accessor'; |
|
|
401
|
|
|
|
|
433
|
|
|
|
401
|
|
|
|
|
148344
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _generate_accessor_method_inline { |
|
43
|
30421
|
|
|
30421
|
|
6123720
|
my $self = shift; |
|
44
|
30421
|
|
|
|
|
60242
|
my $attr = $self->associated_attribute; |
|
45
|
30421
|
100
|
|
|
|
124817
|
my $clone |
|
46
|
|
|
|
|
|
|
= $attr->associated_class->has_method("clone") |
|
47
|
|
|
|
|
|
|
? '$_[0]->clone' |
|
48
|
|
|
|
|
|
|
: 'bless { %{$_[0]} }, ref $_[0]'; |
|
49
|
|
|
|
|
|
|
|
|
50
|
30421
|
50
|
|
|
|
592699
|
if ( $Moose::VERSION >= 1.9900 ) { |
|
51
|
|
|
|
|
|
|
return try { |
|
52
|
30421
|
|
|
30421
|
|
790582
|
$self->_compile_code( |
|
53
|
|
|
|
|
|
|
[ 'sub {', |
|
54
|
|
|
|
|
|
|
'if (@_ > 1) {', |
|
55
|
|
|
|
|
|
|
$attr->_inline_set_value( '$_[0]', '$_[1]' ), |
|
56
|
|
|
|
|
|
|
'return $_[0];', |
|
57
|
|
|
|
|
|
|
'}', |
|
58
|
|
|
|
|
|
|
$attr->_inline_get_value('$_[0]'), |
|
59
|
|
|
|
|
|
|
'}', |
|
60
|
|
|
|
|
|
|
] |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
catch { |
|
64
|
0
|
|
|
0
|
|
|
confess "Could not generate inline accessor because : $_"; |
|
65
|
30421
|
|
|
|
|
159166
|
}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
else { |
|
68
|
0
|
|
|
|
|
|
return $self->next::method(@_); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _generate_writer_method_inline { |
|
73
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
74
|
0
|
|
|
|
|
|
my $attr = $self->associated_attribute; |
|
75
|
0
|
0
|
|
|
|
|
my $clone |
|
76
|
|
|
|
|
|
|
= $attr->associated_class->has_method("clone") |
|
77
|
|
|
|
|
|
|
? '$_[0]->clone' |
|
78
|
|
|
|
|
|
|
: 'bless { %{$_[0]} }, ref $_[0]'; |
|
79
|
0
|
0
|
|
|
|
|
if ( $Moose::VERSION >= 1.9900 ) { |
|
80
|
|
|
|
|
|
|
return try { |
|
81
|
0
|
|
|
0
|
|
|
$self->_compile_code( |
|
82
|
|
|
|
|
|
|
[ 'sub {', $attr->_inline_set_value( '$_[0]', '$_[1]' ), |
|
83
|
|
|
|
|
|
|
'$_[0]', '}', |
|
84
|
|
|
|
|
|
|
] |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
catch { |
|
88
|
0
|
|
|
0
|
|
|
confess "Could not generate inline writer because : $_"; |
|
89
|
0
|
|
|
|
|
|
}; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
else { |
|
92
|
0
|
|
|
|
|
|
return $self->next::method(@_); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _inline_post_body { |
|
97
|
0
|
|
|
0
|
|
|
return 'return $_[0] if (scalar(@_) >= 2);' . "\n"; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |