John Drago > Apache2-ASP-2.46 > Apache2::ASP::Test::UserAgent

Download:
Apache2-ASP-2.46.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  2
View/Report Bugs
Source  

NAME ^

Apache2::ASP::Test::UserAgent - Execute ASP scripts without a webserver.

SYNOPSIS ^

Generally you will be accessing this class from wither Apache2::ASP::Test::Base or Apache2::ASP::API.

  my $asp = Apache2::ASP::API->new()
    -- or --
  my $asp = Apache2::ASP::Test::Base->new();
  
  # Get:
  my $res = $asp->ua->get("/index.asp");
  if( $res->is_succes ) {
    ...
  }
  
  # Post:
  my $res = $asp->ua->post("/handlers/contact.form", [
    name  => "Fred",
    email => 'fred@flintstone.org',
    message => 'This is a test email message.'
  ]);
  
  # Do the same thing, but with HTML::Form:
  use HTML::Form;
  my $form = HTML::Form->parse( $asp->ua->get("/contact.asp")->content, '/' );
  $form->find_input('name')->value('Fred');
  $form->find_input('email')->value('fred@flintstone.org');
  $form->find_input('message')->value('This is a test email message');
  my $res = $asp->ua->submit_form( $form );
  
  # Upload:
  my $res = $asp->ua->upload("/handlers/MM?mode=create&uploadID=12334534", [
    filename => ['/path/to/file.txt'],
  ]);

PUBLIC PROPERTIES ^

context

Returns the current Apache2::ASP::HTTPContext object.

PUBLIC METHODS ^

get( $url )

Makes a "GET" request to $url

post( $url [,\@args] )

Makes a "POST" reqest to $url, using @args as the body.

upload( $url, \@args )

Makes a "POST" request with a multipart/form-data type, using @args as the body.

submit_form( HTML::Form $form )

Submits the form.

NOTE: - this will not work for "upload" forms (yet).

BUGS ^

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

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

HOMEPAGE ^

Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.

AUTHOR ^

John Drago mailto:jdrago_999@yahoo.com

COPYRIGHT AND LICENSE ^

Copyright 2007 John Drago, All rights reserved.

This software is free software. It may be used and distributed under the same terms as Perl itself.

syntax highlighting: