JupiterHost.Net wrote:
> 
>>> For an Acme module I'm trying to make an alternative to print, but can;t
>>> get goto to work with print:
>>>
>>> I'd like this:
>>>
>>> perl -mstrict -wle 'sub x {goto &print} x("hi");'
>>>
>>> to work like this:
>>>
>>> perl -mstrict -MCarp -wle 'sub x {goto &Carp::croak } x("hi");'
>>>
>>> I'm sure I'm missing a simple namespace issue but main:: and UNIVERSAL::
>>> aren't it and I can't seem to find it documented.
>>>
>>> Any ideas what I'm missing?
>>
>>
>> Read the section "Overriding Built-in Functions" in perlsub.
>>
>> perldoc perlsub
> 
> Good info John, I don;t want to change print() calls though I want to
> make foo() act just like print, the trick is getting print()s to
> Filehandles
> 
> fake_print "wee";
> is easy *but*
> fake_print STDERR "wee";
> 
> :) Its been an interesting mental exercise.

If you read the last sentence of the "Overriding Built-in Functions" section
you'll see it says"

       Finally, some built-ins (e.g. "exists" or "grep") can't be overridden.

How do you determine which built-ins cannot be overridden?  Built-ins that do
not have a prototype cannot be overridden.  How do you determine which
built-ins have a prototype?

$ perl -le 'print prototype "CORE::exists"'

$ perl -le 'print prototype "CORE::grep"'

$ perl -le 'print prototype "CORE::print"'

$ perl -le 'print prototype "CORE::split"'

$ perl -le 'print prototype "CORE::substr"'
$$;$$
$ perl -le 'print prototype "CORE::splice"'
\@;$$@
$ perl -le 'print prototype "CORE::index"'
$$;$
$ perl -le 'print prototype "CORE::open"'
*;$@



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to