| 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
MC/DC0%0/2
ref $obj || $obj
ref $obj
$obj
Truth table33%1/3
A || B
A= ref $objB= $obj
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 2 | ▶ | my $ref = @_ ? Scalar::Util::reftype( $_[0] ) || '' : ''; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($_[0]) or ""
MC/DC0%0/1
builtin::reftype($_[0]) or ""
builtin::reftype($_[0])
Truth table50%1/2
A
A= builtin::reftype($_[0])
| |||||||||||||||||||||
| 45 | my %args = | ||||||||||||||||||||
| 46 | $ref eq 'HASH' | ||||||||||||||||||||
| 47 | 2 | ▶ | ? %{ shift() } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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; | |||||||||||||||||||