| 1 | package Class::Param::Ordered; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use base 'Class::Param::Base'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 2 | ▶ | use Params::Validate qw[]; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 2 | ▶ | use Tie::Hash::Indexed qw[]; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 11 | 2 | ▶ | my $class = ref $_[0] ? ref shift : shift; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 12 | |||||||||||||
| 13 | 2 | my ( $hash ) = Params::Validate::validate_with( | |||||||||||
| 14 | params => \@_, | ||||||||||||
| 15 | spec => [ | ||||||||||||
| 16 | { | ||||||||||||
| 17 | type => Params::Validate::HASHREF, | ||||||||||||
| 18 | default => {}, | ||||||||||||
| 19 | optional => 1 | ||||||||||||
| 20 | } | ||||||||||||
| 21 | ], | ||||||||||||
| 22 | called => "$class\::new" | ||||||||||||
| 23 | ); | ||||||||||||
| 24 | |||||||||||||
| 25 | 2 | my $param = Tie::Hash::Indexed->TIEHASH( %{ $hash } ); | |||||||||||
| 26 | |||||||||||||
| 27 | 2 | return bless( \$param, $class ); | |||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | 25 | ▶ | sub get { | ||||||||||
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 31 | 25 | my ( $self, $name ) = @_; | |||||||||||
| 32 | 25 | return $$self->FETCH($name); | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 7 | ▶ | sub set { | ||||||||||
|
Subroutine
set: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 36 | 7 | my ( $self, $name, $value ) = @_; | |||||||||||
| 37 | 7 | $$self->STORE( $name => $value ); | |||||||||||
| 38 | 7 | return 1; | |||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 22 | ▶ | sub has { | ||||||||||
|
Subroutine
has: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 42 | 22 | my ( $self, $name ) = @_; | |||||||||||
| 43 | 22 | return $$self->EXISTS($name); | |||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 2 | ▶ | sub count { | ||||||||||
|
Subroutine
count: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 47 | 2 | my $self = shift; | |||||||||||
| 48 | 2 | ▶ | return scalar $self->names || 0; | ||||||||||
|
Condition100%2/2
scalar $self->names || 0
MC/DC100%1/1
scalar $self->names || 0
scalar $self->names
Truth table100%2/2
A
A= scalar $self->names
| |||||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 5 | ▶ | sub remove { | ||||||||||
|
Subroutine
remove: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 52 | 5 | my ( $self, $name ) = @_; | |||||||||||
| 53 | 5 | return $$self->DELETE($name); | |||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 1 | ▶ | sub clear { | ||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 57 | 1 | my $self = shift; | |||||||||||
| 58 | 1 | $$self->CLEAR; | |||||||||||
| 59 | 1 | return 1; | |||||||||||
| 60 | } | ||||||||||||
| 61 | |||||||||||||
| 62 | 9 | ▶ | sub names { | ||||||||||
|
Subroutine
names: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 63 | 9 | my $self = shift; | |||||||||||
| 64 | 9 | my @names = ( $$self->FIRSTKEY ); | |||||||||||
| 65 | |||||||||||||
| 66 | 9 | ▶ | return () unless defined $names[0]; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 67 | |||||||||||||
| 68 | 5 | ▶ | while ( defined ( $_ = $$self->NEXTKEY( $names[-1] ) ) ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 69 | 20 | push @names, $_; | |||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | 5 | return @names; | |||||||||||
| 73 | } | ||||||||||||
| 74 | |||||||||||||
| 75 | 2 | 1; | |||||||||||
| 76 | |||||||||||||
| 77 | __END__ | ||||||||||||