Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 183bb4af7ad862a2cf31d0dcb3dd45c100f76776 Mon Sep 17 00:00:00 2001 |
| 2 | From: Russ Allbery <rra@cpan.org> |
| 3 | Date: Wed, 15 Apr 2015 22:21:25 -0700 |
| 4 | Subject: Support an empty POD_MAN_DATE environment variable |
| 5 | |
| 6 | One may want to set this to an empty string. Handle that correctly. |
| 7 | |
| 8 | (backported to Perl 5.20.2 by Niko Tyni <ntyni@debian.org>) |
| 9 | |
| 10 | Origin: upstream, http://git.eyrie.org/?p=perl/podlators.git;a=commitdiff;h=e0e9fcb53e8fc954b2b1955385eea18c27f869af |
| 11 | Bug-Debian: https://bugs.debian.org/780259 |
| 12 | Patch-Name: fixes/podman-empty-date.diff |
| 13 | --- |
| 14 | cpan/podlators/lib/Pod/Man.pm | 2 +- |
| 15 | cpan/podlators/t/devise-date.t | 6 +++++- |
| 16 | 2 files changed, 6 insertions(+), 2 deletions(-) |
| 17 | |
| 18 | diff --git a/cpan/podlators/lib/Pod/Man.pm b/cpan/podlators/lib/Pod/Man.pm |
| 19 | index 365892e..8997a15 100644 |
| 20 | --- a/cpan/podlators/lib/Pod/Man.pm |
| 21 | +++ b/cpan/podlators/lib/Pod/Man.pm |
| 22 | @@ -894,7 +894,7 @@ sub devise_date { |
| 23 | my ($self) = @_; |
| 24 | |
| 25 | # If POD_MAN_DATE is set, always use it. |
| 26 | - if ($ENV{POD_MAN_DATE}) { |
| 27 | + if (defined($ENV{POD_MAN_DATE})) { |
| 28 | return $ENV{POD_MAN_DATE}; |
| 29 | } |
| 30 | |
| 31 | diff --git a/cpan/podlators/t/devise-date.t b/cpan/podlators/t/devise-date.t |
| 32 | index 9da9d1b..27271d9 100644 |
| 33 | --- a/cpan/podlators/t/devise-date.t |
| 34 | +++ b/cpan/podlators/t/devise-date.t |
| 35 | @@ -12,7 +12,7 @@ use warnings; |
| 36 | use Pod::Man; |
| 37 | use POSIX qw(strftime); |
| 38 | |
| 39 | -use Test::More tests => 2; |
| 40 | +use Test::More tests => 3; |
| 41 | |
| 42 | # Check that the results of device_date matches strftime. There is no input |
| 43 | # file name, so this will use the current time. |
| 44 | @@ -26,3 +26,7 @@ is( |
| 45 | # Set the override environment variable and ensure that it's honored. |
| 46 | local $ENV{POD_MAN_DATE} = '2014-01-01'; |
| 47 | is($parser->devise_date, '2014-01-01', 'devise_date honors POD_MAN_DATE'); |
| 48 | + |
| 49 | +# Check that an empty environment variable is honored. |
| 50 | +local $ENV{POD_MAN_DATE} = q{}; |
| 51 | +is($parser->devise_date, q{}, 'devise_date honors empty POD_MAN_DATE'); |