From a4a0c83a99401ba748ae8e70855ace636f611311 Mon Sep 17 00:00:00 2001
From: Nick Morrott <knowledgejunkie@gmail.com>
Date: Mon, 6 Mar 2017 12:55:16 +0000
Subject: [PATCH] Allow building on Perl versions 5.24.1+

Perl versions 5.24.1+ no longer include '.' in @INC. However, we need
access to XMLTV::Ask::Term at configuration time, so provide relative path
to this library.
---
 Makefile.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index f43f69a5..86d59e2a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -251,7 +251,7 @@ elsif ($opt_default) {
     *ask = sub { print "$_[0] $_[2]\n"; $_[2] };
 }
 else {
-    require 'lib/Ask/Term.pm';
+    require './lib/Ask/Term.pm';
     *ask = \&XMLTV::Ask::Term::ask_boolean;
 }
 
From 8930f8f281427e261667265969d88b778bb2f2c9 Mon Sep 17 00:00:00 2001
From: Nick Morrott <knowledgejunkie@gmail.com>
Date: Sat, 15 Jul 2017 21:25:33 +0000
Subject: [PATCH] Fix build failures in Perl 5.26+ caused by 'use POSIX
 'tmpnam'

POSIX 'tmpnam' was deprecated in Perl 5.24 and removed in Perl 5.26, and is
actually unused in the code.
---
 filter/tv_to_latex | 1 -
 filter/tv_to_text  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/filter/tv_to_latex b/filter/tv_to_latex
index 32db73a8..0cf02fed 100755
--- a/filter/tv_to_latex
+++ b/filter/tv_to_latex
@@ -37,7 +37,6 @@ spurious blank lines in the output.
 use strict;
 use XMLTV::Version '$Id$ ';
 use IO::File;
-use POSIX 'tmpnam';
 use Getopt::Long;
 
 # Use Log::TraceMessages if installed.
diff --git a/filter/tv_to_text b/filter/tv_to_text
index 648cacfb..762067b6 100755
--- a/filter/tv_to_text
+++ b/filter/tv_to_text
@@ -34,7 +34,6 @@ use warnings;
 use XMLTV::Version '$Id$ ';
 use IO::File;
 use Date::Manip;
-use POSIX 'tmpnam';
 use Getopt::Long;
 
 BEGIN {
 From d2f2537b41e740c20b93db169697c3e3e3c42286 Mon Sep 17 00:00:00 2001
From: Nick Morrott <knowledgejunkie@gmail.com>
Date: Fri, 24 Feb 2017 22:35:58 +0000
Subject: [PATCH] Allow building on Perl versions 5.24.1+

Perl versions 5.24.1+ no longer include '.' in @INC. However, we need
access to some libraries included in the XMLTV source at build time so
"use lib '.'" for these specific instances.
---
 filter/tv_grep.PL     | 3 +++
 grab/it/tv_grab_it.PL | 4 ++++
 lib/XMLTV.pm.PL       | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/filter/tv_grep.PL b/filter/tv_grep.PL
index a0c0c28d..48fa17f2 100644
--- a/filter/tv_grep.PL
+++ b/filter/tv_grep.PL
@@ -12,6 +12,9 @@
 
 use IO::File;
 use XMLTV;
+
+# Perl 5.24.1+ does not include '.' in @INC but we need some libs during build
+use lib '.';
 require 'filter/Grep.pm';
 
 my $out = shift @ARGV; die "no output file given" if not defined $out;
diff --git a/grab/it/tv_grab_it.PL b/grab/it/tv_grab_it.PL
index 5ebbd886..546c1693 100644
--- a/grab/it/tv_grab_it.PL
+++ b/grab/it/tv_grab_it.PL
@@ -354,7 +354,11 @@ close IN_FH or die "cannot close $in: $!";
 
 # stuff for setting share dir
 die "usage: $_ output_file share_dir" if @ARGV != 2;
+
+# Perl 5.24.1+ does not include '.' in @INC but we need some libs during build
+use lib '.';
 require 'lib/set_share_dir.pl';
+
 #warn "faccio $ARGV[0] $ARGV[1]\n";
 #set_share_dir('grab/it/tv_grab_it.in2', $ARGV[0], $ARGV[1]);
 copy( 'grab/it/tv_grab_it.in2', $ARGV[0] );
diff --git a/lib/XMLTV.pm.PL b/lib/XMLTV.pm.PL
index f64c2146..c525bc26 100644
--- a/lib/XMLTV.pm.PL
+++ b/lib/XMLTV.pm.PL
@@ -9,7 +9,11 @@ sub print_list( $$ );
 
 my $out = shift @ARGV; die "no output file given" if not defined $out;
 my $in = 'lib/XMLTV.pm.in';
+
+# Perl 5.24.1+ does not include '.' in @INC but we need some libs during build
+use lib '.';
 require $in;
+
 open(IN_FH, $in) or die "cannot read $in: $!";
 die if not @XMLTV::Channel_Handlers; die if not @XMLTV::Programme_Handlers;
 
