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