I would doubt this fix will make your program work correctly, since all it is doing is suppressing an otherwise irrelevant warning. (And please note the correct version of that workaround supplied in the comment from ysth.)

I would suspect that as a result of installing MIME::Parser, a simpler heuristic for validating an email address has been replaced with something that tries to be more precise, but in the process loses the ability to cope with IP address as domain.

One possible approach (which might be a good idea anyway) would be to replace the dotted IP addresses with names. However there are reasons you might be unable or unwilling to do that.

My guess is that the error message is coming from Mail::Address->_tokenise(), called by parse(), but I haven't analysed the code to determine why it is giving the error: certainly a standalone attempt to parse the same string seems quite happy:

perl -MMail::Address -wle 'print Mail::Address->parse("1002\@151.104 +.234.7")' Mail::Address=ARRAY(0x815a8bc)
.. showing that it returns a single Mail::Address object. (Does it do the same for you?)

Beyond that I can think of no obvious reason for a problem. One possible approach is to install a duplicate of the relevant modules in a space somewhere under your control, and add diagnostics (or use the debugger) to track down precisely where the problem occurs and why. Once you've gained that understanding, you should be able to determine whether it is a problem with your own code or with that in one of the modules, and resolve it either by fixing your code or supplying a rationale and patch to the relevant module maintainer and waiting for a new release.

Assuming I'm correct about the source of the error message, the starting point would be the one place in the code that mentions Mail::Address, where depending on whether the module can be loaded one of two versions of each of two subroutines is installed: extract_full_addrs() and extract_only_addrs().

(Indeed, this suggests one possible workaround, to subclass MIME::Lite and overload those two subroutines to point to the fallback methods:

{ package My::MIME::Lite; use MIME::Lite; our @ISA = qw/ MIME::Lite /; *extract_full_addrs=*MIME::Lite::my_extract_full_addrs; *extract_only_addrs=*MIME::Lite::my_extract_only_addrs; } $mime_msg = My::MIME::Lite->new(...); My::MIME::Lite->send(...); $mime_msg->send();
.)

Hugo


In reply to Re: Re: Re: Re: v-string in use/require non-portable by hv
in thread v-string in use/require non-portable by Anonymous Monk

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.