Code/Accessor.pm

filter: Statementstmt 100% 26 / 26 Branchbran 66.6% 4 / 6 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 83.3% 40 / 48 CC 6 SCAR 10.9
CC
6
Cov
86%
__args
5.2
new
2.1
BEGIN
1.0
CRAP 3.0
« Code/Function/Result/Element.pm ↑ Summary Code/Function/BuildIn.pm »
1 package JavaScript::Code::Accessor;
2
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use vars qw[ $VERSION ];
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use base qw[ Class::Accessor::Chained::Fast ];
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 2 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9
10 2 $VERSION = '0.08';
11
12 =head1 NAME
13
14 JavaScript::Code::Accessor - A Accessor Class
15
16 =head2 SYNOPSIS
17
18 use base qw[ JavaScript::Code::Accessor ];
19
20 =head2 DESCRIPTION
21
22 Accessor Class
23
24 =head1 METHDOS
25
26 =head2 JavaScript::Code::Accessor->new( %args | \%args )
27
28 Takes a hash or a hashref as initialization arguments.
29
30 =cut
31
32 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.6
Pod documented
33 5 my $obj = shift;
34 5 ▶ my $class = ref $obj || $obj;
Condition33%1/3
ref $obj || $obj
l!l&&r!l&&!r
050
MC/DC0%0/2
ref $obj || $obj
ref $obj $obj
Truth table33%1/3
A || B
A= ref $objB= $obj
ABresult
1X1
011
000
35
36 5 return $class->SUPER::new( $class->__args(@_) );
37 }
38
39 5 ▶sub __args {
Subroutine __args: called CC=5 SCAR=16.6
40 5 my $self = shift;
41
42 5 ▶ return {} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 3 2 5
43
44 2 ▶ my $ref = @_ ? Scalar::Util::reftype( $_[0] ) || '' : '';
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2 0 2
Condition50%1/2
builtin::reftype($_[0]) or ""
l!l
20
MC/DC0%0/1
builtin::reftype($_[0]) or ""
builtin::reftype($_[0])
Truth table50%1/2
A
A= builtin::reftype($_[0])
Aresult
11
00
45 my %args =
46 $ref eq 'HASH'
47 2 ▶ ? %{ shift() }
Branch: 1 branch
BranchTrueFalseTotal
$ref eq 'HASH' ? : 2 0 2
48 : @_;
49
50 2 return \%args;
51 }
52
53 =head1 SEE ALSO
54
55 L<JavaScript::Code>, L<Class::Accessor::Chained::Fast>
56
57 =head1 AUTHOR
58
59 Sascha Kiefer, C<esskar@cpan.org>
60
61 =head1 LICENSE
62
63 This library is free software, you can redistribute it and/or modify it under
64 the same terms as Perl itself.
65
66 =cut
67
68 2 1;
« Code/Function/Result/Element.pm ↑ Summary Code/Function/BuildIn.pm »