Stefan Trcek > webrobot-0.81 > WWW::Webrobot::MyUserAgent

Download:
webrobot-0.81.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

WWW::Webrobot::MyUserAgent - specialized user agent

SYNOPSIS ^

 my $ua = WWW::Webrobot::MyUserAgent -> new

DESCRIPTION ^

This class inherits LWP::UserAgent. Additional features:

basic authentification
aborting redirects

METHODS ^

my $agent = WWW::Webrobot::MyUserAgent -> new

Create user agent.

$agent -> set_basic_realm ($realm)

Set a realm for basic authentification

    $realm = {
        "realm1" => ["login1", "password1"],
        "realm2" => ["login2", "password2"],
    };
$ua -> get_basic_credentials

inherited from LWP::UserAgent

$ua -> set_redirect_ok ($recurse)

Set an object that allows recursion over the resulting responses. For $recurse see WWW::Webrobot::pod::Recur. Affects redirect_ok.

$ua -> clear_redirect_fail

Clear the redirect_fail flag. This flag may be set in redirect_ok.

$ua -> is_redirect_fail

Get the value of the redirect_fail flag. This flag indicates that a redirection was aborted.

$ua -> redirect_ok

inherited from LWP::UserAgent

$ua -> client_302_bug
 $ua->client_302_bug(1)
     Behave like 302-buggy browser, no method to unset available.
 $ua->client_302_bug
     return whether value is set

Most popular browsers don't implemenent HTTP response 302 correctly, see [RFC 2616] http://www.ietf.org/rfc/rfc2616.txt page 61, section 10.3.3, title "302 Found". In short:

        - bug 1: browser redirects POST without user interaction
        - bug 2: browser changes method from POST to GET

You should better correct your server instead of using this method: return 303 instead of 302.

$ua -> enable_referrer($value)

Enable (1) or disable the HTTP referrer (which spells 'Referer')

$ua -> referrer($value)

Set/get the referrer value if referrers have been enabled by enable_referrer.

syntax highlighting: