From: Joey Hess Date: Wed, 20 Oct 2010 22:52:46 +0000 (-0400) Subject: avoid perl warning when passed bad non-numeric year/month/day X-Git-Tag: 3.20101023~15 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/4a75dee651390b79ce4ceb1d951b02e28b3ce83a?ds=inline avoid perl warning when passed bad non-numeric year/month/day --- diff --git a/IkiWiki.pm b/IkiWiki.pm index 2190f008c..941ee13c4 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2608,6 +2608,10 @@ sub match_created_after ($$;@) { } sub match_creation_day ($$;@) { + my $d=shift; + if ($d !~ /^\d+$/) { + return IkiWiki::FailReason->new('invalid day'); + } if ((localtime($IkiWiki::pagectime{shift()}))[3] == shift) { return IkiWiki::SuccessReason->new('creation_day matched'); } @@ -2617,6 +2621,10 @@ sub match_creation_day ($$;@) { } sub match_creation_month ($$;@) { + my $m=shift; + if ($m !~ /^\d+$/) { + return IkiWiki::FailReason->new('invalid month'); + } if ((localtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) { return IkiWiki::SuccessReason->new('creation_month matched'); } @@ -2626,7 +2634,11 @@ sub match_creation_month ($$;@) { } sub match_creation_year ($$;@) { - if ((localtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) { + my $y=shift; + if ($y !~ /^\d+$/) { + return IkiWiki::FailReason->new('invalid year'); + } + if ((localtime($IkiWiki::pagectime{shift()}))[5] + 1900 == $y) { return IkiWiki::SuccessReason->new('creation_year matched'); } else {