blib/lib/Module/Build/Parse/Yapp.pm

filter: Statementstmt 63.6% 28 / 44 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 0.0% 0 / 2 totaltotal 61.0% 36 / 59 CC 2 SCAR 6.9
CC
2
Cov
61%
_find_parser
6.0
new
2.0
process_yp_files
2.0
CRAP 2.0
↑ Summary
1 package Module::Build::Parse::Yapp;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base 'Module::Build';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.1.2'; # VERSION
8 # ABSTRACT: build Parse::Yapp parsers from source
9  
10 1 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Path qw( make_path );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use File::Spec::Functions qw( catdir splitdir );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Parse::Yapp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
16 0 my $self = shift;
17 0 my %args = @_;
18 0 $self->SUPER::new( %args );
19 }
20  
21 0 ▶sub process_yp_files {
Subroutine process_yp_files: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my $self = shift;
23  
24 0 find( { wanted => \&_find_parser, no_chdir => 1 }, 'lib' );
25 }
26  
27 0 ▶sub _find_parser {
Subroutine _find_parser: not called CC=2 SCAR=17.9
28 0 ▶ return unless /\.yp$/;
Branch: 1 branch
BranchTrueFalseTotal
unless /\.yp$/ 0 0 0
29  
30 0 my $pmfile = $_;
31 0 $pmfile =~ s/\.yp$/.pm/;
32  
33 0 my @path = splitdir( $File::Find::name );
34 0 my @pmpath = my @namespace = @path;
35  
36 0 unshift @pmpath, 'blib';
37 0 $pmpath[-1] =~ s/\.yp$/.pm/;
38  
39 0 shift @namespace;
40 0 $namespace[-1] =~ s/\.yp$//;
41  
42 0 make_path( catdir( @pmpath[0..$#pmpath-1] ) );
43 0 _make_parser( $File::Find::name,
44 catdir( @pmpath ),
45 join '::', @namespace );
46 }
47  
48 1 ▶sub _make_parser {
Subroutine _make_parser: called CC=1 SCAR=0.0
49 1 my( $inputfile, $outputfile, $classname ) = @_;
50  
51 1 my $parser = Parse::Yapp->new( inputfile => $inputfile );
52 1 open( my $out, '>', $outputfile );
53 1 print $out $parser->Output( classname => $classname );
54 1 close $out;
55 }
56  
57 1 1;
58  
59 __END__
↑ Summary