| OpenPlugin documentation | Contained in the OpenPlugin distribution. |
OpenPlugin::Request::CGI - CGI driver for the OpenPlugin::Request plugin
You may optionally pass in an existing CGI object. For example:
my $q = CGI->new();
my $OP = OpenPlugin->new( request => { cgi => $q } );
This is typically unnecessary. If you do not pass in a CGI object, one will be created for you.
After the plugin is initialized, the CGI object is accessible to you using:
$q = $OP->request->object();
CGI
None known.
Nothing known.
OpenPlugin, OpenPlugin::Param, CGI
Copyright (c) 2001-2003 Eric Andreychek. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Eric Andreychek <eric@openthought.net>
| OpenPlugin documentation | Contained in the OpenPlugin distribution. |
package OpenPlugin::Request::CGI; # $Id: CGI.pm,v 1.7 2003/04/03 01:51:26 andreychek Exp $ use strict; use OpenPlugin::Param(); use base qw( OpenPlugin::Param ); use CGI qw( -no_debug ); $OpenPlugin::Request::CGI::VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); sub init { my ( $self, $args ) = @_; unless ( $self->state->{'cgi'} ) { # Use an existing CGI object if given one if(( not exists $self->state->{'cgi'} ) && ( ref $args->{'cgi'} eq "CGI" )) { $self->state->{'cgi'} = $args->{'cgi'}; } # Otherwise, create a new one else { $self->state->{'cgi'} = CGI->new(); } } # Set the uri $self->state->{'uri'} = $self->state->{'cgi'}->url; return $self; } sub object { my $self = shift; return $self->state->{'cgi'}; } sub uri { my $self = shift; return $self->state->{'uri'}; } 1; __END__