| 1 | package Mason::CodeCache; | ||
| 2 | $Mason::CodeCache::VERSION = '2.23'; | ||
| 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 | use Mason::Util; | ||
| 6 | |||
| 7 | has 'datastore' => ( is => 'ro', isa => 'HashRef', default => sub { {} } ); | ||
| 8 | |||
| 9 | method get ($key) { | ||
| 10 | return $self->{datastore}->{$key}; | ||
| 11 | } | ||
| 12 | |||
| 13 | method set ($key, $data) { | ||
| 14 | $self->{datastore}->{$key} = $data; | ||
| 15 | } | ||
| 16 | |||
| 17 | method remove ($key) { | ||
| 18 | if ( my $entry = $self->{datastore}->{$key} ) { | ||
| 19 | if ( !in_global_destruction() ) { | ||
| 20 | my $compc = $entry->{compc}; | ||
| 21 | $compc->_unset_class_cmeta(); | ||
| 22 | $compc->meta->make_mutable(); | ||
| 23 | Mason::Util::delete_package($compc); | ||
| 24 | } | ||
| 25 | delete $self->{datastore}->{$key}; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | method get_keys () { | ||
| 30 | return keys( %{ $self->{datastore} } ); | ||
| 31 | } | ||
| 32 | |||
| 33 | __PACKAGE__->meta->make_immutable(); | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||
| 37 | __END__ | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | Mason::CodeCache - Result returned from Mason request | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | Internal class that manages the cache of components for L<Mason::Interp>. | ||
| 48 | |||
| 49 | =head1 SEE ALSO | ||
| 50 | |||
| 51 | L<Mason|Mason> | ||
| 52 | |||
| 53 | =head1 AUTHOR | ||
| 54 | |||
| 55 | Jonathan Swartz <swartz@pobox.com> | ||
| 56 | |||
| 57 | =head1 COPYRIGHT AND LICENSE | ||
| 58 | |||
| 59 | This software is copyright (c) 2012 by Jonathan Swartz. | ||
| 60 | |||
| 61 | This is free software; you can redistribute it and/or modify it under | ||
| 62 | the same terms as the Perl 5 programming language system itself. | ||
| 63 | |||
| 64 | =cut | ||