Ok, I lied a little. The full code for the sub is:

sub sendMessage { my (%params) = @_; return if ! CheckParams (\%params, \@okMsgParams, \@requiredMsgPar +ams); $params{Type} = 'text/plain' if ! exists $params{Type}; $params{Date} = Date::EzDate->new ()->{'%Y:%m:%d %T'} if ! exists $params{date}; $params{From} = $BuildManagerContext::gMyEmailAddress if ! exists +$params{From}; my $msg = MIME::Lite->new (%params); my $result = eval {$msg->send}; if (! defined $result) { my $mailMsg = "Error: failed to send message below. Error is $ +@\n"; $mailMsg .= "The following parameters were supplied:\n"; $mailMsg .= "$_: $params{$_}\n" for keys %params; $mailMsg ||= '-- No parameters supplied --'; BuildManagerContext::AddLogString ($mailMsg, 1); BuildManagerContext::FlushLogStrings (); return undef; } return 1; }

and it gets called from many different places. However it is where all the parts come together and as suggested in the OP it is really only the two lines of the send that are important to the problem. tye's solution gives me exactly the tool that is needed and I can use the same technique in other places to similar effect.


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.