That is in essence correct. In fact params is a compilation of parameters from various places. There is already validation code to check that the correct parameters are present. What I need the test system to do is ensure that the parameters have the correct values given known email text. That is, I want to check that the parsing process is generating the correct output email for a given input email.

What I think I need in the test script would look something like:

my $emailBody = '...'; my %generatedParams; # possibly some magic here to associate %generatedParams with %params +contents ok (parseEmail ($emailBody), 'Email parsed without error'); # possibly some magic here to get %params contents into %generatedPara +ms ok ($generatedParams{to} eq 'to@addr', 'To address generated correctly +'); ...

Yes, I mean %params is lexically scoped to the sub. (That's the C++ shining through.)

Update: Perhaps I should add that the sub containing the send code is not where the parsing is done,but it is the only place where all the pieces that comprise the email content come together. Various header information such as subject, to and from addresses and possibly other information headers are generated in the sub.


DWIM is Perl's answer to Gödel

In reply to Re^2: Checking parameters passed to a third party module during testing by GrandFather
in thread Checking parameters passed to a third party module during testing by GrandFather

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.