Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Why does eof have a prototype?

by ikegami (Patriarch)
on Aug 09, 2022 at 13:11 UTC ( [id://11146061]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Why does eof have a prototype?
in thread Why does eof have a prototype?

That certain operators (eof, open, etc.) have prototypes that aren't adequate for representing the syntax of the operator is the premise of the question.

For example,

  • An overridden eof operator can't distinguish whether it was was called as eof or eof() while the real operator does.

  • open( STDERR , ">&=", STDOUT ) is perfectly valid with the real operator, but throws a strict error with an overridden open.

    $ perl <<'.' use strict; open( STDERR , ">&=", STDOUT ); BEGIN { *CORE::GLOBAL::open = sub (*;$@) { } } open( STDERR , ">&=", STDOUT ); . Bareword "STDOUT" not allowed while "strict subs" in use at - line 4. Execution of - aborted due to compilation errors.

Upd: Fixed accidental double negation.

Replies are listed 'Best First'.
Re^4: Why does eof have a prototype?
by LanX (Saint) on Aug 09, 2022 at 17:59 UTC
    Filehandles are still too voodoo for me, I hoped something like this could fix that problem...

    use constant STDERR => \*STDERR; use constant STDOUT => \*STDOUT;

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found