| 1 | 12 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Test::File::ShareDir::Utils; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 12 | our $VERSION = '1.001002'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 12 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # ABSTRACT: Simple utilities for File::ShareDir testing | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 12 | ▶ | use Exporter 5.57 qw(import); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 12 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 12 | our @EXPORT_OK = qw( extract_dashes ); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 5 | ▶ | sub extract_dashes { | ||||||||||||||||||||||||||
|
Subroutine
extract_dashes: called CC=7 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 5 | my ( $undashed_to, $source ) = @_; | |||||||||||||||||||||||||||
| 43 | 5 | ▶ | if ( not ref $source or 'HASH' ne ref $source ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not ref $source or "HASH" ne ref $source
MC/DC0%0/2
not ref $source or "HASH" ne ref $source
not ref $source
"HASH" ne ref $source
Truth table33%1/3
not(A) or B
A= not ref $sourceB= "HASH" ne ref $source
| |||||||||||||||||||||||||||||
| 44 | 0 | return croak(q[Must pass a hashref]); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | 5 | my %input_config = %{$source}; | |||||||||||||||||||||||||||
| 47 | 5 | my $params = {}; | |||||||||||||||||||||||||||
| 48 | 5 | for my $key ( keys %input_config ) { | |||||||||||||||||||||||||||
| 49 | 7 | ▶ | next unless $key =~ /\A-(.*)\z/msx; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 2 | $params->{$1} = delete $input_config{$key}; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 5 | ▶ | $params->{$undashed_to} = {} if not exists $params->{$undashed_to}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 5 | for my $key ( keys %input_config ) { | |||||||||||||||||||||||||||
| 54 | 5 | $params->{$undashed_to}->{$key} = $input_config{$key}; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 5 | return $params; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 12 | 1; | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||