| 1 | 3 | ▶ | use 5.008003; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Sub::Trigger::Lock; | ||||||||||
| 6 | |||||||||||
| 7 | 3 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||
| 8 | 3 | our $VERSION = '0.002'; | |||||||||
| 9 | |||||||||||
| 10 | 3 | ▶ | use Scope::Guard qw( guard ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use Exporter::Tiny qw( ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 3 | our @ISA = qw(Exporter::Tiny); | |||||||||
| 14 | 3 | our %EXPORT_TAGS = ( | |||||||||
| 15 | all => [qw( Lock RO lock unlock )], | ||||||||||
| 16 | default => [qw( Lock )], | ||||||||||
| 17 | ); | ||||||||||
| 18 | 3 | our @EXPORT_OK = @{ $EXPORT_TAGS{all} }; | |||||||||
| 19 | 3 | our @EXPORT = @{ $EXPORT_TAGS{default} }; | |||||||||
| 20 | |||||||||||
| 21 | 6 | ▶ | sub _lock { | ||||||||
|
Subroutine
_lock: called CC=5 SCAR=16.2
| |||||||||||
| 22 | |||||||||||
| 23 | 6 | ▶ | if ( ref($_[1]) eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 5 | &Internals::SvREADONLY( $_[1], 1 ); | |||||||||
| 25 | 5 | &Internals::SvREADONLY( \$_, 1 ) for @{$_[1]}; | |||||||||
| 26 | 5 | return; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | if ( ref($_[1]) eq 'HASH' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 1 | &Internals::hv_clear_placeholders($_[1]); | |||||||||
| 31 | 1 | &Internals::SvREADONLY( $_[1], 1 ); | |||||||||
| 32 | 1 | &Internals::SvREADONLY( \$_, 1 ) for values %{$_[1]}; | |||||||||
| 33 | 1 | return; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | return; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 4 | ▶ | sub Lock () { | ||||||||
|
Subroutine
Lock: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 40 | 4 | \&_lock; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 2 | ▶ | sub RO () { | ||||||||
|
Subroutine
RO: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 44 | 2 | 'ro', 'trigger', Lock; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub lock ($) { | ||||||||
|
Subroutine
lock: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 0 | _lock(undef, @_); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 2 | ▶ | sub unlock ($) { | ||||||||
|
Subroutine
unlock: called CC=5 SCAR=18.1
Pod
documented
| |||||||||||
| 52 | 2 | my $ref = shift; | |||||||||
| 53 | |||||||||||
| 54 | 2 | ▶ | if ( ref($ref) eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 2 | &Internals::SvREADONLY( $ref, 0 ); | |||||||||
| 56 | 2 | &Internals::SvREADONLY( \$_, 0 ) for @$ref; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 2 | ▶ | if ( ref($_[1]) eq 'HASH' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | &Internals::hv_clear_placeholders($ref); | |||||||||
| 61 | 0 | &Internals::SvREADONLY( $ref, 0 ); | |||||||||
| 62 | 0 | &Internals::SvREADONLY( \$_, 0 ) for values %$ref; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 2 | ▶ | return guard { _lock(undef, $ref) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 3 | 1; | |||||||||
| 69 | |||||||||||
| 70 | __END__ | ||||||||||