If you define two C<say> functions, one in IO::Handle, perl just copes!
I've added C<"Using ", __PACKAGE__, ": ", > just to see what is happening.

Robin 

% cat Perl6/Say.pm
package Perl6::Say;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(say);

sub say {
    local $\ = defined $\ ? $\ : "\n";
    print "Using ", __PACKAGE__, ": ", @_;
}

package IO::Handle;

sub say {
    my $self = shift;
    local $\ = defined $\ ? $\ : "\n";
    print {$self} "Using ", __PACKAGE__, ": ", @_;
} 
     
1;

% perl -MPerl6::Say -we 'say  "Hello World"; say STDERR "Warning"' 
Using Perl6::Say: Hello World
Using IO::Handle: Warning

-----Original Message-----
From: Rafael Garcia-Suarez [mailto:[EMAIL PROTECTED]
Sent: 10 March 2005 12:38
To: Nicholas Clark
Cc: Nigel Sandever; perl5-porters@perl.org
Subject: Re: [PATCH] to provide a Perl6-style 'say' keyword.


Nicholas Clark wrote:
> I wonder how hard it would be to fix the limitation in the perl core noted
> in Perl6::Say:
> 
> http://search.cpan.org/~dconway/Perl6-Say-0.02/Say.pm#BUGS_AND_IRRITATIONS

Quite hard, I expect. The indirect object notation is already the origin
of lots of special cases in the lexer.

-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------

Reply via email to