Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Overriding caller everywhere (BEGIN)

by Sartak (Hermit)
on Aug 07, 2007 at 00:45 UTC ( [id://630933]=note: print w/replies, xml ) Need Help??


in reply to Re: Overriding caller everywhere (BEGIN)
in thread Overriding caller everywhere

Doing it in a BEGIN block does seem to work in this example. But why does the identical glob test work without BEGIN? :)

Replies are listed 'Best First'.
Re^3: Overriding caller everywhere (glob)
by tye (Sage) on Aug 07, 2007 at 01:42 UTC

    Overriding of glob is special-cased. Instead of changing things so that Perl code is compiled to call your replacement routine "directly", the built-in &CORE::glob is still called and it notices (at run-time) the override and calls your replacement routine (and passes an extra argument that provides the context so that your replacement can correctly handle repeated calls made in scalar context). So you can't use CORE::glob("foo") to bypass this override (and you can't change the prototype of glob like you can with other overridden built-ins when using a recent version of Perl).

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://630933]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found