Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Need to turn off prints from module

by thargas (Deacon)
on Nov 18, 2010 at 13:27 UTC ( #872239=note: print w/ replies, xml ) Need Help??


in reply to Need to turn off prints from module

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.


Comment on Re: Need to turn off prints from module

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://872239]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-12-22 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls