Whatnew - Generate links of recently documents. |
Whatnew - Generate links of recently documents.
$Id: Whatnew.pm,v 1.7 2002/04/20 13:48:24 T.Shigetome Exp $
use Whatnew; my($form) = new Whatnew; my(%config) = ( 'html_root' => '/home/foo/public_html=http://www.any.com/~foo', 'search' => '/home/foo/public_html', 'temp' => '/home/foo/public_html/work/whatnew.tmp', 'template' => '/home/foo/public_html/work/template.html', ); $form->ParseQuery(); $form->SetParameter(\%config); $form->OutResponse();
This is for CGI program. Create links of newest items automatically. If you update some HTML contents on Web server, it will be automatically appended to links. And, you can append topics about update to links. That way is very easy, you just only describe about update information in that HTML file. Update information is described with meta tag in head block.
Like as...
<META name="UpdateInfo" content=" Second update information Also you can describe more than two lines. _ThIs_Is_A_BoUnDaRy_StRiNg_ First update information _ThIs_Is_A_BoUnDaRy_StRiNg_ It's NEW!! _ThIs_Is_A_BoUnDaRy_StRiNg_ ">
Above `_ThIs_Is_A_BoUnDaRy_StRiNg_' is used for boundary string of each update information record.
This module will be used for CGI program. Like as...
http://www.any.com/~foo/cgi-bin/sample.cgi?config=test&func=disp
remote
'.
That value is used for hint of selecting from parameter set. I hope to use with Params.pm.
new([$cgi_object])
my($form) = new Whatnew;
The CGI instance will be created by Whatnew automatically.
or
my($q) = new CGI; my($form) = new Whatnew($q);
SetParameter($rh_para)
my($form) = new Whatnew($q); my(%config) = ( 'html_root' => 'file path=url path', 'search' => 'search file path', 'temp' => 'temporary file', 'template' => 'HTML template', 'remote' => 'http://www.another.server/cgi-bin/sample.cgi?config=configname&func=get', 'hidden' => 'hidden path', 'mask' => 'regular expression for mask', ); $form->SetParameter(\%config);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML lang="en"> <HEAD> <META http-equiv="Content-Type" CONTENT="text/html; charset=ISO-8859-5"> <META name="Author" content="Foo"> <TITLE>What's NEW?</TITLE> <MEATA name="UpdateInfo" content=" What's NEW template _ThIs_Is_A_BoUnDaRy_StRiNg_" > </HEAD> <BODY> <H1>What's NEW?</H1> <HR> <TABLE summary="NEW contents" rule="none" cellspacing="0"> <!-- Following comment statement will be replaced to new documents information. You can customize that. These keywords will be handled about associated document. Like as...
%mtime% : Modified time %URL% : URL %title% : Title in head block of that document %x-meta-updateinfo% : Update information It's described in head block of that document. If you want to use this field, you must append it along specified format when you update document. --> <!-- NEW items <TR> <TD VALIGN="top">%mtime%</TD><TD><P><A HREF="%URL%">%title%</A></P><PRE>%x-meta-updateinfo%</PRE></TD> </TR> NEW items --> </TABLE> <HR> </BODY> </HTML>
func
=get
'.
If you have several server, you can merge to one links page from each server.
If you want to two or more, you can describe separated each one by `;'.
Do NOT insert space character between each define.
There is another way to hide. Describe `NOPICK' as update information. That content will be ignored. Basically you should not use this way, it is heavy.
Above delimiter string that is `;' is defined by `$Params::delimiter
' in Params.pm.
OutResponse()
func
'.
config()
Like as... sample.cgi
use Whatnew; my($form)= new Whatnew; $form->ParseQuery(); local($main::configname) = $form->config(); $form->SetParameter("sample.par"); $form->OutResponse();
sample.par
######################################################## #if $main::configname eq 'test' #define CONFIG_NAME test #endif #define ROOTPATH /home/foo/public_html #define WORKPATH %ROOTPATH%/work #define HTML_ROOT http://www.any.com/~foo # 12*60*60 # # define config1 parameters # # # File path to HTML root # %CONFIG_NAME% html_root{ %ROOTPATH%=%HTML_ROOT%; }; # # temporary file # %CONFIG_NAME% temp{ %WORKPATH%/whatnew.tmp; }; # # HTML template # %CONFIG_NAME% template{ %WORKPATH%/template.html; }; # # Common update information # %CONFIG_NAME% search{ %ROOTPATH%; }; # # No care directries # %CONFIG_NAME% hidden{ %ROOTPATH%/debug; }; %CONFIG_NAME% mask{ template\.html; test; };
charset($ocode)
debug($debug_opt)
$form->debug('configpara'); $form->debug('remote'); $form->debug('search'); $form->debug('template');
Message of debugging will be outputted to STDERR. Also. you can log by redirect STDERR with debuglog.pl or other.
When you terminate debugging, you can strip debugging code from this module. All of debugging code are between line of `#>>>DEBUG_CODE'. These are able to strip by striper.pl.
strict.pm, Carp.pm, CGI.pm, HTML::HeadParser.pm, Params.pm, Timestr.pm,
Following modules are used for get from remote. So, if you want to get update information from other server, you must use these modules yourself.
LWP::UserAgent, HTTP::Request, HTTP::Message,
Params.pm, Timestr.pm, CGI.pm
Tetsuya Shigetome, <t_shigetome@muf.biglobe.ne.jp>.
History.pm
Some variable is globalised.
Fixed bugs
o Sort order is not numerically.
Compliant Timestr.pm and Params.pm. I hope, it's given simplified to use parameter file.
o Fixed problem of Server error 500 when get from remote.
Revision 1.4 2001/05/19 16:54:03 shige
o Correct corrupt problem when comment avail after replace keyword.
o Change some comments.
o Correct merge display problem. o Change to sepcify debug options. o Some new capables Support convert code. Support hide temporary.
First of Perl module version
Whatnew - Generate links of recently documents. |