NAME

HTML::StickyQuery - add sticky QUERY_STRING to a tag href attributes.

SYNOPSIS

use HTML::StickyQuery;

my $s = HTML::StickyQuery->new(
                               regexp => '\.cgi$',
                               abs => 0,
                               override => 1
                               );
print $s->sticky(
                 file => 'foo.html',
                 param => {
                           SESSIONID => 'xxx'
                           }
                 );

DESCRIPTION

this module is sub class of HTML::Parser and uses it to parse HTML document and add QUERY_STRING to href attributes.

you can assign Session ID or any form data without using cookie.

if you want to use sticky CGI data via FORM. it is better to use HTML::FillInForm.

CONSTRUCTOR

new(%option)

constructor of HTML::StickyQuery object. the options are below.

abs

add QUERY_STRING to absolute URI or not. (default: 0)

override

override original QUERY_STRING or not (default: 0)

regexp

regular expression of affected URI. (default: none)

METHODS

sticky(%options)

parse HTML and add QUERY_STRING. return HTML document. the options are below.

file

specify the HTML file.

scalarref

specify the HTML document as scalarref.

arrayref

specify the HTML document as arrayref.

param

QUERY_STRING data. as hashref.

EXAMPLE

typical example of CGI application using session.

use Apache::Session,HTML::Template and HTML::StickyQuery

template file. test.html

<html>
<head>
<title>Session Test</title>
</head>
<body>
COUNT: <TMPL_VAR NAME="count"><br>
<hr>
<a href="test.cgi">countup</a><br>
<hr>
</body>
</html>

CGI program. test.cgi

 #!/usr/local/bin/perl
 
 use strict;
 use CGI;
 use HTML::Template;
 use HTML::StickyQuery;
 use Apache::Session::DB_File;
 
 my %session;
 my $cgi = CGI->new;
 
 # create session.
 my $id = $cgi->param('SESSIONID');
 tie %session,'Apache::Session::DB_File',$id,{
	 				      FileName => './session.db',
 					      LockDirectory => './lock'
 };

 $session{count} = $session{count} + 1;
 
 my $tmpl = HTML::Template->new(filename => './test.html');
 
 $tmpl->param(count => $session{count});
 
 my $output = $tmpl->output;
 
 # no COOKIE
 print $cgi->header;
 
 my $stq = HTML::StickyQuery->new;
 print $stq->sticky(
	 	    scalarref => \$output,
		    param => {
			      SESSIONID => $session{_session_id}
			     }
		   );
 

AUTHOR

IKEBE Tomohiro <ikebe@edge.co.jp>

SEE ALSO

HTML::Parser HTML::FillInForm

CREDITS

Fixes,Bug Reports.

Tatsuhiko Miyagawa

COPYRIGHT

Copyright(C) 2001 IKEBE Tomohiro All rights reserved.

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