Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: why does Perl eval have a strange terminator?

by perlfan (Vicar)
on Jun 24, 2022 at 20:11 UTC ( [id://11145023]=note: print w/replies, xml ) Need Help??


in reply to Re^3: why does Perl eval have a strange terminator?
in thread why does Perl eval have a strange terminator?

Try::Tiny requires a ;, and if you investigate why it is because it is implemented using prototypes.
sub try (&;@) { ... sub catch (&;@) { ... sub finally (&;@) { ...
I am not suggesting "eval BLOCK" is implemented using prototypes, but one could implement their own that would literally become a drop-in replacement (since the ; is likey already there. FWIW, (&;@) means the BLOCK param is coerced into a coderef, then optionally (after that ;), which allows something like the:
try { } catch { } finally { };
So now the POD seems to make a little more sense.

Log In?
Username:
Password:

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

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

    No recent polls found