MacGyveR > CGI-Mungo-1.9 > CGI::Mungo::Request

Download:
Mungo/CGI-Mungo-1.9.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

CGI::Mungo::Request - Form request class

SYNOPSIS ^

        my $r = $mungo->getRequest();
        my $params = $r->getParameters();

DESCRIPTION ^

Class to deal with the current page request

METHODS ^

new()

        my $r = CGI::Mungo::Request->new();

Constructor, gets all the GET/POST information from the browser request.

getParameters()

        my $params = $r->getParameters();

Returns a hash reference of all the GET/POST values from the current request.

validate()

        my $rules = {
                'age' => {
                        'rule' => '^\d+$',
                        'friendly' => 'Your Age'
                }
        };      #the form validation rules
        my($result, $errors) = $r->validate($rules);

Validates all the current form fields against the provided hash reference.

The hash reference contains akey for every field you are concerned about, which is a reference to another hash containing two elements. The first is the actaul matching rule. The second is the friendly name for the field used in the error message, if a problem with the field is found.

The method returns two values, first being a 0 or a 1 indicating the success of the form. The second is a reference to a list of errors if any.

getheader($header)

        $request->getHeader($name)

Returns the value of the specified request header.

Notes ^

Author ^

MacGyveR <dumb@cpan.org>

Development questions, bug reports, and patches are welcome to the above address

Copyright ^

Copyright (c) 2011 MacGyveR. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: