summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-05 20:41:08 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-05 20:41:08 -0800
commit480e0d3cb5dd65d869513ab5419347ef0d1c9763 (patch)
treeeaf69ff298b79f67aaaf6c6db2c8bf924bdae6b8
parent2d6af230240aae1d02f582eba1539698bbf90f4a (diff)
downloadperl-480e0d3cb5dd65d869513ab5419347ef0d1c9763.tar.gz
[perl #90064] warn once for dbmopen with undef 3rd arg
-rw-r--r--pp_sys.c3
-rw-r--r--t/op/dbm.t9
2 files changed, 11 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c7212b3f32..71c5ca741d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1017,7 +1017,10 @@ PP(pp_dbmopen)
if (SvIV(right))
mPUSHu(O_RDWR|O_CREAT);
else
+ {
mPUSHu(O_RDWR);
+ if (!SvOK(right)) right = &PL_sv_no;
+ }
PUSHs(right);
PUTBACK;
call_sv(MUTABLE_SV(GvCV(gv)), G_SCALAR);
diff --git a/t/op/dbm.t b/t/op/dbm.t
index c9add50140..9e81f590ed 100644
--- a/t/op/dbm.t
+++ b/t/op/dbm.t
@@ -9,7 +9,7 @@ BEGIN {
skip_all("No dbm functions") if $@;
}
-plan tests => 4;
+plan tests => 5;
# This is [20020104.007] "coredump on dbmclose"
@@ -58,3 +58,10 @@ fresh_perl_like($prog, qr/No dbm on this machine/, {},
fresh_perl_like('delete $::{"AnyDBM_File::"}; ' . $prog,
qr/No dbm on this machine/, {},
'implicit require and no stash fails');
+
+{ # undef 3rd arg
+ local $^W = 1;
+ local $SIG{__WARN__} = sub { ++$w };
+ dbmopen(%truffe, 'pleaseletthisfilenotexist', undef);
+ is $w, 1, '1 warning from dbmopen with undef third arg';
+}