Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: "open" Best Practices

by kcott (Bishop)
on Jul 12, 2019 at 08:31 UTC ( #11102717=note: print w/replies, xml ) Need Help??


in reply to "open" Best Practices

G'day haukex,

++ Good write up and definitely handy for linking: I've certainly written similar information in dozens of replies over the years.

"use autodie qw/open/;  # at the top of your code"

Possibly out of scope for this; but, it may be worth mentioning the lexical nature of autodie.

I've worked on a lot of production code that uses in-house I/O error handling; e.g. the custom handling includes logging, email alerts, popup messages, and so on. At times, I don't want this for a small part of code I've added; however, I also don't want to interfere with the existing, custom error handling.

A very rough example might be something like:

... use InHouse::IO::ErrorHandling; ... open ...; # in-house handling here ... { use autodie; ... open ...; # autodie handling here ... } ... open ...; # in-house handling here ...

— Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2019-07-19 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?