WWW::Mechanize::CGI - Use WWW::Mechanize with CGI applications.
use CGI; use WWW::Mechanize::CGI; # Using a external CGI application $mech = WWW::Mechanize::CGI->new; $mech->cgi_application('/path/to/cgi/executable.cgi'); $response = $mech->get('http://localhost/'); # Using a inline CGI callback $mech = WWW::Mechanize::CGI->new; $mech->cgi( sub { my $q = CGI->new; print $q->header, $q->start_html('Hello World'), $q->h1('Hello World'), $q->end_html; }); $response = $mech->get('http://localhost/');
Provides a convenient way of using CGI applications with WWW::Mechanize.
Behaves like, and calls, WWW::Mechanize's new method. Any parms passed in get passed to WWW::Mechanize's constructor.
new
Coderef to be used to execute the CGI application.
Path to CGI executable.
Set/Get additional environment variables to be used in CGI. Takes a hash and returns a hash.
$mech->env( DOCUMENT_ROOT => '/export/www/myapp' );
Set to a true value if you want to fork() before executing CGI.
Christian Hansen, ch@ngmedia.com
ch@ngmedia.com
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.
To install WWW::Mechanize::CGI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Mechanize::CGI
CPAN shell
perl -MCPAN -e shell install WWW::Mechanize::CGI
For more information on module installation, please visit the detailed CPAN module installation guide.