blib/lib/Dist/Zilla/Plugin/VersionFromMainModule.pm

filter: Statementstmt 100% 24 / 24 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 94.1% 32 / 34 CC 3 SCAR 6.2
CC
3
Cov
96%
provide_version
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
↑ Summary
1 package Dist::Zilla::Plugin::VersionFromMainModule;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.04';
8  
9 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 with 'Dist::Zilla::Role::VersionProvider',
12 'Dist::Zilla::Role::ModuleMetadata';
13  
14 2 ▶sub provide_version {
Subroutine provide_version: called CC=3 SCAR=11.0
Pod undocumented
15 2 my $self = shift;
16  
17 2 ▶ return $ENV{V} if exists $ENV{V};
Branch: 1 branch
BranchTrueFalseTotal
if exists $ENV{"V"} 1 1 2
18  
19 1 my $module = $self->zilla->main_module;
20 1 my $name = $module->name;
21 1 my $metadata
22 = $self->module_metadata_for_file( $module, collect_pod => 0 );
23  
24 1 ▶ my $ver = $metadata->version
Branch: 1 branch
BranchTrueFalseTotal
my $ver = $metadata->version or $self->log_fatal("Unable to get version from $name") 1 0 1
25 or $self->log_fatal("Unable to get version from $name");
26  
27 1 $self->log_debug("Setting dist version $ver from $name");
28  
29 # We need to stringify this since it can be a version object.
30 1 return "$ver";
31 }
32  
33 2 __PACKAGE__->meta->make_immutable;
34  
35 2 1;
36  
37 # ABSTRACT: Set the distribution version from your main module's $VERSION
38  
39 __END__
↑ Summary