| 1 | package Context::Set::Role::Stored; | ||
| 2 | 3 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | Context::Set::Role::Stored - A stored context holds a Context::Set::Storage and uses it. | ||
| 7 | |||
| 8 | =cut | ||
| 9 | |||
| 10 | 3 | has 'storage' => ( is => 'rw' , isa => 'Context::Set::Storage', weak_ref => 1 ); | |
| 11 | |||
| 12 | 30 | ▶ | around 'set_property' => sub{ |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 13 | 30 | my ($orig, $self, $prop , $v ) = @_; | |
| 14 | |||
| 15 | return $self->storage->set_context_property($self, | ||
| 16 | $prop, | ||
| 17 | $v, | ||
| 18 | 30 | ▶ | sub{ |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 30 | $self->$orig($prop,$v); | |
| 20 | 30 | }); | |
| 21 | 3 | }; | |
| 22 | |||
| 23 | =head2 refresh_from_storage | ||
| 24 | |||
| 25 | Refreshes this context from the storage it is stored in. | ||
| 26 | |||
| 27 | Usage: | ||
| 28 | |||
| 29 | $this->refresh_from_storage(); | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | 2 | ▶ | sub refresh_from_storage{ |
|
Subroutine
refresh_from_storage: called CC=1 SCAR=0.0
Pod
documented
| |||
| 34 | 2 | my ($self) = @_; | |
| 35 | 2 | $self->storage->populate_context($self); | |
| 36 | 2 | return $self; | |
| 37 | } | ||
| 38 | |||
| 39 | 3 | ▶ | around 'delete_property' => sub{ |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 40 | 3 | my ($orig, $self, $prop) = @_; | |
| 41 | return $self->storage->delete_context_property($self, | ||
| 42 | $prop, | ||
| 43 | 3 | ▶ | sub{ |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 44 | 3 | $self->$orig($prop); | |
| 45 | 3 | }); | |
| 46 | 3 | }; | |
| 47 | |||
| 48 | 3 | 1; | |