Plugin/VersionFromModule.pm

filter: Statementstmt 100% 19 / 19 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 92.0% 23 / 25 CC 2 SCAR 4.1
CC
2
Cov
95%
provide_version
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Plugin/ModuleBuild/Custom.pm ↑ Summary Role/ModuleInfo.pm »
1 #---------------------------------------------------------------------
2 package Dist::Zilla::Plugin::VersionFromModule;
3 #
4 # Copyright 2009 Christopher J. Madsen
5 #
6 # Author: Christopher J. Madsen <perl@cjmweb.net>
7 # Created: 23 Sep 2009
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the same terms as Perl itself.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the
15 # GNU General Public License or the Artistic License for more details.
16 #
17 # ABSTRACT: Get distribution version from its main_module
18 #---------------------------------------------------------------------
19  
20 3 our $VERSION = '0.08';
21 # This file is part of Dist-Zilla-Plugins-CJM 6.000 (December 17, 2017)
22  
23 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 with 'Dist::Zilla::Role::VersionProvider';
25 3 with 'Dist::Zilla::Role::ModuleInfo';
26  
27  
28 11 ▶sub provide_version {
Subroutine provide_version: called CC=2 SCAR=7.0
Pod undocumented
29 11 my ($self) = @_;
30  
31 11 my $main_module = $self->zilla->main_module;
32 11 my $module = $main_module->name;
33  
34 11 my $pm_info = $self->get_module_info($main_module);
35 11 my $ver = $pm_info->version;
36  
37 11 ▶ die "Unable to get version from $module" unless defined $ver;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ver 0 11 11
38  
39 11 $self->log("dist version $ver (from $module)");
40  
41 11 "$ver"; # Need to stringify version object
42 } # end provide_version
43  
44 #=====================================================================
45 # Package Return Value:
46  
47 3 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 3 __PACKAGE__->meta->make_immutable;
49 3 1;
50  
51 __END__
« Plugin/ModuleBuild/Custom.pm ↑ Summary Role/ModuleInfo.pm »