DeploymentHandler/WithApplicatorDumple.pm

filter: Statementstmt 97.7% 43 / 44 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 96.2% 51 / 53 CC 2 SCAR 2.6
CC
2
Cov
98%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.3
« DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm ↑ Summary DeploymentHandler/VersionStorage/Deprecated.pm »
1 package DBIx::Class::DeploymentHandler::WithApplicatorDumple;
2 4 $DBIx::Class::DeploymentHandler::WithApplicatorDumple::VERSION = '0.002233';
3 12 ▶use MooseX::Role::Parameterized;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use Module::Runtime 'use_module';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # this is at least a little ghetto and not super well
8 # thought out. Take a look at the following at some
9 # point to clean it all up:
10 #
11 # http://search.cpan.org/~jjnapiork/MooseX-Role-BuildInstanceOf-0.06/lib/MooseX/Role/BuildInstanceOf.pm
12 # http://github.com/rjbs/role-subsystem/blob/master/lib/Role/Subsystem.pm
13  
14 4 parameter interface_role => (
15 isa => 'Str',
16 required => 1,
17 );
18  
19 4 parameter class_name => (
20 isa => 'Str',
21 required => 1,
22 );
23  
24 4 parameter delegate_name => (
25 isa => 'Str',
26 required => 1,
27 );
28  
29 parameter attributes_to_copy => (
30 isa => 'ArrayRef[Str]',
31 16 ▶ default => sub {[]},
Subroutine __ANON__: called CC=1 SCAR=0.0
32 4 );
33  
34 parameter attributes_to_assume => (
35 isa => 'ArrayRef[Str]',
36 0 ▶ default => sub {[]},
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 4 );
38  
39 role {
40 41 ▶ my $p = shift;
Subroutine __ANON__: called CC=2 SCAR=6.9
41  
42 41 my $class_name = $p->class_name;
43  
44 41 use_module($class_name);
45  
46 41 my $meta = Class::MOP::class_of($class_name);
47  
48 109 has $_->name => %{ $_->clone }
49 41 for grep { $_ } map $meta->find_attribute_by_name($_), @{ $p->attributes_to_copy };
50  
51 41 has $p->delegate_name => (
52 is => 'ro',
53 lazy_build => 1,
54 does => $p->interface_role,
55 handles => $p->interface_role,
56 );
57  
58 method '_build_'.$p->delegate_name => sub {
59 30 ▶ my $self = shift;
Subroutine _build_version_handler: called CC=1 SCAR=0.0
Subroutine _build_version_storage: called CC=1 SCAR=0.0
Subroutine _build_deploy_method: called CC=1 SCAR=0.0
60  
61 $class_name->new({
62 174 map { $_ => $self->$_ }
63 30 @{ $p->attributes_to_assume },
64 30 @{ $p->attributes_to_copy },
65 })
66 41 };
67 4 };
68  
69 4 1;
70  
71 # vim: ts=2 sw=2 expandtab
72  
73 __END__
« DeploymentHandler/DeployMethod/SQL/Translator/Deprecated.pm ↑ Summary DeploymentHandler/VersionStorage/Deprecated.pm »