This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Attempt at making IO::Handle backwards compatible again
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 19 Dec 2005 18:43:04 +0000 (18:43 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 19 Dec 2005 18:43:04 +0000 (18:43 +0000)
p4raw-id: //depot/perl@26405

ext/IO/lib/IO/Handle.pm

index 551988b..e3b3f7f 100644 (file)
@@ -409,11 +409,16 @@ sub printf {
     printf $this @_;
 }
 
-sub say {
-    @_ or croak 'usage: $io->say(ARGS)';
-    my $this = shift;
-    use feature 'say';
-    say $this @_;
+if ($] >= 5.009003) {
+    *say = eval q{ sub {
+       @_ or croak 'usage: $io->say(ARGS)';
+       my $this = shift;
+       use feature 'say';
+       say $this @_;
+    }};
+}
+else {
+    *say = sub { croak "say() is not implemented for this version of perl\n" };
 }
 
 sub getline {