version.pm untested

filter: Statementstmt 0.0% 0 / 127 Branchbran 0.0% 0 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 170 CC 13 SCAR 47.8
CC
13
Cov
0%
import
182.0
BEGIN
2.0
BEGIN
2.0
CRAP 119.0
1 package version;
2  
3 use 5.006002;
4 use strict;
5 use warnings::register;
6 if ($] >= 5.015) {
7 warnings::register_categories(qw/version/);
8 }
9  
10 our $VERSION = '0.9934';
11 our $CLASS = 'version';
12 our (@ISA, $STRICT, $LAX);
13  
14 # !!!!Delete this next block completely when adding to Perl core!!!!
15 {
16 local $SIG{'__DIE__'};
17 eval "use version::vxs $VERSION";
18 if ( $@ ) { # don't have the XS version installed
19 eval "use version::vpp $VERSION"; # don't tempt fate
20 die "$@" if ( $@ );
21 push @ISA, "version::vpp";
22 local $^W;
23 *version::qv = \&version::vpp::qv;
24 *version::declare = \&version::vpp::declare;
25 *version::_VERSION = \&version::vpp::_VERSION;
26 *version::vcmp = \&version::vpp::vcmp;
27 *version::new = \&version::vpp::new;
28 *version::numify = \&version::vpp::numify;
29 *version::normal = \&version::vpp::normal;
30 *version::to_decimal = \&version::vpp::to_decimal;
31 *version::to_dotted_decimal = \&version::vpp::to_dotted_decimal;
32 *version::tuple = \&version::vpp::tuple;
33 *version::from_tuple = \&version::vpp::from_tuple;
34 if ($] >= 5.009000) {
35 no strict 'refs';
36 *version::stringify = \&version::vpp::stringify;
37 *{'version::(""'} = \&version::vpp::stringify;
38 *{'version::(<=>'} = \&version::vpp::vcmp;
39 *{'version::(cmp'} = \&version::vpp::vcmp;
40 *version::parse = \&version::vpp::parse;
41 }
42 }
43 else { # use XS module
44 push @ISA, "version::vxs";
45 local $^W;
46 *version::declare = \&version::vxs::declare;
47 *version::qv = \&version::vxs::qv;
48 *version::_VERSION = \&version::vxs::_VERSION;
49 *version::vcmp = \&version::vxs::VCMP;
50 *version::new = \&version::vxs::new;
51 *version::numify = \&version::vxs::numify;
52 *version::normal = \&version::vxs::normal;
53 *version::to_decimal = \&version::vxs::to_decimal;
54 *version::to_dotted_decimal = \&version::vxs::to_dotted_decimal;
55 *version::tuple = \&version::vxs::tuple;
56 *version::from_tuple = \&version::vxs::from_tuple;
57 if ($] >= 5.009000) {
58 no strict 'refs';
59 *version::stringify = \&version::vxs::stringify;
60 *{'version::(""'} = \&version::vxs::stringify;
61 *{'version::(<=>'} = \&version::vxs::VCMP;
62 *{'version::(cmp'} = \&version::vxs::VCMP;
63 *version::parse = \&version::vxs::parse;
64 }
65 }
66 }
67  
68 # avoid using Exporter
69 require version::regex;
70 *version::is_lax = \&version::regex::is_lax;
71 *version::is_strict = \&version::regex::is_strict;
72 *LAX = \$version::regex::LAX;
73 *LAX_DECIMAL_VERSION = \$version::regex::LAX_DECIMAL_VERSION;
74 *LAX_DOTTED_DECIMAL_VERSION = \$version::regex::LAX_DOTTED_DECIMAL_VERSION;
75 *STRICT = \$version::regex::STRICT;
76 *STRICT_DECIMAL_VERSION = \$version::regex::STRICT_DECIMAL_VERSION;
77 *STRICT_DOTTED_DECIMAL_VERSION = \$version::regex::STRICT_DOTTED_DECIMAL_VERSION;
78  
79 sub import {
80 no strict 'refs';
81 my ($class) = shift;
82  
83 # Set up any derived class
84 unless ($class eq $CLASS) {
85 local $^W;
86 *{$class.'::declare'} = \&{$CLASS.'::declare'};
87 *{$class.'::qv'} = \&{$CLASS.'::qv'};
88 }
89  
90 my %args;
91 if (@_) { # any remaining terms are arguments
92 map { $args{$_} = 1 } @_
93 }
94 else { # no parameters at all on use line
95 %args =
96 (
97 qv => 1,
98 'UNIVERSAL::VERSION' => 1,
99 );
100 }
101  
102 my $callpkg = caller();
103  
104 if (exists($args{declare})) {
105 *{$callpkg.'::declare'} =
106 sub {return $class->declare(shift) }
107 unless defined(&{$callpkg.'::declare'});
108 }
109  
110 if (exists($args{qv})) {
111 *{$callpkg.'::qv'} =
112 sub {return $class->qv(shift) }
113 unless defined(&{$callpkg.'::qv'});
114 }
115  
116 if (exists($args{'UNIVERSAL::VERSION'})) {
117 local $^W;
118 *UNIVERSAL::VERSION
119 = \&{$CLASS.'::_VERSION'};
120 }
121  
122 if (exists($args{'VERSION'})) {
123 *{$callpkg.'::VERSION'} = \&{$CLASS.'::_VERSION'};
124 }
125  
126 if (exists($args{'is_strict'})) {
127 *{$callpkg.'::is_strict'} = \&{$CLASS.'::is_strict'}
128 unless defined(&{$callpkg.'::is_strict'});
129 }
130  
131 if (exists($args{'is_lax'})) {
132 *{$callpkg.'::is_lax'} = \&{$CLASS.'::is_lax'}
133 unless defined(&{$callpkg.'::is_lax'});
134 }
135 }
136  
137  
138 1;