ASP4
view release on metacpan or search on metacpan
lib/ASP4/UserAgent.pm view on Meta::CPAN
]);
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" );
=head1 DESCRIPTION
Enables unit-testing ASP4 applications by providing the ability to execuite web
pages from your code, without a webserver.
=head1 PUBLIC METHODS
=head2 get( $url )
Calls C<$url> and returns the L<HTTP::Response> result.
=head2 post( $url, $args )
Calls C<$url> with C<$args> and returns the L<HTTP::Response> result.
=head2 upload( $url, $args )
Calls C<$url> with C<$args> and returns the L<HTTP::Response> result.
=head2 submit_form( HTML::Form $form )
Submits the C<$form> and returns the L<HTTP::Response> result.
=head2 add_cookie( $name, $value )
Adds the cookie to all subsequent requests.
=head2 remove_cookie( $name )
Removes the cookie (if it exists).
=head1 SEE ALSO
L<HTTP::Response> and L<HTML::Form>
=head1 BUGS
It's possible that some bugs have found their way into this release.
Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ASP4> to submit bug reports.
=head1 HOMEPAGE
Please visit the ASP4 homepage at L<http://0x31337.org/code/> to see examples
of ASP4 in action.
=cut
( run in 0.917 second using v1.01-cache-2.11-cpan-e1769b4cff6 )