diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-31 13:34:30 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-31 13:34:30 +0000 |
commit | e3f73d4edc1b72464d0a94ac202f6e1bd3daf149 (patch) | |
tree | 5947c9158793dbe9f01db803f5805d72f94c9194 /t/op | |
parent | 37d6a98efde87369fe8fb6be5f8afc79f775460c (diff) | |
download | perl-e3f73d4edc1b72464d0a94ac202f6e1bd3daf149.tar.gz |
Make readpipe() overridable (and also `` and qx//)
p4raw-id: //depot/perl@29168
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/cproto.t | 2 | ||||
-rwxr-xr-x | t/op/override.t | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/t/op/cproto.t b/t/op/cproto.t index 1b9cf4af95..89bd555b24 100644 --- a/t/op/cproto.t +++ b/t/op/cproto.t @@ -174,7 +174,7 @@ read (*\$$;$) readdir (*) readline (;*) readlink (_) -readpipe unknown +readpipe ($) recv (*\$$$) redo undef ref (_) diff --git a/t/op/override.t b/t/op/override.t index 9cbd57370b..60d772b6c9 100755 --- a/t/op/override.t +++ b/t/op/override.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 22; +plan tests => 26; # # This file tries to test builtin override using CORE::GLOBAL @@ -80,6 +80,19 @@ BEGIN { *Rgs::readline = sub (;*) { --$r }; } ::is( <$pad_fh> , 11 ); } +# Global readpipe() override +BEGIN { *CORE::GLOBAL::readpipe = sub ($) { "$_[0] " . --$r }; } +is( `rm`, "rm 10", '``' ); +is( qx/cp/, "cp 9", 'qx' ); + +# Non-global readpipe() override +BEGIN { *Rgs::readpipe = sub ($) { ++$r . " $_[0]" }; } +{ + package Rgs; + ::is( `rm`, "10 rm", '``' ); + ::is( qx/cp/, "11 cp", 'qx' ); +} + # Verify that the parsing of overriden keywords isn't messed up # by the indirect object notation { |