Solstice::CGI - For getting the CGI form parameters.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::CGI - For getting the CGI form parameters.

SYNOPSIS

Top

  use Solstice::CGI;

  my $q = param('q');  # param is exported automagically

DESCRIPTION

Top

This gets module exports the &param() function by default so you can get form parameters from the Apache request object.

Export

param($string)

Gets a CGI parameter.

header(%options)

Gets the http header that you would print.

_setURLArgs
getURLParams

Methods

new()

You may optionally create a Solstice::CGI object and call methods on it instead of using the default exported subroutines.

upload($param)

Returns an Apache::Upload object, or undef if there was an error.

Private Functions

_fixArgs(\@_)

Modifies the argument list in place to get rid of $self if present.

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision$

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::CGI;

use 5.006_000;
use strict;
use warnings;

our ($VERSION) = ('$Revision$' =~ /^\$Revision:\s*([\d.]*)/);

use Solstice::Server;
use CGI;

use base qw(Solstice::Service Exporter);
our @EXPORT = qw(param upload getURLParams getURLParam);
our @EXPORT_OK = qw(header);

sub param {
    _fixArgs(\@_);

    my $server = Solstice::Server->new();
    return $server->param(@_);
}

sub header {
    _fixArgs(\@_);
    return CGI->new()->header(@_);
}


sub _setNamedURLParams {
    my $self = shift;
    my $args = shift;

    $self->set('named_url_arg_list', $args);
}



sub _setURLParams {
    my $self = shift;
    my $args = shift;

    $self->set('url_arg_list', $args);
}


sub getURLParam {
    my $name = shift;
    return Solstice::CGI->get('named_url_arg_list') ? Solstice::CGI->get('named_url_arg_list')->{$name} : undef;
}

sub getURLParams {
    my $args = Solstice::CGI->get('url_arg_list') || [];
    return @{$args};
}

sub new {
    return bless {}, shift;
}

sub upload {
    _fixArgs(\@_);

    my $server = Solstice::Server->new();

    if ($server->getUploadSuccessful()) {
        return $server->getUpload(shift);
    }
}

sub _fixArgs {
    my $args = shift;
    if (defined $args->[0] && ref($args->[0]) eq 'Solstice::CGI') {
        shift(@$args);
    }
}


1;

__END__