Skip Menu |

This queue is for tickets about the Directory-Queue CPAN distribution.

Report information
The Basics
Id: 124995
Status: resolved
Priority: 0/
Queue: Directory-Queue

People
Owner: LCONS [...] cpan.org
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.9
Fixed in: 2.0



Subject: Deprecated warnings in newer perls
Hi, We're getting this deprecated warning in perl 5.26 warn [Internal Warning while parsing unknown 16193] syswrite() is deprecated on :utf8 handles. This will be a fatal error in Perl 5.30 at perl/526/lib64/perl5/cpanel_lib/Directory/Queue.pm line 268. Patch to fix this will be coming soon.
Suggested fix.
Subject: dq.patch.txt
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Todd Rinaldo <toddr@cpan.org> Date: Mon, 2 Apr 2018 12:33:31 -0500 Subject: [PATCH] Address deprecated warnings in Directory::Queue --- modules/Directory-Queue/Directory-Queue/Makefile.PL | 1 + .../Directory-Queue/lib/Directory/Queue.pm | 21 ++++++--------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 5f96bacfe..bc1a19366 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -23,6 +23,7 @@ my(%param, $emv, $name); 'No::Worries' => '1.1', 'POSIX' => 0, 'Time::HiRes' => 0, + 'File::Slurper' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' }, clean => { FILES => 'Directory-Queue-*' }, diff --git a/lib/Directory/Queue.pm b/lib/Directory/Queue.pm index ebc6546e6..d120a779e 100644 --- a/lib/Directory/Queue.pm +++ b/lib/Directory/Queue.pm @@ -20,6 +20,7 @@ our $REVISION = sprintf("%d.%02d", q$Revision: 1.50 $ =~ /(\d+)\.(\d+)/); # used modules # +use File::Slurper qw(write_text write_binary); use No::Worries::Die qw(dief); use No::Worries::Export qw(export_control); use No::Worries::Stat qw(ST_DEV ST_INO ST_NLINK ST_SIZE ST_MTIME); @@ -208,7 +209,7 @@ sub _file_read_utf8 ($) { $data = ""; $done = -1; while ($done) { - $done = sysread($fh, $data, SYSBUFSIZE, length($data)); + $done = read($fh, $data, SYSBUFSIZE, length($data)); dief("cannot sysread(%s): %s", $path, $!) unless defined($done); } close($fh) or dief("cannot close(%s): %s", $path, $!); @@ -252,25 +253,15 @@ sub _file_create ($$;$) { sub _file_write ($$$$) { my($path, $utf8, $umask, $dataref) = @_; - my($fh, $length, $offset, $done); + my($fh); $fh = _file_create($path, $umask, "strict"); + close($fh) or dief("cannot close(%s): %s", $path, $!); if ($utf8) { - binmode($fh, ":encoding(utf8)") - or dief("cannot binmode(%s, :encoding(utf8)): %s", $path, $!); + write_text($path, ${$dataref}); } else { - binmode($fh) - or dief("cannot binmode(%s): %s", $path, $!); - } - $length = length(${ $dataref }); - $offset = 0; - while ($length) { - $done = syswrite($fh, ${ $dataref }, SYSBUFSIZE, $offset); - dief("cannot syswrite(%s): %s", $path, $!) unless defined($done); - $length -= $done; - $offset += $done; + write_binary($path, ${$dataref}); } - close($fh) or dief("cannot close(%s): %s", $path, $!); } #
Thanks for reporting this bug. I've released a new version (2.0) that should fix this problem. Could you please test?
On Wed Apr 11 03:11:50 2018, LCONS wrote: Show quoted text
> Thanks for reporting this bug. > > I've released a new version (2.0) that should fix this problem. Could > you please test?
Looks good!