develooper Front page | perl.perl5.porters | Postings from January 2006

Simplify &IO::Handle::say

Thread Next
From:
Gisle Aas
Date:
January 24, 2006 05:01
Subject:
Simplify &IO::Handle::say
Message ID:
lrzmll7pav.fsf@caliper.activestate.com
Any reason not to do this?

Index: perl/ext/IO/lib/IO/Handle.pm
--- perl/ext/IO/lib/IO/Handle.pm.~1~	Tue Jan 24 13:57:35 2006
+++ perl/ext/IO/lib/IO/Handle.pm	Tue Jan 24 13:57:35 2006
@@ -409,16 +409,10 @@
     printf $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 say {
+    @_ or croak 'usage: $io->say(ARGS)';
+    my $this = shift;
+    print $this @_, "\n";
 }
 
 sub getline {
End of Patch.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About