| 1 | package Data::HashMap::Shared; | ||
| 2 | 87 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 87 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 87 | our $VERSION = '0.23'; | |
| 5 | |||
| 6 | 87 | require XSLoader; | |
| 7 | 87 | XSLoader::load('Data::HashMap::Shared', $VERSION); | |
| 8 | |||
| 9 | # A cloned or deserialised handle would be a second object freeing the same map. | ||
| 10 | 87 | my @VARIANTS = qw(I16 I16S I32 I32S II IS SI SI16 SI32 SS); | |
| 11 | 0 | ▶ | my $no_copy = sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 12 | 0 | require Carp; | |
| 13 | 0 | Carp::croak(ref($_[0]), ': a handle cannot be copied or serialised; open the map again instead'); | |
| 14 | 87 | }; | |
| 15 | 87 | ▶ | { no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 87 | for my $v (@VARIANTS) { | |
| 17 | 870 | for my $class ("Data::HashMap::Shared::$v", "Data::HashMap::Shared::${v}::Cursor") { | |
| 18 | 0 | ▶ | *{"${class}::CLONE_SKIP"} = sub { 1 }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||
| 19 | 1740 | *{"${class}::STORABLE_freeze"} = $no_copy; | |
| 20 | 1740 | *{"${class}::FREEZE"} = $no_copy; | |
| 21 | } | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | 87 | 1; | |
| 26 | |||
| 27 | __END__ | ||