Resume/Moose.pm

filter: Statementstmt 100% 60 / 60 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 17 / 17 Podpod 0.0% 0 / 6 totaltotal 93.1% 81 / 87 CC 3 SCAR 1.9
CC
3
Cov
100%
education
2.0
job
2.0
BEGIN
1.0
CRAP 1.2
« Resume/Internal.pm ↑ Summary Resume/Types.pm »
1 3 ▶use 5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Acme::Resume::Moose;
6  
7 # ABSTRACT: Imports methods and adds attributes
8 3 our $VERSION = '0.0109';
9  
10 3 ▶use Moose::Exporter;
Subroutine __ANON__: called CC=1 SCAR=0.0
11 3 ▶use Acme::Resume::Types::Job;
Subroutine __ANON__: called CC=1 SCAR=0.0
12 3 ▶use Acme::Resume::Types::Education;
Subroutine __ANON__: called CC=1 SCAR=0.0
13  
14 3 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use Acme::Resume::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 3 Moose::Exporter->setup_import_methods(with_meta => [qw/name email phone address education job/]);
18  
19 1 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
20 1 my $meta = shift;
21 1 $meta->add_attribute(name => (
22 is => 'ro',
23 isa => Str,
24 default => shift,
25 ));
26 }
27 1 ▶sub email {
Subroutine email: called CC=1 SCAR=0.0
Pod undocumented
28 1 my $meta = shift;
29 1 $meta->add_attribute(email => (
30 is => 'ro',
31 isa => Str,
32 default => shift,
33 ));
34 }
35 1 ▶sub phone {
Subroutine phone: called CC=1 SCAR=0.0
Pod undocumented
36 1 my $meta = shift;
37 1 $meta->add_attribute(phone => (
38 is => 'ro',
39 isa => Str,
40 default => shift,
41 ));
42 }
43 1 ▶sub address {
Subroutine address: called CC=1 SCAR=0.0
Pod undocumented
44 1 my $meta = shift;
45 1 my $address = shift;
46  
47 $meta->add_attribute(address => (
48 is => 'ro',
49 isa => ArrayRef[Str],
50 1 ▶ default => sub { $address },
Subroutine __ANON__: called CC=1 SCAR=0.0
51 1 traits => ['Array'],
52 handles => {
53 add_address => 'push',
54 full_address => 'elements',
55 has_address => 'count',
56 get_address => 'get',
57 join_address => 'join',
58 },
59 ));
60 }
61  
62 3 ▶sub education {
Subroutine education: called CC=2 SCAR=6.9
Pod undocumented
63 3 my $meta = shift;
64 3 my $education = shift;
65  
66 3 my $current_educations = [];
67  
68 3 ▶ if($meta->has_attribute('educations')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->has_attribute("educations")) 2 1 3
69 2 push @$current_educations => @{ $meta->get_attribute('educations')->default->() };
70 2 $meta->remove_attribute('educations');
71 }
72  
73 3 push @{ $current_educations } => Acme::Resume::Types::Education->new(%{ $education });
74  
75 $meta->add_attribute(educations => (
76 is => 'ro',
77 isa => Educations,
78 traits => ['Array'],
79 3 ▶ default => sub { $current_educations },
Subroutine __ANON__: called CC=1 SCAR=0.0
80 3 coerce => 1,
81 handles => {
82 add_education => 'push',
83 all_educations => 'elements',
84 has_education => 'count',
85 get_education => 'get',
86 },
87 ));
88 }
89  
90 2 ▶sub job {
Subroutine job: called CC=2 SCAR=6.9
Pod undocumented
91 2 my $meta = shift;
92 2 my $job = shift;
93  
94 2 my $current_jobs = [];
95  
96 2 ▶ if($meta->has_attribute('jobs')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($meta->has_attribute("jobs")) 1 1 2
97 1 push @$current_jobs => @{ $meta->get_attribute('jobs')->default->() };
98 1 $meta->remove_attribute('jobs');
99 }
100  
101 2 push @{ $current_jobs } => Acme::Resume::Types::Job->new(%{ $job });
102  
103 $meta->add_attribute(jobs => (
104 is => 'ro',
105 isa => Jobs,
106 traits => ['Array'],
107 2 ▶ default => sub { $current_jobs },
Subroutine __ANON__: called CC=1 SCAR=0.0
108 2 coerce => 1,
109 handles => {
110 add_job => 'push',
111 all_jobs => 'elements',
112 has_job_history => 'count',
113 get_job => 'get',
114 },
115 ));
116 }
117  
118 3 1;
119  
120 __END__
« Resume/Internal.pm ↑ Summary Resume/Types.pm »