&CORE::write()
authorFather Chrysostomos <sprout@cpan.org>
Tue, 30 Aug 2011 01:24:36 +0000 (18:24 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 30 Aug 2011 01:24:36 +0000 (18:24 -0700)
This commit allows &CORE::write to be called through references and
via ampersand syntax.  No change to pp_enterwrite was necessary, as it
can already handle nulls.

gv.c
t/op/coreamp.t

diff --git a/gv.c b/gv.c
index 4751812..01d00d8 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1364,7 +1364,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
            case KEY_system:
            case KEY_truncate: case KEY_unlink:
            case KEY_unshift:
-           case KEY_values: case KEY_write:
+           case KEY_values:
                ampable = FALSE;
            }
            if (ampable) {
index 9ab153b..2027f41 100644 (file)
@@ -822,6 +822,12 @@ test_proto 'warn';
   lis [&mywarn()], [1], '&warn retval in list context';
 }
 
+test_proto 'write';
+$tests ++;
+eval {&mywrite};
+like $@, qr'^Undefined format "STDOUT" called',
+   "&write without arguments can handle the null";
+
 # This is just a check to make sure we have tested everything.  If we
 # haven’t, then either the sub needs to be tested or the list in
 # gv.c is wrong.