sier:

<disclaimer>I commend your desire to make your system flexible and useful, and I'm certainly not a BOFH, but...</disclaimer>

Sometimes, you can just make things too hard on yourself. I'm not saying that this is the case here--but in general, trying to make a system idiot proof is impossible. You can bend over backwards trying to do it, but if the users continually send you any random crap and expect your code to parse it and deliver the messages, neither you nor your clients are going to be happy with the system. In cases similar to this, I simply have the system look at the header, and if it can't find the columns it wants, then send an error EMail telling the client what the problem(s) are, and let them fix the problem and send it again. Since they're using CSV files, they're likely to be generating 'em from Excel, so they can rename the columns appropriately...

Again, I'm not advocating that you frustrate your clients. I'm simply suggesting that sometimes there are situations that can be (1) a time sink, (2) continually frustrating, and (3) anti-profitable. Just make sure that you're not putting yourself in a situation where you're going to have to continually "fix" your code because your user can't give you what the program wants. Been there, done that, got the T-shirt, washed it enough times for the lettering to fade...

...roboticus

In reply to Re: Tie::Handle::CSV dynamically detecting header names by roboticus
in thread Tie::Handle::CSV dynamically detecting header names by sier

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.