| 1 | package Mason::CodeCache; | ||||||||||||||
| 2 | 22 | $Mason::CodeCache::VERSION = '2.24'; | |||||||||||||
| 3 | 22 | ▶ | use Devel::GlobalDestruction; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 22 | ▶ | use Mason::Moose; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 22 | ▶ | use Mason::Util; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 87 | ▶ | has 'datastore' => ( is => 'ro', isa => 'HashRef', default => sub { {} } ); | ||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | |||||||||||||||
| 9 | 22 | ▶ | method get ($key) { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
get: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 270 | return $self->{datastore}->{$key}; | |||||||||||||
| 11 | 22 | } | |||||||||||||
| 12 | |||||||||||||||
| 13 | 22 | ▶ | method set ($key, $data) { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
set: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | 74 | $self->{datastore}->{$key} = $data; | |||||||||||||
| 15 | 22 | } | |||||||||||||
| 16 | |||||||||||||||
| 17 | 22 | ▶ | method remove ($key) { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
remove: called CC=3 SCAR=11.3
| |||||||||||||||
| 18 | 201 | ▶ | if ( my $entry = $self->{datastore}->{$key} ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 19 | 201 | ▶ | if ( !in_global_destruction() ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 20 | 201 | my $compc = $entry->{compc}; | |||||||||||||
| 21 | 201 | $compc->_unset_class_cmeta(); | |||||||||||||
| 22 | 201 | $compc->meta->make_mutable(); | |||||||||||||
| 23 | 201 | Mason::Util::delete_package($compc); | |||||||||||||
| 24 | } | ||||||||||||||
| 25 | 201 | delete $self->{datastore}->{$key}; | |||||||||||||
| 26 | } | ||||||||||||||
| 27 | 22 | } | |||||||||||||
| 28 | |||||||||||||||
| 29 | 22 | ▶ | method get_keys () { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
get_keys: called CC=1 SCAR=0.0
| |||||||||||||||
| 30 | 89 | return keys( %{ $self->{datastore} } ); | |||||||||||||
| 31 | 22 | } | |||||||||||||
| 32 | |||||||||||||||
| 33 | 22 | __PACKAGE__->meta->make_immutable(); | |||||||||||||
| 34 | |||||||||||||||
| 35 | 22 | 1; | |||||||||||||
| 36 | |||||||||||||||
| 37 | __END__ | ||||||||||||||