ASP4::UserAgent - Execute ASP4 requests without a web server.
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" );
Enables unit-testing ASP4 applications by providing the ability to execuite web pages from your code, without a webserver.
Calls $url and returns the HTTP::Response result.
$url
Calls $url with $args and returns the HTTP::Response result.
$args
Submits the $form and returns the HTTP::Response result.
$form
Adds the cookie to all subsequent requests.
Removes the cookie (if it exists).
HTTP::Response and HTML::Form
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.
Please visit the ASP4 homepage at http://0x31337.org/code/ to see examples of ASP4 in action.
To install ASP4, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ASP4
CPAN shell
perl -MCPAN -e shell install ASP4
For more information on module installation, please visit the detailed CPAN module installation guide.