Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: What technical benfits perl offers over python + few more questions. (Try Catch)

by eyepopslikeamosquito (Archbishop)
on Nov 15, 2021 at 03:40 UTC ( [id://11138819]=note: print w/replies, xml ) Need Help??


in reply to Re^2: What technical benfits perl offers over python + few more questions.
in thread What technical benfits perl offers over python + few more questions.

Further to exception handling being well supported on CPAN for many years (as pointed out by hippo above), note that an officially endorsed Try-Catch Exception Handling notation was released with core perl 5.34 as an experimental feature.

See also:

On CPAN:

Update

As mentioned at New built-in perl5.38 try/catch syntax:

  • perl v5.34 added try/catch syntax based on CPAN module Syntax::Keyword::Try
  • perl v5.36 added "finally" blocks to try/catch, also inspired by Syntax::Keyword::Try
  • perl v5.36 added use feature 'defer', allowing you to create defer blocks that run at the time that execution leaves the block it's declared inside (which seems to be inspired by the classic RAII programming idiom)
  • use v5.36 implies use strict and use warnings
  • use v5.38 implies use feature 'try'

As noted at On Interfaces and APIs:

  • Perl 5's "string eval" and "block eval" is an example of violation of the "principle of distinction", aka "different things should look different"

Updated: added more references

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found