| 1 | package IRC::Indexer::Output; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use 5.10.1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 4 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 4 | ▶ | use Scalar::Util qw/openhandle/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 5 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||
| 11 | 5 | my $class = shift; | |||||||||||
| 12 | 5 | my $self = {}; | |||||||||||
| 13 | 5 | bless $self, $class; | |||||||||||
| 14 | |||||||||||||
| 15 | 5 | my %args = @_; | |||||||||||
| 16 | |||||||||||||
| 17 | 5 | $args{lc $_} = delete $args{$_} for keys %args; | |||||||||||
| 18 | |||||||||||||
| 19 | $self->{Input} = delete $args{input} | ||||||||||||
| 20 | 5 | ▶ | || croak "No input specified in new" ; | ||||||||||
|
Condition50%1/2
delete $args{'input'} || croak('No input specified in new')
MC/DC0%0/1
delete $args{'input'} || croak('No input specified in new')
delete $args{'input'}
Truth table50%1/2
A
A= delete $args{'input'}
| |||||||||||||
| 21 | |||||||||||||
| 22 | 5 | return $self | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 2 | ▶ | sub dump { | ||||||||||
|
Subroutine
dump: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 26 | 2 | my ($self) = @_; | |||||||||||
| 27 | 2 | my $output = $self->{Output}; | |||||||||||
| 28 | 2 | return $output | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub write { | ||||||||||
|
Subroutine
write: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 32 | 0 | my ($self, $path) = @_; | |||||||||||
| 33 | |||||||||||||
| 34 | 0 | ▶ | unless ($path) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | croak "write() called but no path specified" ; | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | my $out; | |||||||||||
| 39 | 0 | ▶ | unless ($out = $self->{Output}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | 0 | croak "write() called but no Output to write" ; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | 0 | ▶ | if ( openhandle($path) ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | print $path $out; | |||||||||||
| 45 | } else { | ||||||||||||
| 46 | 0 | ▶ | open my $fh, '>:encoding(utf8)', $path | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 47 | or croak "open failed in write(): $!"; | ||||||||||||
| 48 | 0 | print $fh $out; | |||||||||||
| 49 | 0 | close $fh; | |||||||||||
| 50 | } | ||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 4 | 1; | |||||||||||
| 54 | __END__ | ||||||||||||