Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: canonical doc explaing need for "eval { ... } or do {...}" construct

by LanX (Saint)
on May 12, 2022 at 13:29 UTC ( [id://11143833]=note: print w/replies, xml ) Need Help??


in reply to Re: canonical doc explaing need for "eval { ... } or do {...}" construct
in thread canonical doc explaing need for "eval { ... } or do {...}" construct

Thank you all! :)

I think the overall best solution is to mention Try::Tiny in the perldocs.

eval { ...; 1 } or do {...} might be a good solution if you hate dependencies and want backwards compatibility.

But it's just too much boilerplate to keep in mind.

Me too, I forgot about the ;1 part when starting this thread.

But I'm worried about compatibility issues with Try::Tiny and the new try feature in 5.36.

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

Replies are listed 'Best First'.
Re^3: canonical doc explaing need for "eval { ... } or do {...}" construct
by hippo (Bishop) on May 13, 2022 at 09:02 UTC
    But I'm worried about compatibility issues with Try::Tiny and the new try feature in 5.36.

    According to MetaCPAN there are 15,409 dists depending ultimately on Try::Tiny. I credit those steering the good ship Perl with enough nous to realise that breaking this would be an absolute no-go.


    🦛

Re^3: canonical doc explaing need for "eval { ... } or do {...}" construct
by ikegami (Patriarch) on May 12, 2022 at 14:40 UTC

    I think the overall best solution is to mention Try::Tiny in the perldocs.

    hmmm, the Perl docs probably should be in the business of recommending specific non-core modules.

    Especially since Perl is getting a try keyword...

      > Especially since Perl is getting a try keyword...

      which is naturally not backwards compatible

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

        Quite the opposite. It's not any less backward compatible than creating a new module that exports try, seeing as you have to "import" it before you can use it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-20 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found