From a526e6136c5c3d16327325dd05d7839149bccad1 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Tue, 6 Mar 2012 23:39:26 +0000 Subject: [PATCH] * check for defined-ness of $a and $b --- rip_movie | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 -- 2.39.5