Fellow monks,

I'm not sure if this SOPW or a Meditation since it's somewhere inbetween but here goes.

I'm in the process of writing a cgi program that is going to look for a user's config file. The file is going to be made up of the user's selected items selected from a large number of checkboxes.If said file doesn't exist, that's not a problem as it's going to create one. If the file does exist then I wanted to be able to recreate the checkbox page with the current selections already checked. So far no problem.

My question is regarding die. I've always seen code such as:

open FH, ">user1.cfg" or die "Couldn't open file;

but in my case that isn't going to apply.

I really don't care if the file doesn't exist initially since I'm going to build it if it doesn't.

Hence my question: Should you always die after a file not found or is that a bad coding practice?

There is no emoticon for what I'm feeling now.


In reply to To die or not to die by Popcorn Dave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.