Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: CORE::stat() doesn't appear to be the same as stat

by ikegami (Patriarch)
on Sep 10, 2018 at 22:50 UTC ( [id://1222103]=note: print w/replies, xml ) Need Help??


in reply to SOLVED: CORE::stat() doesn't appear to be the same as stat

You get two difference addresses because you take create references to two different subs, &main::stat and &CORE::stat.


First, you take the address of &main::stat. It's never defined.

$ perl -e'my $sub = \&stat; $sub->("a")' Undefined subroutine &main::stat called at -e line 1.

Then, you take the address of &CORE::stat twice. The subs in CORE:: are automatically-generated wrappers for the operators of the same name, so you get a wrapper to the stat operator.

$ perl -e'my $sub = \&CORE::stat; $sub->("a")' &CORE::stat cannot be called directly at -e line 1.

Well, it would be if stat had a calling convention that could be duplicated by subroutine prototypes. Instead, it's a wrapper for an error message.

Log In?
Username:
Password:

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

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

    No recent polls found