| 1 | package Class::Property::RW; | ||
| 2 | 1 | ▶ | use strict; use warnings FATAL => 'all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use Scalar::Util 'weaken'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # | ||
| 6 | # This package is prototype. It has no use by itself | ||
| 7 | # | ||
| 8 | sub TIESCALAR | ||
| 9 | 4 | ▶ | { |
|
Subroutine
TIESCALAR: called CC=1 SCAR=0.0
| |||
| 10 | 4 | my( $class, $field ) = @_; | |
| 11 | 4 | return bless { | |
| 12 | 'field' => $field | ||
| 13 | }, $class; | ||
| 14 | } | ||
| 15 | |||
| 16 | sub STORE | ||
| 17 | 5 | ▶ | { |
|
Subroutine
STORE: called CC=1 SCAR=0.0
| |||
| 18 | 5 | my $self = shift; | |
| 19 | 5 | $self->{'object'}->{$self->{'field'}} = shift; | |
| 20 | 5 | return; | |
| 21 | } | ||
| 22 | |||
| 23 | sub FETCH | ||
| 24 | 7 | ▶ | { |
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||
| 25 | 7 | my( $self ) = @_; | |
| 26 | 7 | return $self->{'object'}->{$self->{'field'}}; | |
| 27 | } | ||
| 28 | |||
| 29 | sub DESTROY | ||
| 30 | 0 | ▶ | { |
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||
| 31 | 0 | my $self = shift; | |
| 32 | 0 | $self = undef; | |
| 33 | 0 | return; | |
| 34 | } | ||
| 35 | |||
| 36 | sub set_object | ||
| 37 | 39 | ▶ | { |
|
Subroutine
set_object: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 38 | 39 | my $self = shift; | |
| 39 | 39 | $self->{'object'} = shift; | |
| 40 | 39 | weaken($self->{'object'}); | |
| 41 | } | ||
| 42 | |||
| 43 | 1 | 1; | |