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

Re^3: simple Perl script template

by Dumu (Monk)
on Apr 09, 2015 at 12:49 UTC ( [id://1122928]=note: print w/replies, xml ) Need Help??


in reply to Re^2: simple Perl script template
in thread simple Perl script template

I like the idea of just warning, in case only one of the files can't be written.

Replies are listed 'Best First'.
Re^4: simple Perl script template
by pme (Monsignor) on Apr 09, 2015 at 13:35 UTC
    Hi Dumu, marinersk,

    In case of using 'warn' 'next' should be added to suppress unnecessary error messages (I suppose strictures are on) eg.:

    unless (open my $fh, '>', $fname) { warn "Cannot open $fname - $!\n"; next; }
    In case of error we have to rerun the script after fixing the reason. In this sense there is no difference between 'die' and 'warn' version. But 'die' version is smaller -> "small is beautiful"

      Ah, I see where you are coming from.

      In my world, the error would more likely be in the form of having one of the filenames be impossible to use (such as having a colon or a subdirectory that doesn't exist, that sort of thing) but to be of the most service to me personally, the remaining files on the command line should still get created. The only correction then is to run again with just the one corrected filename.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (1)
As of 2024-04-25 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found