line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::ExtraArgs::Meta::Object; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$MooseX::ExtraArgs::Meta::Object::VERSION = '0.02'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
10557
|
use Moose::Role; |
|
1
|
|
|
|
|
4306
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has extra_args => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
isa => 'HashRef', |
10
|
|
|
|
|
|
|
required => 1, |
11
|
|
|
|
|
|
|
init_arg => '_extra_args', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around BUILDARGS => sub{ |
15
|
|
|
|
|
|
|
my $orig = shift; |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $args = $self->$orig( @_ ); |
19
|
|
|
|
|
|
|
$args->{_extra_args} = { %$args }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $meta = $self->meta(); |
22
|
|
|
|
|
|
|
foreach my $attr ($meta->get_all_attributes()) { |
23
|
|
|
|
|
|
|
next if !$attr->has_init_arg(); |
24
|
|
|
|
|
|
|
delete( $args->{_extra_args}->{ $attr->init_arg() } ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return $args; |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |