NAME

CGI::WPM::WebUserIO - Perl module that gathers, parses, and manages user input and output data, including HTTP headers, query strings, posts, searches, cookies, and shell arguments, as well as providing cleaner access to many environment variables, consistantly under both CGI and mod_perl.

DEPENDENCIES

Perl Version

5.004

Standard Modules

Apache (when running under mod_perl only)
HTTP::Headers 1.36 (earlier versions may work, but not tested)

Nonstandard Modules

CGI::MultiValuedHash 1.03

SYNOPSIS

use CGI::WPM::WebUserIO;

my $query = CGI::WPM::WebUserIO->new();

if( my $url = $query->user_input_param( "gohere" ) ) {
	$query->redirect_url( $url );
	$query->send_to_user();
	return( 1 );
}

$query->send_headers_to_user();

$query->send_content_to_user( <<__endquote );
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> 
<HTML><HEAD>
<TITLE>Choose Your Own Adventure</TITLE> 
</HEAD><BODY>

<H1>Choose Your Own Adventure</H1>

<P>Welcome to a new adventure.  Thanks be to 
@{[$query->http_referrer()]} for sending you to us.</P>

<P>You have brought @{[$query->user_cookie()->keys_count()]} 
cookies with you to share.  How nice.</P>

<FORM METHOD="post" ACTION="@{[$query->self_url()]}">

<P>Enter a url here that you want to visit: <BR>
<INPUT TYPE="text" NAME="gohere" VALUE=""></P>

<P>Enter an environment variable that you want to view: <BR>
<INPUT TYPE="text" NAME="anenv" 
VALUE="@{[$query->user_input_param("anenv")]}"></P>

<P>The last one you chose contained 
"@{[$ENV{$query->user_input_param("anenv")}]}".</P>

<P><INPUT TYPE="submit" NAME="doit" VALUE="Choose"></P>

</FORM>

</BODY></HTML> 
__endquote

DESCRIPTION

Perl module that gathers, parses, and manages user input and output data, including HTTP headers, query strings, posts, searches, cookies, and shell arguments, as well as providing cleaner access to many environment variables, consistantly under both CGI and mod_perl.

This POD is coming when I get the time to write it.

SYNTAX

This class does not export any functions or methods, so you need to call them using object notation. This means using Class->function() for functions and $object->method() for methods. If you are inheriting this class for your own modules, then that often means something like $self->method().

FUNCTIONS AND METHODS

This POD is coming when I get the time to write it.

new([ USER_INPUT ])
initialize([ USER_INPUT ])
clone([ CLONE ]) -- POD for this available below

is_mod_perl()

user_cookie_str()
user_query_str()
user_post_str()
user_offline_str()
is_oversize_post()

request_method()
content_length()

server_name()
virtual_host()
server_port()
script_name()

http_referer()

remote_addr()
remote_host()
remote_user()
user_agent()

base_url()
self_url()
self_post([ LABEL ])
self_html([ LABEL ])

user_cookie([ NEW_VALUES ])
user_cookie_string()
user_cookie_param( KEY[, NEW_VALUES] )

user_input([ NEW_VALUES ])
user_input_string()
user_input_param( KEY[, NEW_VALUE] )
user_input_keywords()

persistant_user_input_params([ NEW_VALUES ])
persistant_user_input_string()
persistant_user_input_param( KEY[, NEW_VALUES] )
persistant_url()

redirect_url([ NEW_VALUE ]) -- POD for this available below

get_http_headers()

send_headers_to_user([ HTTP ])
send_content_to_user([ CONTENT ])
send_to_user([ HTTP[, CONTENT] ])

parse_url_encoded_cookies( DO_LC_KEYS, ENCODED_STRS )
parse_url_encoded_queries( DO_LC_KEYS, ENCODED_STRS )

clone([ CLONE ])

This method initializes a new object to have all of the same properties of the current object and returns it. This new object can be provided in the optional argument CLONE (if CLONE is an object of the same class as the current object); otherwise, a brand new object of the current class is used. Only object properties recognized by CGI::WPM::WebUserIO are set in the clone; other properties are not changed.

redirect_url([ VALUE ])

This method is an accessor for the "redirect url" scalar property of this object, which it returns. If VALUE is defined, this property is set to it. If this property is defined, then an http redirection header will be returned to the user instead of an ordinary web page.

AUTHOR

Copyright (c) 1999-2001, Darren R. Duncan. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. However, I do request that this copyright information remain attached to the file. If you modify this module and redistribute a changed version then please attach a note listing the modifications.

I am always interested in knowing how my work helps others, so if you put this module to use in any of your own code then please send me the URL. Also, if you make modifications to the module because it doesn't work the way you need, please send me a copy so that I can roll desirable changes into the main release.

Address comments, suggestions, and bug reports to perl@DarrenDuncan.net.

SEE ALSO

perl(1), mod_perl, CGI::MultiValuedHash, HTTP::Headers, Apache.