blib/lib/Devel/PackagePath.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
_build_directory
1.0
CRAP 1.0
↑ Summary
1 package Devel::PackagePath;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 our $VERSION = 0.03;
4 2 ▶use MooseX::Types::Path::Class qw(Dir);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 has package => (
7 isa => 'Str',
8 is => 'ro',
9 required => 1,
10 );
11  
12 2 has base => (
13 isa => 'Str',
14 is => 'ro',
15 lazy => 1,
16 default => '.',
17 );
18  
19 2 has directory => (
20 isa => Dir,
21 is => 'ro',
22 lazy_build => 1,
23 handles => {
24 create => 'mkpath',
25 path => 'stringify',
26 },
27 );
28  
29 1 ▶sub _build_directory {
Subroutine _build_directory: called CC=1 SCAR=0.0
30 1 my @pkg_list = split '::', $_[0]->package;
31 1 pop @pkg_list; # pop off the file name
32 1 Path::Class::Dir->new( $_[0]->base, @pkg_list );
33 }
34  
35 2 has file_name => (
36 isa => 'Str',
37 is => 'ro',
38 lazy_build => 1,
39 );
40  
41 1 ▶sub _build_file_name {
Subroutine _build_file_name: called CC=1 SCAR=0.0
42 1 return ( split '::', $_[0]->package )[-1] . '.pm';
43 }
44  
45 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 2 1;
47 __END__
↑ Summary