The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

NCGI::Query - HTTP GET/POST Query object for NCGI

SYNOPSIS

  use NCGI::Query;
  my $q = NCGI::Query->instance();

  print "Content-Type: text/plain\n\n";
  if ($q->isquery) {
    print "GET\n" if $q->isget();
    print "POST\n" if $q->isget();
    print "Your submit button is called: ", $q->param('submit');
    print "Your submitted name as: ", $q->params->{'name'};
  }
  else {
    print "No query\n";
  }

DESCRIPTION

NCGI::Query provides an interface to GET and POST queries sent by user agents. NCGI derives directly from this class so all methods below are also available there.

METHODS

instance()

NCGI::Query is a Singleton class. See Class::Singleton on CPAN for details on what this means. The instance function returns a reference to the singleton creating it if necessary.

isquery()

Boolean indicating whether a GET or POST query was received.

isget()

Boolean indicating whether a GET query was received.

ispost()

Boolean indicating whether a POST query was received.

param()

Takes a single argument (the key) and returns the query value.

params()

Returns a reference to a HASH containing all query items.

full_query()

Returns the raw query string

cookie()

Takes a single argument (the cookie) and returns the cookie value.

cookies()

Returns a reference to a HASH containing all cookies

dump_params()

Returns a string representation of all query items and their values.

dump_cookies()

Returns a string representation of all cookies and their values.

SEE ALSO

NCGI::Singleton, NCGI::Cookie, NCGI

AUTHOR

Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE

Copyright (C) 2005 Mark Lawrence <nomad@null.net>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.