blib/lib/MP3/Splitter.pm

filter: Statementstmt 100% 160 / 160 Branchbran 70.0% 77 / 110 Conditioncond 58.6% 34 / 58 MC/DCmcdc 30.3% 10 / 33 Subroutinesub 100% 15 / 15 Podpod 0.0% 0 / 5 totaltotal 77.6% 296 / 381 CC 77 SCAR 35.1
CC
77
Cov
83%
mp3split
60.9
mp3split_read
8.7
make_sec
8.3
CRAP 33.4
↑ Summary
1 package MP3::Splitter;
2  
3 1 ▶use 5.005;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 require Exporter;
7 1 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 @ISA = qw(Exporter);
9  
10 # Items to export into callers namespace by default. Note: do not export
11 # names by default without a very good reason. Use EXPORT_OK instead.
12 # Do not simply export all your public functions/methods/constants.
13  
14 # This allows declaration use MP3::Splitter ':all';
15 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
16 # will save memory.
17 1 %EXPORT_TAGS = ( 'all' => [ qw(
18 mp3split
19 mp3split_read
20 ) ] );
21  
22 1 @EXPORT = ( @{ $EXPORT_TAGS{'all'} } );
23  
24 1 @EXPORT_OK = qw(
25
26 );
27  
28 1 $VERSION = '0.04';
29  
30 # Preloaded methods go here.
31  
32 1 ▶use MPEG::Audio::Frame 0.04;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶die "This version of MPEG::Audio::Frame unsupported"
Branch: 1 branch
BranchTrueFalseTotal
if "0.07" == "MPEG::Audio::Frame"->VERSION 0 1 1
34 if 0.07 == MPEG::Audio::Frame->VERSION;
35  
36 10 ▶sub piece_open ($$$$$) {
Subroutine piece_open: called CC=6 SCAR=20.2
Pod undocumented
37 10 my ($fname, $piece, $track, $Xing, $opts) = @_;
38 10 ▶ my $callback = $piece->[2] || $opts->{name_callback};
Condition33%1/3
$piece->[2] || $opts->{'name_callback'}
l!l&&r!l&&!r
0100
MC/DC0%0/2
$piece->[2] || $opts->{'name_callback'}
$piece->[2] $opts->{'name_callback'}
Truth table33%1/3
A || B
A= $piece->[2]B= $opts->{'name_callback'}
ABresult
1X1
011
000
39 10 my $name = &$callback($track, $fname, $piece, $Xing, $opts);
40 10 local *OUT;
41 10 ▶ die "file `$name' exists" if not $opts->{overwrite} and -f $name;
Branch: 1 branch
BranchTrueFalseTotal
if not $opts->{"overwrite"} and -f $name 0 10 10
Condition33%1/3
not $opts->{"overwrite"} and -f $name
!ll&&!rl&&r
0100
MC/DC0%0/2
not $opts->{"overwrite"} and -f $name
not $opts->{"overwrite"} -f $name
Truth table33%1/3
not(A) and B
A= not $opts->{"overwrite"}B= -f $name
ABresult
0X0
100
111
42 10 ▶ open OUT, "> $name" or die "open `$name' for write: $!";
Branch: 1 branch
BranchTrueFalseTotal
open OUT, "> $name" or die "open `${name}' for write: $!" 10 0 10
43 10 ▶ binmode OUT or die;
Branch: 1 branch
BranchTrueFalseTotal
binmode OUT or die 10 0 10
44 10 ($name, *OUT); # Ouch!
45 }
46  
47 18 ▶sub make_sec ($) {
Subroutine make_sec: called CC=8 SCAR=21.2
Pod undocumented
48 18 my $t = shift;
49 18 ▶ my ($h, $m, $s) =
Branch: 1 branch
BranchTrueFalseTotal
() = $t =~ /^(?:([\d.]+)(?:h|:(?=.*[m:])))?(?:([\d.]+)[m:])?(?:([\d.]+)s?)?$/ or die "Unexpected format of time: `${t}'" 18 0 18
50 $t =~ /^(?:([\d.]+)(?:h|:(?=.*[m:])))?(?:([\d.]+)[m:])?(?:([\d.]+)s?)?$/
51 or die "Unexpected format of time: `$t'";
52 18 for my $p ($h, $m, $s) {
53 54 ▶ next unless defined $p;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $p 28 26 54
54 26 ▶ $p =~ /^(\d+\.?|\d*\.\d+)$/ or die "Unexpected format of time: `$t'";
Branch: 1 branch
BranchTrueFalseTotal
$p =~ /^(\d+\.?|\d*\.\d+)$/ or die "Unexpected format of time: `${t}'" 26 0 26
55 }
56 18 ▶ ($h || 0) * 3600 + ($m || 0) * 60 + ($s || 0);
Condition83%5/6
$h || 0
l!l
018
$m || 0
l!l
612
$s || 0
l!l
144
MC/DC0%0/1
$h || 0
$h
MC/DC100%1/1
$m || 0
$m
MC/DC100%1/1
$s || 0
$s
Truth table50%1/2
A
A= $h
Aresult
11
00
Truth table100%2/2
A
A= $m
Aresult
11
00
Truth table100%2/2
A
A= $s
Aresult
11
00
57 }
58  
59 sub MY_INF () {1e100}
60  
61 10 ▶sub piece_decl ($$;@) {
Subroutine piece_decl: called CC=6 SCAR=17.9
Pod undocumented
62 10 my ($start, $end, %piece_opts) = @{shift()};
63 10 my $was = shift;
64 10 (my $rel_start, $start) = $start =~ /^(>?)(.*)/;
65 10 (my $abs_end, $end) = $end =~ /^(=?)(.*)/;
66 10 $start = make_sec $start;
67 10 ▶ $start += $was if $rel_start;
Branch: 1 branch
BranchTrueFalseTotal
if $rel_start 4 6 10
68 10 ▶ if ($end eq 'INF') {
Branch: 1 branch
BranchTrueFalseTotal
if ($end eq 'INF') { } 4 6 10
69 4 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 2 4
70 2 $end = make_sec $_[0][0]; # Start of the next chunk
71 } else { # Go to the end of the file
72 2 $end = MY_INF; # Soft infinity
73 2 $piece_opts{lax} = $end;
74 }
75 } else {
76 6 ▶ $end = make_sec $end unless $end eq MY_INF;
Branch: 1 branch
BranchTrueFalseTotal
unless $end eq "1e+100" 6 0 6
77 6 ▶ $end += $start unless $abs_end;
Branch: 1 branch
BranchTrueFalseTotal
unless $abs_end 2 4 6
78 }
79 10 ($start, $end, %piece_opts);
80 }
81  
82 2 ▶sub _Xing ($) { # Guesswork... What is the correct \0* ?
Subroutine _Xing: called CC=2 SCAR=7.0
83 2 my $f = shift;
84 2 my $c = $f->content;
85 2 ▶ $c =~ /^(\0{4,}(Xing|Info))(.{112})/s or return;
Branch: 1 branch
BranchTrueFalseTotal
$c =~ /^(\0{4,}(Xing|Info))(.{112})/s or return 2 0 2
86 2 length($1)+4, $2, unpack 'N3 C100', $3; # FramesOffset, Type, Flags, Frames, Bytes, Offsets
87 }
88  
89 10 ▶sub _Xing_h ($$$$$$$) {
Subroutine _Xing_h: called CC=8 SCAR=20.9
90 10 my ($Xing, $frames_off, $frames, $bytes, $time, $end, $off) = @_;
91 10 my @o;
92 10 ▶ if ($end >= MY_INF) { # [time, frames, pos] - know it's a final write
Branch: 2 branches
BranchTrueFalseTotal
if ($end >= 1e+100) { } 1 9 10
elsif (@$off) { } 4 5 9
93 # Need to interpolate
94 1 my ($last_time, $last_frac, $i) = (0, 0);
95 1 for $i (@$off) {
96 389 my $this_time = $i->[0]/$time * 100;
97 389 ▶ next if $this_time == $last_time;
Branch: 1 branch
BranchTrueFalseTotal
if $this_time == $last_time 0 389 389
98 389 my $this_frac = $i->[2]/$bytes * 256;
99 389 ▶ while (@o <= $this_time) { # Fuzz ok: actually need only 99 of 100
Branch: 1 branch
BranchTrueFalseTotal
if (@o <= $this_time) 101 389 490
100 101 push @o, $last_frac
101 + ($this_frac - $last_frac)*(@o - $last_time)/($this_time - $last_time);
102 }
103 389 $last_time = $this_time;
104 389 $last_frac = $this_frac;
105 }
106 } elsif (@$off) {
107 4 @o = map int($_->[2]/$bytes*256), @$off;
108 } else { # Before writing, assume linear flow
109 5 @o = map $_*256/100, 0..99;
110 }
111 10 ▶ @o = map { $_ > 255 ? 255 : $_ } @o[0..99];
Branch: 1 branch
BranchTrueFalseTotal
$_ > 255 ? : 0 1000 1000
112 10 my $c = $Xing->content;
113 10 substr($c, $frames_off, 108) = pack 'N2 C100', $frames, $bytes, @o;
114 10 my $crc = $Xing->crc;
115 10 ▶ $crc = '' unless defined $crc;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $crc 0 10 10
116 10 $Xing->header() . $crc . $c;
117 }
118  
119 2 ▶sub mp3split ($;@) {
Subroutine mp3split: called CC=45 SCAR=41.1
Pod undocumented
120 2 my $f = shift;
121  
122 2 ▶ return unless @_; # Nothing to do
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 2 2
123 my %opts = ( lax => 0.02, # close to 1/75 - tolerate terminations that early
124 10 ▶ verbose => 0, append => sub{''}, prepend => sub{''},
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
125 5 ▶ name_callback => sub {sprintf "%02d_%s", shift, shift},
Subroutine __ANON__: called CC=1 SCAR=0.0
126 2 ▶ after_write => sub {}, keep_Xing => 1, update_Xing => 1,
Subroutine __ANON__: called CC=1 SCAR=0.0
127 );
128 2 ▶ %opts = (%opts, %{shift()}) unless 'ARRAY' eq ref $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless "ARRAY" eq ref $_[0] 2 0 2
129 2 ▶ return unless @_; # Nothing to do
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 2 2
130  
131 2 local *F;
132 2 ▶ open F, $f or die("open `$f': $!");
Branch: 1 branch
BranchTrueFalseTotal
open F, $f or die "open `${f}': $!" 2 0 2
133 2 binmode F;
134  
135 2 my $frame;
136 2 my $trk = 0; # Before first track
137  
138 2 my ($frames, $piece_frames) = (0, 0); # frames written
139 2 my ($ttime, $ptime) = (0,0); # total and piece time
140  
141 2 ▶ my $piece = shift or return; # start, duration, name-callback, finish-callback, user-data
Branch: 1 branch
BranchTrueFalseTotal
my $piece = shift() or return 2 0 2
142 2 my ($start, $end, %piece_opts) = (0, 0);
143 2 ($start, $end, %piece_opts) = piece_decl $piece, $end, @_;
144 2 %piece_opts = (%opts, %piece_opts);
145  
146 2 my ($outf, $out, $finished); # output file and its name, etc
147 2 my ($Xing, $Xing_off, $av_fr, $vbr, $tot_len, $frt, @off, $Xing_tell, $l);
148  
149 2 ▶ print STDERR "`$f'\n" if $opts{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"verbose"} 2 0 2
150 2 ▶ while ( $frame = MPEG::Audio::Frame->read(\*F) or ++$finished) {
Branch: 1 branch
BranchTrueFalseTotal
if ($frame = "MPEG::Audio::Frame"->read(\*F) or ++$finished) 11004 0 11004
Condition66%2/3
$frame = "MPEG::Audio::Frame"->read(\*F) or ++$finished
l!l&&r!l&&!r
1100220
MC/DC0%0/2
$frame = "MPEG::Audio::Frame"->read(\*F) or ++$finished
$frame = "MPEG::Audio::Frame"->read(\*F) ++$finished
Truth table66%2/3
A or B
A= $frame = "MPEG::Audio::Frame"->read(\*F)B= ++$finished
ABresult
1X1
011
000
151 # Check whether it is an Xing frame
152 11004 ▶ if ( !$frames and !$finished
Branch: 1 branch
BranchTrueFalseTotal
if (not $frames || $finished and ($Xing_off, undef, undef, my $fr, my $b) = &_Xing($frame)) 2 11002 11004
Condition66%4/6
not $frames || $finished and ($Xing_off, undef, undef, my $fr, my $b) = &_Xing($frame)
!ll&&!rl&&r
1100202
$frames || $finished
l!l&&r!l&&!r
1100202
MC/DC33%1/3
not $frames || $finished and ($Xing_off, undef, undef, my $fr, my $b) = &_Xing($frame)
$frames $finished ($Xing_off, undef, undef, my $fr, my $b) = &_Xing($frame)
Truth table50%2/4
not(A || B) and C
A= $framesB= $finishedC= ($Xing_off, undef, undef, my $fr, my $b) = &_Xing($frame)
ABCresult
1XX0
01X0
0000
0011
153 and ($Xing_off, undef, undef, my $fr, my $b) = _Xing($frame) ) {
154 2 $av_fr = $b/$fr; # Average length of a frame
155 2 $frt = $frame->seconds; # Depends on layer and samplerate only
156 2 $vbr = $av_fr/$frt/125; # kbits is 1000 bits = 1000/8 bytes
157 2 $tot_len = $fr * $frt;
158 2 $Xing = $frame;
159 printf STDERR "VBR: %.1fkBit/sec. Total: %.2fsec (from Xing header)\n", $vbr, $tot_len
160 2 ▶ if $piece_opts{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $piece_opts{"verbose"} 2 0 2
161 }
162 # Check what to do with this frame
163 11004 ▶ if ( $ttime > $end or $finished ) { # Need to end the current piece
Branch: 1 branch
BranchTrueFalseTotal
if ($ttime > $end or $finished) 10 10994 11004
Condition100%3/3
$ttime > $end or $finished
l!l&&r!l&&!r
8210994
MC/DC100%2/2
$ttime > $end or $finished
$ttime > $end $finished
Truth table100%3/3
A or B
A= $ttime > $endB= $finished
ABresult
1X1
011
000
164 10 ▶ die "Unexpected end of piece" unless $outf;
Branch: 1 branch
BranchTrueFalseTotal
unless $outf 0 10 10
165 10 my $cb = $piece_opts{append};
166  
167 my $append =
168 &$cb($f, $piece, $trk, $ttime, $ptime, $out, $frames, $piece_frames,
169 10 ▶ ($Xing and $piece_opts{keep_Xing}), $Xing, \%piece_opts, $outf);
Condition66%2/3
$Xing && $piece_opts{'keep_Xing'}
!ll&&!rl&&r
055
MC/DC50%1/2
$Xing && $piece_opts{'keep_Xing'}
$Xing $piece_opts{'keep_Xing'}
Truth table66%2/3
A && B
A= $XingB= $piece_opts{'keep_Xing'}
ABresult
0X0
100
111
170 10 ▶ print $outf $append or die if length $append;
Branch: 1 branch
BranchTrueFalseTotal
if length $append 0 10 10
Condition25%1/4
length $append && (print($outf $append) || die())
!ll
100
print $outf $append or die
l!l
00
MC/DC0%0/2
length $append && (print($outf $append) || die())
length $append print $outf $append
Truth table33%1/3
A && B
A= length $appendB= print $outf $append
ABresult
0X0
100
111
171  
172 10 ▶ if ($Xing and $piece_opts{keep_Xing} and $piece_opts{update_Xing}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Xing and $piece_opts{"keep_Xing"} and $piece_opts{"update_Xing"}) 5 5 10
Condition66%4/6
$Xing and $piece_opts{"keep_Xing"} and $piece_opts{"update_Xing"}
!ll&&!rl&&r
505
$Xing and $piece_opts{"keep_Xing"}
!ll&&!rl&&r
055
MC/DC33%1/3
$Xing and $piece_opts{"keep_Xing"} and $piece_opts{"update_Xing"}
$Xing $piece_opts{"keep_Xing"} $piece_opts{"update_Xing"}
Truth table50%2/4
A and B and C
A= $XingB= $piece_opts{"keep_Xing"}C= $piece_opts{"update_Xing"}
ABCresult
0XX0
10X0
1100
1111
173 # Print actual header
174 5 my $pos = tell $outf;
175 5 ▶ seek $outf, 0, $Xing_tell or die;
Branch: 1 branch
BranchTrueFalseTotal
seek $outf, 0, $Xing_tell or die 5 0 5
176 5 ▶ push @off, ([$ptime, $piece_frames, $pos]) x (100 - @off)
Branch: 1 branch
BranchTrueFalseTotal
if @off < 100 0 5 5
177 if @off < 100;
178 5 ▶ push @off, [$ptime, $piece_frames, $pos] if $end >= MY_INF;
Branch: 1 branch
BranchTrueFalseTotal
if $end >= "1e+100" 1 4 5
179 5 print $outf _Xing_h($Xing, $Xing_off, $piece_frames,
180 $pos, $ptime, $end, \@off);
181 }
182  
183 10 ▶ close $outf or die "Error closing `$out' for write: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $outf or die "Error closing `${out}' for write: $!" 10 0 10
184 10 $cb = $piece_opts{after_write};
185 &$cb($f, $piece, $trk, $ttime, $ptime, $out, $frames, $piece_frames,
186 10 ▶ ($Xing and $piece_opts{keep_Xing}), $Xing, \%piece_opts);
Condition66%2/3
$Xing && $piece_opts{'keep_Xing'}
!ll&&!rl&&r
055
MC/DC50%1/2
$Xing && $piece_opts{'keep_Xing'}
$Xing $piece_opts{'keep_Xing'}
Truth table66%2/3
A && B
A= $XingB= $piece_opts{'keep_Xing'}
ABresult
0X0
100
111
187 10 undef $outf;
188 die "end of audio file before all the tracks written"
189 10 ▶ if $finished and (@_ or $ttime < $end - $piece_opts{lax});
Branch: 1 branch
BranchTrueFalseTotal
if $finished and @_ || $ttime < $end - $piece_opts{"lax"} 0 10 10
Condition50%3/6
$finished and @_ || $ttime < $end - $piece_opts{"lax"}
!ll&&!rl&&r
820
@_ or $ttime < $end - $piece_opts{"lax"}
l!l&&r!l&&!r
002
MC/DC0%0/3
$finished and @_ || $ttime < $end - $piece_opts{"lax"}
$finished @_ $ttime < $end - $piece_opts{"lax"}
Truth table50%2/4
A and B or C
A= $finishedB= @_C= $ttime < $end - $piece_opts{"lax"}
ABCresult
0XX0
1000
11X1
1011
190 10 ▶ last if $finished;
Branch: 1 branch
BranchTrueFalseTotal
if $finished 2 8 10
191 8 ▶ $piece = shift or last;
Branch: 1 branch
BranchTrueFalseTotal
$piece = shift() or last 8 0 8
192 8 ($start, $end, %piece_opts) = piece_decl $piece, $end, @_;
193 8 %piece_opts = (%opts, %piece_opts);
194 }
195 11002 my $len = $frame->seconds;
196 11002 $ttime += $len;
197 11002 $ptime += $len;
198 11002 $frames++;
199 11002 ▶ next if $frames == 1 and $Xing;
Branch: 1 branch
BranchTrueFalseTotal
if $frames == 1 and $Xing 2 11000 11002
Condition66%2/3
$frames == 1 and $Xing
!ll&&!rl&&r
1100002
MC/DC50%1/2
$frames == 1 and $Xing
$frames == 1 $Xing
Truth table66%2/3
A and B
A= $frames == 1B= $Xing
ABresult
0X0
100
111
200 11000 ▶ next if $ttime < $start; # Does not intersect the next interval
Branch: 1 branch
BranchTrueFalseTotal
if $ttime < $start 164 10836 11000
201  
202 # Need to write this piece
203 10836 ▶ unless ($outf) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($outf) 10 10826 10836
204 10 ($out, $outf) = piece_open($f, $piece, ++$trk, $Xing, \%piece_opts);
205 10 $ptime = $len;
206 10 $piece_frames = $l = 0;
207 10 @off = ();
208 my $prepend =
209 10 &{$piece_opts{prepend}}($trk, $f, $piece, $Xing, \%piece_opts, $out, $outf);
210 10 ▶ print $outf $prepend or die if length $prepend;
Branch: 1 branch
BranchTrueFalseTotal
if length $prepend 0 10 10
Condition25%1/4
length $prepend && (print($outf $prepend) || die())
!ll
100
print $outf $prepend or die
l!l
00
MC/DC0%0/2
length $prepend && (print($outf $prepend) || die())
length $prepend print $outf $prepend
Truth table33%1/3
A && B
A= length $prependB= print $outf $prepend
ABresult
0X0
100
111
211 10 ▶ if ($Xing and $piece_opts{keep_Xing}) { # Print estimated header
Branch: 1 branch
BranchTrueFalseTotal
if ($Xing and $piece_opts{"keep_Xing"}) 5 5 10
Condition66%2/3
$Xing and $piece_opts{"keep_Xing"}
!ll&&!rl&&r
055
MC/DC50%1/2
$Xing and $piece_opts{"keep_Xing"}
$Xing $piece_opts{"keep_Xing"}
Truth table66%2/3
A and B
A= $XingB= $piece_opts{"keep_Xing"}
ABresult
0X0
100
111
212 5 $Xing_tell = tell $outf;
213 5 print $outf _Xing_h($Xing, $Xing_off, ($end - $start)/$frt,
214 ($end - $start)/$frt*$av_fr, 0, 0, \@off);
215 5 $piece_frames++;
216 }
217 printf STDERR " %2d \@ %17s (=%8s) %s\n",
218 10 ▶ $trk, "$start-$end", $end-$start, $out if $piece_opts{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $piece_opts{"verbose"} 10 0 10
219 }
220  
221 # For Xing header
222 10836 ▶ if ($end < MY_INF) {
Branch: 2 branches
BranchTrueFalseTotal
if ($end < 1e+100) { } 5578 5258 10836
elsif ($l * 1.01 <= $piece_frames) { } 777 4481 5258
223 5578 ▶ my $perc = $end > $start ? int($ptime/($end-$start)*100) : -1;
Branch: 1 branch
BranchTrueFalseTotal
$end > $start ? : 5578 0 5578
224 5578 ▶ push @off, ([$ptime, $piece_frames, tell $outf]) x ($perc - @off + 1)
Branch: 1 branch
BranchTrueFalseTotal
if $perc >= @off 466 5112 5578
225 if $perc >= @off;
226 } elsif ($l * 1.01 <= $piece_frames) {
227 777 push @off, [$ptime, $piece_frames, tell $outf];
228 777 $l = $piece_frames;
229 }
230  
231 # Copy frame data.
232 10836 print $outf $frame->asbin;
233 10836 $piece_frames++;
234 }
235 }
236  
237 2 ▶sub mp3split_read ($$;$) {
Subroutine mp3split_read: called CC=8 SCAR=21.6
Pod undocumented
238 2 ▶ my ($file, $datafile, $opts, @p) = (shift, shift, shift || {});
Condition50%1/2
shift() || {}
l!l
20
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
239 2 local(*IN, $_);
240 2 ▶ open IN, "< $datafile" or die "Can't open `$datafile' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
open IN, "< $datafile" or die "Can't open `${datafile}' for read: $!" 2 0 2
241 2 ▶ while (<IN>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline IN)) 10 2 12
242 10 ▶ next if /^\s*($|#)/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*($|#)/ 0 10 10
243 10 ▶ /^\s*(>?[\d.hms:]+)\s+(=?([\d.hms:]+|INF))?\s*($|#)/
Branch: 1 branch
BranchTrueFalseTotal
/^\s*(>?[\d.hms:]+)\s+(=?([\d.hms:]+|INF))?\s*($|#)/ or die "unrecognized line: `${_}'" 10 0 10
244 or die "unrecognized line: `$_'";
245 10 ▶ push @p, [$1, defined $2 ? $2 : 'INF'];
Branch: 1 branch
BranchTrueFalseTotal
defined $2 ? : 8 2 10
246 }
247 2 ▶ close IN or die "Can't close `$datafile' for read: $!";
Branch: 1 branch
BranchTrueFalseTotal
close IN or die "Can't close `${datafile}' for read: $!" 2 0 2
248 2 mp3split($file, $opts, @p);
249 }
250  
251 1 1;
252 __END__
↑ Summary