Skip Menu |

This queue is for tickets about the CGI-Ex CPAN distribution.

Report information
The Basics
Id: 121889
Status: new
Priority: 0/
Queue: CGI-Ex

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.44
Fixed in: (no value)



Subject: Tests fail on Perl 5.26.0: Unimplemented: POSIX::tmpnam()
Perl 5.26.0 removed POSIX::tmpnam() and tests fail now: t/2_fill_20_switcharoo.t ........ ok Unimplemented: POSIX::tmpnam(): use File::Temp instead at /usr/lib64/perl5/POSIX.pm line 185. Unimplemented: POSIX::tmpnam() at t/3_conf_00_base.t line 11. BEGIN failed--compilation aborted at t/3_conf_00_base.t line 11. # Looks like your test exited with 255 before it could output anything. t/3_conf_00_base.t .............. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 8/8 subtests A fix is attached.
Subject: CGI-Ex-2.44-Do-not-use-POSIX-tmpnam.patch
From 08e6f1c89b1c1fb8250a08be9db4d3ce869d7fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Thu, 25 May 2017 15:23:15 +0200 Subject: [PATCH] Do not use POSIX::tmpnam() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl 5.26.0 removed POSIX::tmpnam(). Signed-off-by: Petr Písař <ppisar@redhat.com> --- Makefile.PL | 1 + samples/benchmark/bench_conf_readers.pl | 22 +++++++++++----------- samples/benchmark/bench_conf_writers.pl | 9 ++++----- samples/devel/dprof_conf.d | 6 +++--- t/3_conf_00_base.t | 6 +++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 8c9e4e9..d59ff8a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,6 +12,7 @@ WriteMakefile( VERSION_FROM => "lib/CGI/Ex.pm", INSTALLDIRS => 'site', PREREQ_PM => { + 'File::Temp' => '0', 'Template::Alloy' => '1.016', }, diff --git a/samples/benchmark/bench_conf_readers.pl b/samples/benchmark/bench_conf_readers.pl index 845c807..29404e6 100644 --- a/samples/benchmark/bench_conf_readers.pl +++ b/samples/benchmark/bench_conf_readers.pl @@ -4,7 +4,7 @@ use strict; use vars qw($PLACEHOLDER); use Benchmark qw(cmpthese timethese); use CGI::Ex::Conf; -use POSIX qw(tmpnam); +use File::Temp (); $PLACEHOLDER = chr(186).'~'.chr(186); @@ -223,7 +223,7 @@ my $conf = eval $str; my %TESTS = (); ### do perl -my $file = tmpnam(). '.pl'; +my $file = File::Temp->new(SUFFIX => '.pl'); open OUT, ">$file"; print OUT $str; close OUT; @@ -233,7 +233,7 @@ $TESTS{pl} = sub { $files{pl} = $file; ### do a generic conf_write -#my $file2 = tmpnam(). '.g_conf'; +#my $file2 = File::Temp->new(SUFFIX => '.g_conf'); #&generic_conf_write($file2, $conf); #local $CGI::Ex::Conf::EXT_READERS{g_conf} = \&generic_conf_read; #$TESTS{g_conf} = sub { @@ -243,7 +243,7 @@ $files{pl} = $file; if (eval {require JSON}) { - my $_file = tmpnam(). '.json'; + my $_file = File::Temp->new(SUFFIX => '.json'); my $str = JSON::objToJson($conf, {pretty => 1, indent => 2}); open(my $fh, ">$_file"); print $fh $str; @@ -261,7 +261,7 @@ if (eval {require JSON}) { ### load in the rest of the tests that we support if (eval {require Storable}) { - my $_file = tmpnam(). '.sto'; + my $_file = File::Temp->new(SUFFIX => '.sto'); &Storable::store($conf, $_file); $TESTS{sto} = sub { my $hash = $cob->read_ref($_file); @@ -270,7 +270,7 @@ if (eval {require Storable}) { } if (eval {require Storable}) { - my $_file = tmpnam(). '.sto2'; + my $_file = File::Temp->new(SUFFIX => '.sto2'); &Storable::store($conf, $_file); $TESTS{sto2} = sub { my $hash = &Storable::retrieve($_file); @@ -279,7 +279,7 @@ if (eval {require Storable}) { } if (eval {require YAML}) { - my $_file = tmpnam(). '.yaml'; + my $_file = File::Temp->new(SUFFIX => '.yaml'); &YAML::DumpFile($_file, $conf); $TESTS{yaml} = sub { my $hash = $cob->read_ref($_file); @@ -288,7 +288,7 @@ if (eval {require YAML}) { } if (eval {require YAML}) { - my $_file = tmpnam(). '.yaml2'; + my $_file = File::Temp->new(SUFFIX => '.yaml2'); &YAML::DumpFile($_file, $conf); $TESTS{yaml2} = sub { my $hash = &YAML::LoadFile($_file); @@ -297,7 +297,7 @@ if (eval {require YAML}) { } if (eval {require YAML}) { - my $_file = tmpnam(). '.yaml'; + my $_file = File::Temp->new(SUFFIX => '.yaml'); &YAML::DumpFile($_file, $conf); $cob->preload_files($_file); $TESTS{yaml3} = sub { @@ -307,7 +307,7 @@ if (eval {require YAML}) { } if (eval {require Config::IniHash}) { - my $_file = tmpnam(). '.ini'; + my $_file = File::Temp->new(SUFFIX => '.ini'); &Config::IniHash::WriteINI($_file, $conf); $TESTS{ini} = sub { local $^W = 0; @@ -317,7 +317,7 @@ if (eval {require Config::IniHash}) { } if (eval {require XML::Simple}) { - my $_file = tmpnam(). '.xml'; + my $_file = File::Temp->new(SUFFIX => '.xml'); my $xml = XML::Simple->new->XMLout($conf); open OUT, ">$_file" || die $!; print OUT $xml; diff --git a/samples/benchmark/bench_conf_writers.pl b/samples/benchmark/bench_conf_writers.pl index 37b1070..6ecdb40 100644 --- a/samples/benchmark/bench_conf_writers.pl +++ b/samples/benchmark/bench_conf_writers.pl @@ -4,7 +4,7 @@ use strict; use vars qw($PLACEHOLDER); use Benchmark qw(cmpthese timethese); use CGI::Ex::Conf; -use POSIX qw(tmpnam); +use File::Temp (); $PLACEHOLDER = chr(186).'~'.chr(186); @@ -75,8 +75,8 @@ my $conf = eval $str; my %TESTS = (); ### do perl -my $dir = tmpnam; -mkdir $dir, 0755; +my $dir = File::Temp->newdir(); +chmod 0755, $dir; my $tmpnam = "$dir/bench"; my $file = $tmpnam. '.pl'; $TESTS{pl} = sub { @@ -95,7 +95,7 @@ $files{g_conf} = $file2; ### load in the rest of the tests that we support if (eval {require JSON}) { - my $_file = tmpnam(). '.json'; + my $_file = $tmpnam. '.json'; $TESTS{json} = sub { $cob->write_ref($file, $str); }; @@ -169,7 +169,6 @@ cmpthese timethese ($n, \%TESTS); ### comment out this line to inspect files unlink $_ foreach values %files; -rmdir $dir; ###----------------------------------------------------------------### diff --git a/samples/devel/dprof_conf.d b/samples/devel/dprof_conf.d index a99369c..dd5cf6b 100644 --- a/samples/devel/dprof_conf.d +++ b/samples/devel/dprof_conf.d @@ -2,12 +2,12 @@ # run with perl -d:DProf $0 use CGI::Ex::Conf qw(conf_read conf_write); -use POSIX qw(tmpnam); +use File::Temp (); use Data::Dumper qw(Dumper); #my $cob = CGI::Ex::Conf->new; -my $tmp = tmpnam .".sto"; -END { unlink $tmp }; +my $tmp_obj = File::Temp->new(SUFFIX => ".sto"); +my $tmp = $tmp_obj->filename; my $conf = { one => 1, diff --git a/t/3_conf_00_base.t b/t/3_conf_00_base.t index e41d897..f3146da 100644 --- a/t/3_conf_00_base.t +++ b/t/3_conf_00_base.t @@ -8,10 +8,10 @@ use strict; use Test::More tests => 8; -use POSIX qw(tmpnam); +use File::Temp (); -my $file = tmpnam; -END { unlink $file }; +my $fileobject = File::Temp->new; +my $file = $fileobject->filename; use_ok('CGI::Ex::Conf'); -- 2.9.4