Anthony Johnson > WWW-Snooze-0.01_02 > WWW::Snooze::Request

Download:
WWW-Snooze-0.01_02.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

WWW::Snooze::Request - Main request object featuring autoloading

METHODS ^

new(%args)

headers

Override headers with an instance of HTTP::Headers

serializer

Override serializer with and instance of WWW::Snooze::Serialize

get([\%data])

delete([\%data])

post([\%data])

put([\%data])

Perform HTTP operation on URL, %data is encoded using the serializer.

AUTOMATIC METHODS ^

The request object uses autoloading method names to build the request. Calling a method on the request object will add that method name on to the URL stack and return a new request object with the new stack.

[$element]($id, %query_string)

Automatic methods can be called with an id argument, or undef if there is no id, and named parameters which are encoded to a query string

    my $r = WWW::Snooze::Request->new('http://example.com');
    
    $r->foo();
    # Request URL would be http://example.com/foo.json
    
    $r->foo(42)->bar;
    # http://example.com/foo/42/bar.json
    
    $r->foo(undef, foo => 'bar');
    # http://example.com/foo?foo=bar

_add_element($name, $id, %query_string)

Automatic methods are built using this private function, however you can also revert to calling this directly in the case of a namespace collision with an element or a poorly named element.

    $r->_add_element('poorly named');
    # http://example.com/poorly%20named
    
    $r->_add_element('foo', 42, foo => bar);
    # http://example.com/foo/42.json?foo=bar

ATTRIBUTES ^

Privately scoped to avoid namespace collision

_args()

Return query string arguments added

_serializer()

Return the serializer

_headers()

Return the HTTP::Headers object

AUTHOR ^

Anthony Johnson <aj@ohess.org>

syntax highlighting: