p5-html-stickyquery's Introduction
NAME HTML::StickyQuery - add sticky QUERY_STRING SYNOPSIS use HTML::StickyQuery; # create an object my $s = HTML::StickyQuery->new( regexp => '\.cgi$', abs => 0, keep_original => 1, ); print $s->sticky( file => 'foo.html', param => { SESSIONID => 'xxx' } ); or my $q = CGI->new; print $s->sticky( file => 'foo.html', param => $q, sticky_keys => [qw(SESSIONID)] ); DESCRIPTION this module is a sub class of the HTML::Parser manpage. parse HTML document and add QUERY_STRING to href attributes. Handy for maintaining state without cookie or something, transparently. if you want to use sticky CGI data via FORM. it is better to use the HTML::FillInForm manpage. CONSTRUCTOR new(%option) constructor of HTML::StickyQuery object. the options are below. abs add QUERY_STRING to absolute URI or not. (default: 0) override this option is obsolete. please use keep_original option. keep_original keep original QUERY_STRING or not. (default: 1) when this option is false. all old QUERY_STRING is removed. 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 or object which implements *param* method. (eg. CGI, Apache::Request) sticky_keys specify sticky data keys as arrayref. any keys which are not in this list are ignored. if not specified, all keys are kept. EXAMPLES KEEP SESSION ID typical example of CGI application using session. use the Apache::Session>,L<HTML::Template manpage and the HTML::StickyQuery manpage template file: <html> <head> <title>Session Test</title> </head> <body> COUNT: <TMPL_VAR NAME="count"><br> <hr> <a href="session.cgi">countup</a><br> <hr> </body> </html> session.cgi: #!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} } ); KEEP SEARCH WORD IN HTML PAGING template file (simplified): <A href="./search.cgi?pagenum=<TMPL_VAR name=nextpage>">Next 20 results</A> search.cgi: #!perl use CGI; use HTML::StickyQuery; use HTML::Template; my $query = CGI->new; my $tmpl = HTML::Template->new(filename => 'search.html'); # do searching with $query and put results into $tmpl # ... # set next page offset $tmpl->param(nextpagee => $query->param('pagenum') + 1); my $output = $tmpl->output; my $sticky = HTML::StickyQuery->new(regexp => qr/search\.cgi$/); print $query->header, $sticky->sticky( scalarref => \$output, param => $qyery, sticky_keys => [qw(search)] ); AUTHOR IKEBE Tomohiro <[email protected]> SEE ALSO the HTML::Parser manpage the HTML::FillInForm manpage CREDITS Fixes,Bug Reports. Tatsuhiko Miyagawa <[email protected]> COPYRIGHT Copyright(C) 2002 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.
p5-html-stickyquery's People
Forkers
ktatRecommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.