| 1 | package Object::Lazy::Ref; ## no critic (TidyCode) | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = '0.12'; | |||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | my %register; | |||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | my $old_core_global_ref = *CORE::GLOBAL::ref; | |||||||||
| 14 | 366 | ▶ | *CORE::GLOBAL::ref = sub ($) { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 15 | 366 | my $ref = shift; | |||||||||
| 16 | |||||||||||
| 17 | return | ||||||||||
| 18 | exists $register{$ref} | ||||||||||
| 19 | ? $register{$ref} | ||||||||||
| 20 | 366 | ▶ | : do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 365 | local *CORE::GLOBAL::ref = $old_core_global_ref; | |||||||||
| 22 | 365 | ref $ref; | |||||||||
| 23 | }; | ||||||||||
| 24 | } | ||||||||||
| 25 | 2 | } | |||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | sub register { | ||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 1 | my $object = shift; | |||||||||
| 29 | |||||||||||
| 30 | 1 | $register{$object} = $object->{ref}; | |||||||||
| 31 | |||||||||||
| 32 | 1 | return; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | # $Id$ | ||||||||||
| 36 | |||||||||||
| 37 | 2 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||