diff options
author | gueux <gueux@gueux.org> | 2010-04-06 14:41:20 +0000 |
---|---|---|
committer | gueux <gueux@gueux.org> | 2010-04-06 14:41:20 +0000 |
commit | c73ab2f60c8c8777085f4db463c6f43968c87b39 (patch) | |
tree | 8d7a752f740f2e9f235789313cf3f85236b76c59 | |
parent | dcb513923ec7f4c853d926dfeab62374e124b1ea (diff) |
DATE ISO8601 format error
-rw-r--r-- | DateTime-Format-ISO8601-ParseDateTag/lib/DateTime/Format/ISO8601/ParseDateTag.pm | 3 | ||||
-rw-r--r-- | flacinfo | 8 | ||||
-rw-r--r-- | test/parse-date-test.pl | 8 |
3 files changed, 10 insertions, 9 deletions
diff --git a/DateTime-Format-ISO8601-ParseDateTag/lib/DateTime/Format/ISO8601/ParseDateTag.pm b/DateTime-Format-ISO8601-ParseDateTag/lib/DateTime/Format/ISO8601/ParseDateTag.pm index 0cbbf74..8543f3f 100644 --- a/DateTime-Format-ISO8601-ParseDateTag/lib/DateTime/Format/ISO8601/ParseDateTag.pm +++ b/DateTime-Format-ISO8601-ParseDateTag/lib/DateTime/Format/ISO8601/ParseDateTag.pm @@ -113,6 +113,9 @@ sub parse { else { return "Released $tmp"; }; + } + else { + die "Error: \"$_[0]\" is not a date in ISO8601 format." }; } @@ -4,7 +4,7 @@ use strict; use warnings; use Audio::Scan; use DateTime::Format::ISO8601::ParseDateTag; -#use Lingua::EN::Numbers::Ordinate; +use Error qw(:try); if ($#ARGV == -1) { exit 0 @@ -154,12 +154,14 @@ default("PRODUCER", "Producer"); if (defined $tags->{ "DATE" }) { my $dateparser = DateTime::Format::ISO8601::ParseDateTag->new; if ( ref($tags->{ "DATE" }) ne 'ARRAY' ) { - print $dateparser->parse($tags->{ "DATE" }) . "\n"; + try { print $dateparser->parse($tags->{ "DATE" }) . "\n"; } + catch Error with { print "$@" }; } else { my $array = $tags->{ "DATE" }; foreach my $var (@$array) { - print $dateparser->parse($var) . "\n"; + try { print $dateparser->parse($var) . "\n"; } + catch Error with { print "$@" }; }; }; } diff --git a/test/parse-date-test.pl b/test/parse-date-test.pl index efc9996..a161016 100644 --- a/test/parse-date-test.pl +++ b/test/parse-date-test.pl @@ -25,12 +25,8 @@ my @test = ( foreach my $t (@test) { print $t . " ### "; - try { - print $parser->parse($t) . "\n"; - } - catch Error with { - print "Error: $@" - }; + try { print $parser->parse($t) . "\n"; } + catch Error with { print "Error: $@" }; } ## incorrect |