I think I sent you the exact same one-line patch last week, so yes, that
should work. :-)
Show quoted text> -*IO::Handle::say = \&say;
> +*IO::Handle::say = \&say if ! defined &IO::Handle::say;
Note that you must make sure that Perl6::Say continues to load
IO::Handle, so that its say() will already be loaded if it exists.
There's also no guarantee that the semantics of IO::Handle::say and
Perl6::say will be exactly the same, so you might want to add a
documentation note that to that effect. Perl6::Say seems to do a bunch
of warning fiddling that IO::Handle doesn't.
For example, this code has warnings forced on:
Show quoted text> #!perl -W
> use Perl6::Say;
> use IO::Handle;
> use strict;
>
> my $handle = IO::Handle->new_from_fd(fileno(STDOUT),"w")
> or die "Couldn't make a handle";
>
> say "IO::Handle::say is ", \&IO::Handle::say;
> say "Perl6::Say::say is ", \&Perl6::Say::say;
> say;
> say "Perl6::Say says hello";
> $handle->say("IO::Handle says hello");
> say;
> say "Perl6::Say saying undef:";
> say undef;
> say "IO::Handle::say saying undef:";
> $handle->say(undef);
And it prints:
Show quoted text> IO::Handle::say is CODE(0x9f9810)
> Perl6::Say::say is CODE(0x9a40e4)
>
> Perl6::Say says hello
> IO::Handle says hello
>
> Perl6::Say saying undef:
>
> IO::Handle::say saying undef:
> Use of uninitialized value in print at C:/perl/perl/site/lib/IO/Handle.pm line 415.
>