Try
package MyMechanize; use base 'WWW::Mechanize'; sub _make_request { my $self = shift; my $request = shift; $request->protocol('HTTP/1.1'); # modify $self->SUPER::_make_request($request, @_); } package main; my $ua = MyMechanize->new; $ua->add_handler("request_send", sub { print "request_send\n";shift-> +dump; return }); $ua->add_handler("response_done", sub { print "response_done\n";shift- +>dump; return }); my $uri = URI->new("https://www.modsecurity.org/"); $ua->get( $uri, 'host' => $uri->host, 'Accept' => 'text/html,application/xhtml+xml,application/xml', ); __END__ request_send GET https://www.modsecurity.org/ HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml Accept-Encoding: gzip Host: www.modsecurity.org User-Agent: WWW-Mechanize/1.54 (no content) response_done HTTP/1.1 200 OK Connection: close Date: Thu, 26 Feb 2009 05:37:00 GMT Accept-Ranges: bytes Server: Apache........ ....... .....

In reply to Re^2: Changing WWW::Mechanize Request to obey ModSecurity rules by Anonymous Monk
in thread Changing WWW::Mechanize Request to obey ModSecurity rules by pdc

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.