DESCRIPTION

This class represents a connection to a remote Trac instance. It is required by all other classes which need to talk to Trac.

SYNOPSIS

    use Net::Trac::Connection;

    my $trac = Net::Trac::Connection->new(
        url      => 'http://trac.example.com',
        user     => 'snoopy',
        password => 'doghouse'
    );

ACCESSORS

url

The url of the Trac instance used by this connection. Read-only after initialization.

user

password

ACCESSORS / MUTATORS

logged_in [\s-1BOOLEAN\s0]

Gets/sets a boolean indicating whether or not the connection is logged in yet.

mech [\s-1MECH\s0]

Gets/sets the Net::Trac::Mechanize (or subclassed) object for this connection to use. Unless you want to replace it with one of your own, the default will suffice.

METHODS

new \s-1PARAMHASH\s0

Creates a new Net::Trac::Connection given a paramhash with values for the keys \*(C`url\*(C', \*(C`user\*(C', and \*(C`password\*(C'.

ensure_logged_in

Ensures this connection is logged in. Returns true on success, and undef on failure. Sets the \*(C`logged_in\*(C' flag.

PRIVATE METHODS

_fetch \s-1URL\s0

Fetches the provided relative \s-1URL\s0 from the Trac server. Returns undef on an error (after \*(C`warn\*(C'ing) and the content (\*(C`$self-\*(C'mech->content>) on success.

_warn_on_error \s-1URL\s0

Checks the last request for an error condition and warns about them if found. Returns with a \s-1TRUE\s0 value if errors occurred and a \s-1FALSE\s0 value otherwise for nicer conditionals.

_tsv_to_struct \s-1PARAMHASH\s0

Takes a paramhash of the keys \*(C`data\*(C' Given \s-1TSV\s0 data this method will return a reference to an array.

LICENSE

Copyright 2008-2009 Best Practical Solutions.

This package is licensed under the same terms as Perl 5.8.8.