| 1 | package Csistck::Role; | ||||||||||
| 2 | |||||||||||
| 3 | 17 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 17 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 17 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 17 | ▶ | use Csistck; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | |||||||||||
| 10 | sub new { | ||||||||||
| 11 | 1 | ▶ | my $class = shift; | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 12 | 1 | my %args = @_; | |||||||||
| 13 | 1 | my $args = \%args; | |||||||||
| 14 | |||||||||||
| 15 | 1 | my $self = {}; | |||||||||
| 16 | 1 | $self->{tests} = []; | |||||||||
| 17 | 1 | bless($self, $class); | |||||||||
| 18 | |||||||||||
| 19 | # We won't add keys that overlap with required keys, | ||||||||||
| 20 | # drop silently for now. Set up tests after | ||||||||||
| 21 | 1 | $self->defaults(); | |||||||||
| 22 | 1 | foreach my $key (keys (%{$args})) { | |||||||||
| 23 | 1 | ▶ | $self->{$key} = $args->{$key} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | unless ($key =~ /^tests$/); | ||||||||||
| 25 | } | ||||||||||
| 26 | 1 | $self->tests(); | |||||||||
| 27 | |||||||||||
| 28 | 1 | return $self; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | # For overriding | ||||||||||
| 32 | 0 | ▶ | sub defaults { return; }; | ||||||||
|
Subroutine
defaults: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | 0 | ▶ | sub tests { return; }; | ||||||||
|
Subroutine
tests: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | |||||||||||
| 35 | # Add test to object | ||||||||||
| 36 | sub add { | ||||||||||
| 37 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
add: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 38 | 2 | my @tests = @_; | |||||||||
| 39 | 2 | push(@{$self->{tests}}, @tests); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | # Return tests | ||||||||||
| 43 | sub get_tests { | ||||||||||
| 44 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
get_tests: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 45 | 2 | return $self->{tests}; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 17 | 1; | |||||||||
| 49 | __END__ | ||||||||||