| 1 | package Module::Functions; | ||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use 5.008005; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | our $VERSION = '2.1.3'; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 3 | ▶ | use parent qw/Exporter/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 3 | ▶ | use Sub::Identify (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 3 | our @EXPORT = qw(get_public_functions); | |||||||||||||||||||
| 12 | 3 | our @EXPORT_OK = qw(get_full_functions); | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 2 | ▶ | sub get_public_functions { | ||||||||||||||||||
|
Subroutine
get_public_functions: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||
| 15 | 2 | ▶ | my $klass = shift || caller(0); | ||||||||||||||||||
|
Condition66%2/3
shift() || caller 0
MC/DC0%0/2
shift() || caller 0
shift()
caller 0
Truth table66%2/3
A || B
A= shift()B= caller 0
| |||||||||||||||||||||
| 16 | 2 | my @functions; | |||||||||||||||||||
| 17 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 2 | my %class = %{"${klass}::"}; | |||||||||||||||||||
| 19 | 2 | ▶ | while (my ($k, $v) = each %class) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 20 | 14 | ▶ | next if $k =~ /^(?:BEGIN|UNITCHECK|INIT|CHECK|END|import)$/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | 11 | ▶ | next if $k =~ /^_/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 22 | 11 | ▶ | next unless *{"${klass}::${k}"}{CODE}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | 6 | ▶ | next if $klass ne Sub::Identify::stash_name( $klass->can($k) ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | 2 | push @functions, $k; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | 2 | return @functions; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 1 | ▶ | sub get_full_functions { | ||||||||||||||||||
|
Subroutine
get_full_functions: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 30 | 1 | ▶ | my $klass = shift || caller(0); | ||||||||||||||||||
|
Condition33%1/3
shift() || caller 0
MC/DC0%0/2
shift() || caller 0
shift()
caller 0
Truth table33%1/3
A || B
A= shift()B= caller 0
| |||||||||||||||||||||
| 31 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | 1 | return keys %{"${klass}::"}; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 3 | 1; | |||||||||||||||||||
| 36 | __END__ | ||||||||||||||||||||