| 1 | package App::SimpleScan::Substitution::Line; | ||||||||||
| 2 | 43 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 43 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 43 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 43 | our $VERSION = '1.00'; | |||||||||
| 7 | |||||||||||
| 8 | 43 | ▶ | use base qw(Class::Accessor::Fast Clone); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 43 | __PACKAGE__->mk_accessors( qw(line) ); | |||||||||
| 10 | |||||||||||
| 11 | use overload | ||||||||||
| 12 | 43 | ▶ | '""' => sub { $_[0]->line }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 34 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 34 | my ($class, $line) = @_; | |||||||||
| 16 | 34 | my $self = {}; | |||||||||
| 17 | 34 | bless $self, $class; | |||||||||
| 18 | |||||||||||
| 19 | 34 | ▶ | croak "No line supplied" unless defined $line; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 33 | $self->line($line); | |||||||||
| 22 | 33 | $self->no_fixed; | |||||||||
| 23 | |||||||||||
| 24 | 33 | return $self; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 34 | ▶ | sub no_fixed { | ||||||||
|
Subroutine
no_fixed: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 28 | 34 | my($self) = @_; | |||||||||
| 29 | 34 | $self->{fixed} = {}; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 202 | ▶ | sub fix { | ||||||||
|
Subroutine
fix: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 33 | 202 | my ($self, $var, $value) = @_; | |||||||||
| 34 | 202 | ▶ | croak "No variable supplied" unless defined $var; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 201 | ▶ | croak "No value supplied" unless defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | |||||||||||
| 37 | 200 | $self->{fixed}->{$var} = $value; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | ▶ | sub unfix { | ||||||||
|
Subroutine
unfix: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||
| 41 | 1 | my ($self, $var) = @_; | |||||||||
| 42 | 1 | ▶ | croak "No variable supplied" unless defined $var; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 1 | ▶ | croak "Variable $var is not fixed" unless exists $self->{fixed}->{$var}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 1 | delete $self->{fixed}->{$var}; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 72 | ▶ | sub fixed { | ||||||||
|
Subroutine
fixed: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 48 | 72 | my ($self, $var) = @_; | |||||||||
| 49 | 72 | ▶ | if (defined $var) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 2 | return $self->{fixed}->{$var}; | |||||||||
| 51 | } | ||||||||||
| 52 | else { | ||||||||||
| 53 | 70 | return %{ $self->{fixed} }; | |||||||||
| 54 | } | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 43 | 1; | |||||||||
| 58 | |||||||||||
| 59 | __END__ | ||||||||||