| 1 | # | ||||||||||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Rex::Interface::File::Local; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 16 | ▶ | use v5.14.4; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 16 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 16 | ▶ | use Rex::Interface::File::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 16 | ▶ | use base qw(Rex::Interface::File::Base); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 195 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 195 | my $that = shift; | |||||||||||||||||||||||||||
| 17 | 195 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table33%1/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||||||||||
| 18 | 195 | my $self = $proto->SUPER::new(@_); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 195 | bless( $self, $proto ); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 195 | return $self; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 195 | ▶ | sub open { | ||||||||||||||||||||||||||
|
Subroutine
open: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 26 | 195 | my ( $self, $mode, $file ) = @_; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 195 | Rex::Logger::debug("Opening $file with mode: $mode"); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 195 | ▶ | open( $self->{fh}, $mode, $file ) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 195 | return 1; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 778 | ▶ | sub read { | ||||||||||||||||||||||||||
|
Subroutine
read: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 778 | my ( $self, $len ) = @_; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 778 | my $buf; | |||||||||||||||||||||||||||
| 39 | 778 | read( $self->{fh}, $buf, $len ); | |||||||||||||||||||||||||||
| 40 | 778 | return $buf; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 274 | ▶ | sub write { | ||||||||||||||||||||||||||
|
Subroutine
write: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 274 | my ( $self, $buf ) = @_; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 274 | ▶ | utf8::encode($buf) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
"Rex::Config"->get_write_utf8_files and utf8::is_utf8($buf)
MC/DC0%0/2
"Rex::Config"->get_write_utf8_files and utf8::is_utf8($buf)
"Rex::Config"->get_write_utf8_files
utf8::is_utf8($buf)
Truth table33%1/3
A and B
A= "Rex::Config"->get_write_utf8_filesB= utf8::is_utf8($buf)
| |||||||||||||||||||||||||||||
| 47 | if Rex::Config->get_write_utf8_files && utf8::is_utf8($buf); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 274 | my $fh = $self->{fh}; | |||||||||||||||||||||||||||
| 50 | 274 | print $fh $buf; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub seek { | ||||||||||||||||||||||||||
|
Subroutine
seek: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 54 | 0 | my ( $self, $pos ) = @_; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my $fh = $self->{fh}; | |||||||||||||||||||||||||||
| 57 | 0 | seek( $fh, $pos, 0 ); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 384 | ▶ | sub close { | ||||||||||||||||||||||||||
|
Subroutine
close: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 384 | my ($self) = @_; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 384 | my $fh = $self->{fh}; | |||||||||||||||||||||||||||
| 64 | 384 | ▶ | close $fh if $fh; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 384 | $self->{fh} = undef; | |||||||||||||||||||||||||||
| 66 | 384 | $self = undef; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 16 | 1; | |||||||||||||||||||||||||||