John Drago > ASP4-1.087 > ASP4::UserAgent

Download:
ASP4-1.087.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source  

NAME ^

ASP4::UserAgent - Execute ASP4 requests without a web server.

SYNOPSIS ^

NOTE: 99.99% of the time you will access this via ASP4::API.

  my HTTP::Response $res = $api->ua->get('/index.asp?foo=bar');
  
  my $res = $api->ua->post('/handlers/user.login', [
    username  => 'willy',
    password  => 'wonka',
  ]);
  
  my $res = $api->ua->upload('/handlers/file.upload', [
    foo   => 'bar',
    baz   => 'bux',
    file  => ['/home/john/avatar.jpg']
  ]);
  
  # Some form testing:
  my ($form) = HTML::Form->parse( $res->content, '/' );
  $form->find_input('username')->value('bob');
  my $res = $api->ua->submit_form( $form );
  
  # Add/remove a cookie:
  $api->ua->add_cookie( "the-boss" => "me" );
  $api->remove_cookie( "the-boss" );

DESCRIPTION ^

Enables unit-testing ASP4 applications by providing the ability to execuite web pages from your code, without a webserver.

PUBLIC METHODS ^

get( $url )

Calls $url and returns the HTTP::Response result.

post( $url, $args )

Calls $url with $args and returns the HTTP::Response result.

upload( $url, $args )

Calls $url with $args and returns the HTTP::Response result.

submit_form( HTML::Form $form )

Submits the $form and returns the HTTP::Response result.

add_cookie( $name, $value )

Adds the cookie to all subsequent requests.

remove_cookie( $name )

Removes the cookie (if it exists).

SEE ALSO ^

HTTP::Response and HTML::Form

BUGS ^

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4 to submit bug reports.

HOMEPAGE ^

Please visit the ASP4 homepage at http://0x31337.org/code/ to see examples of ASP4 in action.

syntax highlighting: