Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DB_File CPAN distribution.

Report information
The Basics
Id:
66339
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
IKEGAMI [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
1.822



Subject: Keep DB_File's warnings in sync with perl's
Hi, There is a patch pending to Perl to silence the warning splice(@a, $n) emits when $n<@a. [perl RT#78462]. DB_File goes to great effort to match Perl, including its warnings. Attached is a patch that will cause DB_File to match Perl's warnings even after this patch goes live. The attached patch maintains DB_File's behaviour on older versions of Perl. Thanks, Eric "ikegami" Brine
Subject: diff.patch
diff -ru DB_File-1.821_orig/DB_File.pm DB_File-1.821_edit/DB_File.pm --- DB_File-1.821_orig/DB_File.pm 2011-01-10 04:38:57.000000000 -0500 +++ DB_File-1.821_edit/DB_File.pm 2011-03-02 17:01:56.000000000 -0500 @@ -161,7 +161,7 @@ use warnings; use strict; our ($VERSION, @ISA, @EXPORT, $AUTOLOAD, $DB_BTREE, $DB_HASH, $DB_RECNO); -our ($db_version, $use_XSLoader, $splice_end_array, $Error); +our ($db_version, $use_XSLoader, $splice_end_array_no_length, $splice_end_array, $Error); use Carp; @@ -169,8 +169,14 @@ $VERSION = eval $VERSION; # needed for dev releases { - local $SIG{__WARN__} = sub {$splice_end_array = "@_";}; + local $SIG{__WARN__} = sub {$splice_end_array_no_length = "@_";}; my @a =(1); splice(@a, 3); + $splice_end_array_no_length = + ($splice_end_array_no_length =~ /^splice\(\) offset past end of array at /); +} +{ + local $SIG{__WARN__} = sub {$splice_end_array = "@_";}; + my @a =(1); splice(@a, 3, 1); $splice_end_array = ($splice_end_array =~ /^splice\(\) offset past end of array at /); } @@ -342,6 +348,7 @@ $offset = 0; } + my $has_length = @_; my $length = @_ ? shift : 0; # Carping about definedness comes _after_ the OFFSET sanity check. # This is so we get the same error messages as Perl's splice(). @@ -371,7 +378,7 @@ if ($offset > $size) { $offset = $size; warnings::warnif('misc', 'splice() offset past end of array') - if $splice_end_array; + if $has_length ? $splice_end_array : $splice_end_array_no_length; } # 'If LENGTH is omitted, removes everything from OFFSET onward.'
Thanks - applied. Paul


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.