Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Seeking guidance for more idiomatic way of (re)writing this script.

by Anonymous Monk
on Jan 15, 2013 at 11:03 UTC ( #1013357=note: print w/ replies, xml ) Need Help??


in reply to Seeking guidance for more idiomatic way of (re)writing this script.

if (open ...) { print error } else { real code here } #EOF

is better written as

if (open ...) { print error exit(1); } real code here

Besides that, you might want to try splitting the script's processing stages into well-named subroutines. It will help you reduce the amount of variables in the current scope, too. And perhaps rid of the temporary file -- I'm sure MIME::Lite can attach a "file" from a string variable.


Comment on Re: Seeking guidance for more idiomatic way of (re)writing this script.
Select or Download Code
Re^2: Seeking guidance for more idiomatic way of (re)writing this script.
by Anonymous Monk on Jan 15, 2013 at 11:04 UTC

    use autodie 'open';
    open ...; # autodie prints error message/exits on failure -- it dies
    ...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-12-19 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (72 votes), past polls