blib/lib/Dist/Zilla/Plugin/Regexp/Pattern.pm

filter: Statementstmt 65.0% 26 / 40 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 54.2% 32 / 59 CC 4 SCAR 15.4
CC
4
Cov
57%
after_build
12.0
register_prereqs
6.0
gather_files
2.0
CRAP 4.7
↑ Summary
1 package Dist::Zilla::Plugin::Regexp::Pattern;
2  
3 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4 1 our $DATE = '2020-01-02'; # DATE
5 1 our $DIST = 'Dist-Zilla-Plugin-Regexp-Pattern'; # DIST
6 1 our $VERSION = '0.005'; # VERSION
7  
8 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 with 'Dist::Zilla::Role::AfterBuild';
14 1 with 'Dist::Zilla::Role::FileGatherer';
15 1 with 'Dist::Zilla::Role::PrereqSource';
16 #with 'Dist::Zilla::Role::RegexpPattern::CheckDefinesPattern';
17 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 ▶use PMVersions::Util qw(version_from_pmversions);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 0 ▶sub register_prereqs {
Subroutine register_prereqs: not called CC=2 SCAR=17.9
Pod undocumented
22 0 my ($self) = @_;
23  
24 #return unless $self->check_dist_defines_regexp_pattern;
25  
26 0 ▶ $self->zilla->register_prereqs(
Condition0%0/2
version_from_pmversions("Test::Regexp::Pattern") // "0.001"
l!l
00
MC/DC0%0/1
version_from_pmversions("Test::Regexp::Pattern") // "0.001"
version_from_pmversions("Test::Regexp::Pattern")
Truth table0%0/2
A
A= version_from_pmversions("Test::Regexp::Pattern")
Aresult
11
00
27 {
28 type => 'requires',
29 phase => 'develop',
30 },
31 'Test::Regexp::Pattern' => version_from_pmversions('Test::Regexp::Pattern') // '0.001',
32 );
33 }
34  
35 0 ▶sub gather_files {
Subroutine gather_files: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my ($self) = @_;
37  
38 #return unless $self->check_dist_defines_regexp_pattern;
39  
40 0 my $filename = "xt/release/regexp-pattern.t";
41 0 my $filecontent = <<_;
42 #!perl
43  
44 0 # This file was automatically generated by ${\(__PACKAGE__)}.
45  
46 use Test::More;
47  
48 eval "use Test::Regexp::Pattern 0.001";
49 plan skip_all => "Test::Regexp::Pattern 0.001+ required for testing regexp patterns"
50 if \$@;
51  
52 regexp_patterns_in_all_modules_ok();
53 _
54  
55 0 $self->log(["Adding %s ...", $filename]);
56 0 require Dist::Zilla::File::InMemory;
57 0 $self->add_file(
58 Dist::Zilla::File::InMemory->new({
59 name => $filename,
60 content => $filecontent,
61 })
62 );
63 }
64  
65 0 ▶sub after_build {
Subroutine after_build: not called CC=3 SCAR=24.8
Pod undocumented
66 0 my $self = shift;
67  
68 0 my $prereqs_hash = $self->zilla->prereqs->as_string_hash;
69  
70 # check that Regexp::Pattern is mentioned as DevelopRecommends
71 0 ▶ unless (exists $prereqs_hash->{develop}{x_spec}{'Regexp::Pattern'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $prereqs_hash->{"develop"}{"x_spec"}{"Regexp::Pattern"}) 0 0 0
72 0 ▶ unless (-f "lib/Regexp/Pattern.pm") { # exception for Regexp-Pattern dist
Branch: 1 branch
BranchTrueFalseTotal
unless (-f "lib/Regexp/Pattern.pm") 0 0 0
73 0 $self->log_fatal(["Regexp::Pattern not specified as prerequisite (phase=develop, rel=x_spec)"]);
74 }
75 }
76 }
77  
78 1 __PACKAGE__->meta->make_immutable;
79 1 1;
80 # ABSTRACT: Plugin to use when building Regexp::Pattern::* distribution
81  
82 __END__
↑ Summary