CoVAX has asked for the wisdom of the Perl Monks concerning the following question:
Here's what I've currently doing (snippet):
$mech = WWW::Mechanize->new( autocheck => 1 ); $mech->cookie_jar($cookie_jar); $mech->default_header( 'User-Agent' => 'Mozilla/5.0 <snip>' ); $mech->default_header( 'Referer' => 'https://www.<snip>' ); $mech->default_header( 'Accept' => 'application/<snip>' ); $mech->default_header( 'Accept-Language' => 'en-US,en;q=0.5' ); $mech->default_header( 'Accept-Encoding' => 'gzip, deflate' ); $mech->default_header( 'Connection' => 'keep-alive' ); $mech->show_progress(1);
Since TIMTOWTDI I'm wondering if I should use a hash instead, and pass a reference to it to WWW::Mechanize->new() (how?), or should I call default_header once, passing it a list of key/value pairs?
Your thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is idiomatic use of WWW::Mechanize->new re: default headers?
by ikegami (Patriarch) on Feb 09, 2015 at 02:34 UTC | |
by CoVAX (Beadle) on Feb 09, 2015 at 20:00 UTC |