Check for definedness, before trying to manipulate. In the second
section, the s/// modifies the $prev/$next variables, so we can do it a simpler
way.
Patch by kareila.
diffs (18 lines):
diff -r 7474d8f1cc7e -r 5c788c49952f cgi-bin/LJ/S2/DayPage.pm
--- a/cgi-bin/LJ/S2/DayPage.pm Tue Dec 28 20:58:23 2010 +0800
+++ b/cgi-bin/LJ/S2/DayPage.pm Tue Dec 28 21:05:03 2010 +0800
@@ -152,10 +152,12 @@ sub DayPage
}
# create Date objects for ($prev, $next) pair
- my ($pdate, $ndate) = map { /^(\d\d\d\d)(\d\d)(\d\d)\b/ ? Date($1, $2, $3)
: Null('Date') } ($prev, $next);
+ my ( $pdate, $ndate ) = map { defined $_ && /^(\d\d\d\d)(\d\d)(\d\d)\b/
+ ? Date( $1, $2, $3 ) : Null( 'Date' ) }
+ ( $prev, $next );
# insert slashes into $prev and $next
- ($prev, $next) = map { s!^(\d\d\d\d)(\d\d)(\d\d)\b!$1/$2/$3!; $_ }
($prev, $next);
+ map { defined $_ && s!^(\d\d\d\d)(\d\d)(\d\d)\b!$1/$2/$3! } ( $prev, $next
);
$p->{'prev_url'} = defined $prev ? ("$u->{'_journalbase'}/$prev") : '';
$p->{'prev_date'} = $pdate;
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog