carp'd (which outputs to STDOUT, no?)

No, by default warn and Carp messages go to STDERR.

my code emits an error message

What error message exactly? That would help in grepping where in File::Fetch it's being generated.

the eval was added in as a suggestion to suppress the warning

eval only catches fatal errors, it does not stop things from being printed, including warnings.

First, I'd investigate where in the module the message is being generated and why the WARN flag isn't suppressing it. If the module doesn't provide a way to turn this message off, there may be some trickery necessary with a local $SIG{__WARN__} or other monkey patching. If the case were to be that I can't do anything about it, as a last resort one can use Capture::Tiny to catch any output from a block of code.


In reply to Re: $File::Fetch::WARN = 0; not working? by haukex
in thread $File::Fetch::WARN = 0; not working? by jamroll

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.