From: Don Armstrong Date: Tue, 6 Mar 2012 23:39:26 +0000 (+0000) Subject: * check for defined-ness of $a and $b X-Git-Url: https://git.donarmstrong.com/?p=bin.git;a=commitdiff_plain;h=a526e6136c5c3d16327325dd05d7839149bccad1 * check for defined-ness of $a and $b --- diff --git a/rip_movie b/rip_movie index 680e8bb..207df80 100755 --- a/rip_movie +++ b/rip_movie @@ -108,8 +108,6 @@ die "no title" if not defined $title; my $filename = lc($title); $filename =~ s/[\s_-]+/_/; -use Data::Dumper; - my @titles; for my $title_bit ($result =~ /\n(\+ title \d+:.+?)(?=\n\+ title\s+|$)/gs) { my %title; @@ -118,7 +116,7 @@ for my $title_bit ($result =~ /\n(\+ title \d+:.+?)(?=\n\+ title\s+|$)/gs) { $title{num} = $1; my ($duration) = $title_bit =~ /^\s+\+\s+duration:\s+([\d:]+)$/m; # HH:MM:SS, so (HH*60 + MM) * 60 + SS - $duration = reduce {$a * 60 + $b } split /:/, $duration; + $duration = reduce {defined $a and defined $b ? $a * 60 + $b : undef } split /:/, $duration; $title{duration} = $duration; # figure out audio tracks $title_bit =~ /(?\s+)\+\s+audio\s+tracks:\n # audio track header