blib/lib/Class/MOP/Module.pm

filter: Statementstmt 92.8% 39 / 42 Branchbran 60.0% 6 / 10 Conditioncond 66.6% 4 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 90.9% 10 / 11 Podpod 100% 2 / 2 totaltotal 81.3% 61 / 75 CC 8 SCAR 9.4
CC
8
Cov
84%
_new
5.2
identifier
3.1
_instantiate_module
3.0
CRAP 2.6
« blib/lib/Moose/Meta/Method/Accessor/Native/Writer.pm ↑ Summary blib/lib/Moose/Exception/AttributeIsRequired.pm »
1 package Class::MOP::Module;
2 459 our $VERSION = '2.4001';
3  
4 459 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 459 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 459 ▶use parent 'Class::MOP::Package';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub _new {
Subroutine _new: called CC=3 SCAR=16.5
10 1 my $class = shift;
11 1 ▶ return Class::MOP::Class->initialize($class)->new_object(@_)
Branch: 1 branch
BranchTrueFalseTotal
if $class ne __PACKAGE__ 1 0 1
12 if $class ne __PACKAGE__;
13  
14 0 ▶ my $params = @_ == 1 ? $_[0] : {@_};
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 0 0
15 return bless {
16 # Need to quote package to avoid a problem with PPI mis-parsing this
17 # as a package statement.
18  
19 # from Class::MOP::Package
20 'package' => $params->{package},
21 0 namespace => \undef,
22  
23 # attributes
24 version => \undef,
25 authority => \undef
26 } => $class;
27 }
28  
29 12 ▶sub version {
Subroutine version: called CC=1 SCAR=0.0
30 12 my $self = shift;
31 12 ${$self->get_or_add_package_symbol('$VERSION')};
32 }
33  
34 8 ▶sub authority {
Subroutine authority: called CC=1 SCAR=0.0
35 8 my $self = shift;
36 8 ${$self->get_or_add_package_symbol('$AUTHORITY')};
37 }
38  
39 5 ▶sub identifier {
Subroutine identifier: called CC=3 SCAR=11.4
Pod documented
40 5 my $self = shift;
41 5 ▶ join '-' => (
Condition66%4/6
$self->version || ()
l!l&&r!l&&!r
230
$self->authority || ()
l!l&&r!l&&!r
230
MC/DC0%0/2
$self->version || ()
$self->version ()
MC/DC0%0/2
$self->authority || ()
$self->authority ()
Truth table66%2/3
A || B
A= $self->versionB= ()
ABresult
1X1
011
000
Truth table66%2/3
A || B
A= $self->authorityB= ()
ABresult
1X1
011
000
42 $self->name,
43 ($self->version || ()),
44 ($self->authority || ()),
45 );
46 }
47  
48 1532 ▶sub create {
Subroutine create: called CC=2 SCAR=6.9
Pod documented
49 1532 my $class = shift;
50 1532 my @args = @_;
51  
52 1532 ▶ unshift @args, 'package' if @args % 2 == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 == 1 1532 0 1532
53 1532 my %options = @args;
54  
55 1532 my $package = delete $options{package};
56 1532 my $version = delete $options{version};
57 1532 my $authority = delete $options{authority};
58  
59 1532 my $meta = $class->SUPER::create($package => %options);
60  
61 1527 $meta->_instantiate_module($version, $authority);
62  
63 1527 return $meta;
64 }
65  
66 0 ▶sub _anon_package_prefix { 'Class::MOP::Module::__ANON__::SERIAL::' }
Subroutine _anon_package_prefix: not called CC=1 SCAR=6.9
67  
68 1 ▶sub _anon_cache_key {
Subroutine _anon_cache_key: called CC=1 SCAR=0.0
69 1 my $class = shift;
70 1 my %options = @_;
71 1 $class->_throw_exception( PackagesAndModulesAreNotCachable => class_name => $class,
72 params => \%options,
73 is_module => 1
74 );
75 }
76  
77 1527 ▶sub _instantiate_module {
Subroutine _instantiate_module: called CC=3 SCAR=11.0
78 1527 my($self, $version, $authority) = @_;
79 1527 my $package_name = $self->name;
80  
81 1527 ▶ $self->add_package_symbol('$VERSION' => $version)
Branch: 1 branch
BranchTrueFalseTotal
if defined $version 4 1523 1527
82 if defined $version;
83 1527 ▶ $self->add_package_symbol('$AUTHORITY' => $authority)
Branch: 1 branch
BranchTrueFalseTotal
if defined $authority 1 1526 1527
84 if defined $authority;
85  
86 1527 return;
87 }
88  
89 459 1;
90  
91 # ABSTRACT: Module Meta Object
92  
93 __END__
« blib/lib/Moose/Meta/Method/Accessor/Native/Writer.pm ↑ Summary blib/lib/Moose/Exception/AttributeIsRequired.pm »