I was getting a silly warning from WWW::Mechanize about finding <input> tags outside <form> tags (silly because it was wrong; I checked the HTML and all the inputs were inside the form tags, just as they should be). The warning was emanating from the HTML::Form module, which appears from the
documentation to have a 'verbose' option, but I couldn't see how Mechanize was passing it, unless it is on by default, though the doc seems to suggest otherwise.
Suffice to say that after great gnashing of teeth / rending of garments, etc. I succeeded in making the warning go away by reinstalling the entire LWP library!
Still, I'm baffled by the things I tried that didn't work, including:
- setting $mech->quiet(1)
- constructing the $mech object with the 'onwarn' param set to 'undef'
- putting the bit of code in my script that parses the HTML into a local 'no warnings' block
- commenting out 'use warnings'
- declaring 'no warnings' globally
- gnashing my teeth
- rending my garments
So, like,
what gives?
Because I was under the impression that 'use warnings' was like an on-off switch. If it's on, you'll see warnings; otherwise not. And I liked that, because it meant I could file it under "things about perl I understand" and get back to figuring out the stuff I didn't (i.e. pretty much everything else). Only now I have to pull it out of the "things I understand" category and put it back in the "unfathomable mystery" category with all its friends! My learning curve, which has been like a straight vertical line for the past several weeks, has apparently toppled over backwards.
Can anyone shed a little light? One theory I have is that the message I was seeing wasn't a "warning" exactly; If not, what was it then? And why did reinstalling LWP make it go away? And why was I getting it in the first place when the HTML was OK? (I have perl 5.8.7 on a debian-based platform, in case it matters.)
Thanks all.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.