| 1 | package App::Ack::File; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 585 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 585 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 585 | ▶ | use App::Ack (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 585 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | App::Ack::File | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | Abstracts a file from the filesystem. | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head2 new( $filename ) | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | Opens the file specified by I<$filename> and returns a filehandle and | ||||||||||||||||||||||||||||||||||||||||||
| 22 | a flag that says whether it could be binary. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | If there's a failure, it throws a warning and returns an empty list. | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 17505 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 17505 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 17505 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 17505 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||
| 33 | filename => $filename, | ||||||||||||||||||||||||||||||||||||||||||
| 34 | fh => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 17505 | ▶ | if ( $self->{filename} eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | $self->{fh} = *STDIN; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 17505 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =head2 $file->name() | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | Returns the name of the file. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 37850 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 37850 | return $_[0]->{filename}; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head2 $file->basename() | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | Returns the basename (the last component the path) | ||||||||||||||||||||||||||||||||||||||||||
| 59 | of the file. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 24520 | ▶ | sub basename { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
basename: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 24520 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 24520 | ▶ | return $self->{basename} //= (File::Spec->splitpath($self->name))[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"basename"} //= ("File::Spec"->splitpath($self->name))[2]
MC/DC0%0/2
$self->{"basename"} //= ("File::Spec"->splitpath($self->name))[2]
$self->{"basename"}
("File::Spec"->splitpath($self->name))[2]
Truth table66%2/3
A //= B
A= $self->{"basename"}B= ("File::Spec"->splitpath($self->name))[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | =head2 $file->open() | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | Opens a filehandle for reading this file and returns it, or returns | ||||||||||||||||||||||||||||||||||||||||||
| 73 | undef if the operation fails (the error is in C<$!>). Instead of calling | ||||||||||||||||||||||||||||||||||||||||||
| 74 | C<close $fh>, C<$file-E<gt>close> should be called. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 6570 | ▶ | sub open { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 6570 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 6570 | ▶ | if ( !$self->{fh} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 4607 | ▶ | if ( open $self->{fh}, '<', $self->{filename} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | # Do nothing. | ||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | $self->{fh} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 6570 | return $self->{fh}; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 3395 | ▶ | sub may_be_present { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
may_be_present: called CC=9 SCAR=22.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 3395 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 3395 | my $regex = shift; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # Tells if the file needs a line-by-line scan. This is a big | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # optimization because if you can tell from the outset that the pattern | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # is not found in the file at all, then there's no need to do the | ||||||||||||||||||||||||||||||||||||||||||
| 101 | # line-by-line iteration. | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # Slurp up an entire file up to 10M, see if there are any matches | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # in it, and if so, let us know so we can iterate over it directly. | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | # The $regex may be undef if it had a "$" in it, and is therefore unsuitable for this heuristic. | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 3395 | my $may_be_present = 1; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 3395 | ▶ | if ( $regex && $self->open() && -f $self->{fh} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$regex and $self->open and -f $self->{"fh"}
$regex and $self->open
MC/DC100%3/3
$regex and $self->open and -f $self->{"fh"}
$regex
$self->open
-f $self->{"fh"}
Truth table100%4/4
A and B and C
A= $regexB= $self->openC= -f $self->{"fh"}
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 3304 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 3304 | my $size = 10_000_000; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 3304 | my $rc = sysread( $self->{fh}, $buffer, $size ); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 3304 | ▶ | if ( !defined($rc) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ( $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | App::Ack::warn( $self->name . ": $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $may_be_present = 0; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | # If we read all 10M, then we need to scan the rest. | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # If there are any carriage returns, our results are flaky, so scan the rest. | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 3304 | ▶ | if ( ($rc == $size) || (index($buffer,"\r") >= 0) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$rc == $size or (index($buffer, "\r") != -1)
MC/DC50%1/2
$rc == $size or (index($buffer, "\r") != -1)
$rc == $size
(index($buffer, "\r") != -1)
Truth table66%2/3
A or B
A= $rc == $sizeB= (index($buffer, "\r") != -1)
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | 36 | $may_be_present = 1; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 3268 | ▶ | if ( $buffer !~ /$regex/o ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 2533 | $may_be_present = 0; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 3395 | return $may_be_present; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | =head2 $file->reset() | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | Resets the file back to the beginning. This is only called if | ||||||||||||||||||||||||||||||||||||||||||
| 140 | C<may_be_present()> is true, but not always if C<may_be_present()> | ||||||||||||||||||||||||||||||||||||||||||
| 141 | is true. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 2063 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=5 SCAR=17.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 2063 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 2063 | ▶ | if ( defined($self->{fh}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 2016 | ▶ | return unless -f $self->{fh}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 2011 | ▶ | if ( !seek( $self->{fh}, 0, 0 ) && $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not seek($self->{"fh"}, 0, 0) and $App::Ack::report_bad_filenames
MC/DC0%0/2
not seek($self->{"fh"}, 0, 0) and $App::Ack::report_bad_filenames
not seek($self->{"fh"}, 0, 0)
$App::Ack::report_bad_filenames
Truth table33%1/3
not(A) and B
A= not seek($self->{"fh"}, 0, 0)B= $App::Ack::report_bad_filenames
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | App::Ack::warn( "$self->{filename}: $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 2058 | return; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | =head2 $file->close() | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | Close the file. | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 1471 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 1471 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 1471 | ▶ | if ( $self->{fh} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 1470 | ▶ | if ( !close($self->{fh}) && $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not CORE::close $self->{"fh"} and $App::Ack::report_bad_filenames
MC/DC0%0/2
not CORE::close $self->{"fh"} and $App::Ack::report_bad_filenames
not CORE::close $self->{"fh"}
$App::Ack::report_bad_filenames
Truth table33%1/3
not(A) and B
A= not CORE::close $self->{"fh"}B= $App::Ack::report_bad_filenames
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | App::Ack::warn( $self->name() . ": $!" ); | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 1470 | $self->{fh} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1471 | return; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | =head2 $file->clone() | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | Clones this file. | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 200 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 200 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 200 | return __PACKAGE__->new($self->name); | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | =head2 $file->firstliney() | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | Returns the first line of a file (or first 250 characters, whichever | ||||||||||||||||||||||||||||||||||||||||||
| 196 | comes first). | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 1201 | ▶ | sub firstliney { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
firstliney: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 1201 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1201 | ▶ | if ( !exists $self->{firstliney} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 1201 | my $fh = $self->open(); | |||||||||||||||||||||||||||||||||||||||||
| 205 | 1201 | ▶ | if ( !$fh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ( $App::Ack::report_bad_filenames ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | App::Ack::warn( $self->name . ': ' . $! ); | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->{firstliney} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 1201 | my $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 1201 | my $rc = sysread( $fh, $buffer, 250 ); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 1201 | ▶ | if ( $rc ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 1190 | $buffer =~ s/[\r\n].*//s; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 11 | ▶ | if ( !defined($rc) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | App::Ack::warn( $self->name . ': ' . $! ); | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 11 | $buffer = ''; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 1201 | $self->{firstliney} = $buffer; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 1201 | $self->reset; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 1201 | return $self->{firstliney}; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 585 | 1; | |||||||||||||||||||||||||||||||||||||||||