| 1 | # vi: set ts=4 sw=4 ht=4 et : | ||||||||||
| 2 | package perl5i::1::HASH; | ||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | require Carp; | |||||||||
| 8 | |||||||||||
| 9 | sub flip { | ||||||||||
| 10 | Carp::croak("Can't flip hash with references as values") | ||||||||||
| 11 | 0 | ▶ | if grep { ref } values %{$_[0]}; | ||||||||
|
Subroutine
flip: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 12 | |||||||||||
| 13 | 0 | my %flipped = reverse %{$_[0]}; | |||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | return wantarray ? %flipped : \%flipped; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub merge { | ||||||||||
| 19 | 0 | ▶ | require Hash::Merge::Simple; | ||||||||
|
Subroutine
merge: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 20 | 0 | my $merged = Hash::Merge::Simple::merge(@_); | |||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | return wantarray ? %$merged : $merged; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub print { | ||||||||||
| 26 | 0 | ▶ | my $hash = shift; | ||||||||
|
Subroutine
print: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | print join(" ", map { "$_ => $hash->{$_}" } keys %$hash); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | sub say { | ||||||||||
| 31 | 0 | ▶ | my $hash = shift; | ||||||||
|
Subroutine
say: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 32 | 0 | print join(" ", map { "$_ => $hash->{$_}" } keys %$hash), "\n"; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 1 | 1; | |||||||||