My take on this is that any module which spits out warnings is broken and should be fixed. There is no good way to suppress these warnings external to the module. You can use $SIG{__WARN__} or re-route STDERR or even hack the symbol-table to stuff your own replacement for the method which is causing you problems. They all have their problems which will surface to bite you later.

IMHO you should look at why you are trying to parse the user-agent string anyway. There is no standard for what might be there, browsers are all regularly impersonating each other, and the end-user can tell them to use some random string as the user-agent. Anything you try for parsing the user-agent is a hack and may or may not work today, but you can pretty much guarantee that it will break someday.

Please consider if whatever you are trying to accomplish would not be better done in the browser itself by feature-detection, rather than browser-detection. Feature-detection is much more reliable and doesn't depend on figuring out which browser you've got.


In reply to Re: Need to turn off prints from module by thargas
in thread Need to turn off prints from module by Mushka

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.