| 1 | |||||||||||
| 2 | ############################################################################## | ||||||||||
| 3 | package Acme::Oil::ed::Scalar; | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use base qw(Acme::Oil::ed); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | sub TIESCALAR { | ||||||||
|
Subroutine
TIESCALAR: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | my $class = shift; | |||||||||
| 13 | 2 | my $scalar = shift; | |||||||||
| 14 | 2 | my $self = { | |||||||||
| 15 | value => $scalar, | ||||||||||
| 16 | level => 10, | ||||||||||
| 17 | }; | ||||||||||
| 18 | 2 | bless $self, $class; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub FETCH { | ||||||||
|
Subroutine
FETCH: called CC=3 SCAR=15.1
| |||||||||||
| 23 | 1 | my $self = shift; | |||||||||
| 24 | |||||||||||
| 25 | 1 | ▶ | if( $self->is_slipped ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | ▶ | carp "Can't be taken out by your hand's slipping." | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | if(warnings::enabled('Acme::Oil')); | ||||||||||
| 28 | 0 | return; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | $self->{value}; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | sub STORE { | ||||||||
|
Subroutine
STORE: called CC=4 SCAR=14.2
| |||||||||||
| 36 | 2 | my $self = shift; | |||||||||
| 37 | 2 | my $value = shift; | |||||||||
| 38 | |||||||||||
| 39 | 2 | ▶ | if(Acme::Oil::_is_burning($value)){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 1 | $self->ignition(); | |||||||||
| 41 | 1 | return; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | ▶ | if( $self->is_slipped ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 1 | ▶ | carp "Can't be put well by your hand's slipping." | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | if(warnings::enabled('Acme::Oil')); | ||||||||||
| 47 | 1 | return $self->{value}; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | $self->{value} = $value; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||