| 1 | 1 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | package Memoize::Storable; | ||||||||||
| 4 | 1 | our $VERSION = '1.17'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Storable 1.002 (); # for lock_* function variants | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | our $Verbose; | |||||||||
| 9 | |||||||||||
| 10 | 5 | ▶ | sub TIEHASH { | ||||||||
|
Subroutine
TIEHASH: called CC=3 SCAR=11.0
| |||||||||||
| 11 | 5 | my $package = shift; | |||||||||
| 12 | 5 | my $filename = shift; | |||||||||
| 13 | 5 | ▶ | my $truehash = (-e $filename) ? Storable::lock_retrieve($filename) : {}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 5 | my %options; | |||||||||
| 15 | 5 | ▶ | print STDERR "Memoize::Storable::TIEHASH($filename, @_)\n" if $Verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 5 | @options{@_} = (1) x @_; | |||||||||
| 17 | 5 | my $self = | |||||||||
| 18 | {FILENAME => $filename, | ||||||||||
| 19 | H => $truehash, | ||||||||||
| 20 | OPTIONS => \%options | ||||||||||
| 21 | }; | ||||||||||
| 22 | 5 | bless $self => $package; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | sub STORE { | ||||||||
|
Subroutine
STORE: called CC=2 SCAR=7.1
| |||||||||||
| 26 | 1 | my $self = shift; | |||||||||
| 27 | 1 | ▶ | print STDERR "Memoize::Storable::STORE(@_)\n" if $Verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 1 | $self->{H}{$_[0]} = $_[1]; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 2 | ▶ | sub FETCH { | ||||||||
|
Subroutine
FETCH: called CC=2 SCAR=7.1
| |||||||||||
| 32 | 2 | my $self = shift; | |||||||||
| 33 | 2 | ▶ | print STDERR "Memoize::Storable::FETCH(@_)\n" if $Verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 2 | $self->{H}{$_[0]}; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 4 | ▶ | sub EXISTS { | ||||||||
|
Subroutine
EXISTS: called CC=2 SCAR=7.1
| |||||||||||
| 38 | 4 | my $self = shift; | |||||||||
| 39 | 4 | ▶ | print STDERR "Memoize::Storable::EXISTS(@_)\n" if $Verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 4 | exists $self->{H}{$_[0]}; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 5 | ▶ | sub DESTROY { | ||||||||
|
Subroutine
DESTROY: called CC=3 SCAR=11.0
| |||||||||||
| 44 | 5 | my $self= shift; | |||||||||
| 45 | 5 | ▶ | print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 5 | ▶ | if ($self->{OPTIONS}{'nstore'}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 1 | Storable::lock_nstore($self->{H}, $self->{FILENAME}); | |||||||||
| 48 | } else { | ||||||||||
| 49 | 4 | Storable::lock_store($self->{H}, $self->{FILENAME}); | |||||||||
| 50 | } | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | sub FIRSTKEY { | ||||||||
|
Subroutine
FIRSTKEY: not called CC=1 SCAR=6.9
| |||||||||||
| 54 | 0 | 'Fake hash from Memoize::Storable'; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub NEXTKEY { | ||||||||
|
Subroutine
NEXTKEY: not called CC=1 SCAR=6.9
| |||||||||||
| 58 | 0 | undef; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | 1; | |||||||||
| 62 | |||||||||||
| 63 | __END__ | ||||||||||