History - Update history of contents for CGI.

Access counter


SYNOPSIS

        use Whatnew;
        use History;
        my($html_root);
        $html_root = '/home/foo/public_html';
        my(%config) = (
                'link'          =>      'rel',
                'html_root'     =>      "$html_root=http://www.any.com/~foo";,
                'path'          =>      "$html_root",
                'template'      =>      "history=$html_root/work/histmpl.html;index=$html_root/work/idxtmpl.html",
                'records'       =>      "$html_root/work/whatnew.tmp",
                'index'         =>      "$html_root/work/history.idx=$html_root/history.html",
        );
        my($form) = new History;
        $form->ParseQuery();
        $form->SetParameter(\%config);
        $form->OutResponse();


DESCRIPTION

This is for CGI program, but may be used only by author. This will create update history from temporary file of Whatnew.pm. I think the Whatnew.pm has enough capability. But the Whatnew.pm forget expired old informations. This is for keep that information to permanent file. That permanent file is as HTML file. Also, if you require, you can modify saved file. This ability will give flexibility to your contents.

CGI ARGUMENT

This module will be used for CGI program. Like as...

        http://www.any.com/~foo/cgi-bin/sample.cgi?config=test;func=history

or

        http://www.any.com/~foo/cgi-bin/sample.cgi?config=test;func=index
func
There are two functions available.
history
Append new update informations to history files. If there is no history file, it will be created in specified path. Update informations are formatted with template file. Each history files can contain up to 10 entries. When it reach to limit, next one will be created.

index
Create index list of update history files. Will be re-indexed all files whenever execute this function.

config
Value of `config' in QUERY STRING.

That value is used for hint of selecting from parameter set. I hope to use with Params.pm.

METHOD

new([$cgi_object])
Create new instance
        my($form) = new History;

or

        my($q) = new CGI;
        my($form) = new History($q);

ParseQuery
Parse QUERY_STRING

config
Return configuration name of `config' from CGI query string. I think, that configuration name is useful with Params.pm. ;)

Like as... sample.cgi

        use Whatnew;
        use History;
        my($html_root) = '/home/foo/public_html';
        my($CONFIG_FILE) = "$html_root/work/sample.par";
        my($form) = new History;
        $form->ParseQuery();
        $main::configname = $form->config();
        $form->SetParameter($CONFIG_FILE);
        $form->OutResponse();

sample.par

        ###########################################
        # History sample paramter file
        #
        #define HTML_ROOT       /home/foo/public_html
        #define WORKPATH %HTML_ROOT%/work
        #if $main::configname eq 'test'
        #       define  CONFIG_NAME     test
        #endif
        ###########################################
        # common define
        %CONFIG_NAME%   link{
                rel;
        };
        %CONFIG_NAME%   html_root{
                %HTML_ROOT%=http://www.any.com/~foo
        };
        %CONFIG_NAME%   path{
                %HTML_ROOT%;
        };
        %CONFIG_NAME%   template{
                history=%WORKPATH%/histmpl.html;
                index=%WORKPATH%/idxtmpl.html;
        };
        ###########################################
        test    records{
                %WORKPATH%/whatnew.tmp;
        };
        test    index{
                %WORKPATH%/history.idx=%HTML_ROOT%/history.html;
        };

SetParameter($rh_para)
Setup of parameter. The $rh_para is reference of hash or a file name of parameter file. If you specify a parameter file name, that parameter file will be parsed with Params.pm.
        my($html_root);
        $html_root = '/home/foo/public_html';
        my(%config) = (
                'link'          =>      'rel',
                'html_root'     =>      "$html_root=http://www.any.com/~foo";,
                'path'          =>      "$html_root",
                'template'      =>      "history=$html_root/work/histmpl.html;index=$html_root/work/idxtmpl.html",
                'records'       =>      "$html_root/work/whatnew.tmp",
                'index'         =>      "$html_root/work/history.idx=$html_root/history.html",
        );
        my($form) = new History;
        $form->ParseQuery();
        $form->SetParameter(\%config);

or

        my($CONFIG_FILE) = "$html_root/work/sample.par";
        my($form) = new History;
        $form->ParseQuery();
        $main::configname = $form->config();
        $form->SetParameter($CONFIG_FILE);
link
Specify mode of path relative or absolute. The `rel' is relative URL, and the `abs' is absolute URL.

html_root
Specify file path connection with URL path.

path
Specify path for files that generated by this.

template
Specify template files for history files and index files. Each template file names join keywords by `='. Like as...
        `history=histmpl.html;index=idxtmpl.html'

The `histmpl.html' is for history file, and the `idxtmpl.html' is for index file.

You can easily customize template. Sample is following.

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
        <HTML>
        <HEAD>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
        <TITLE>Update history index</TITLE>
        <!--
                Update history sample template
        -->
        </HEAD>
        <BODY>
        <H1>Update history</H1>
        <HR>
        <TABLE summary="Update history">
        <!--
                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 0 0
        <TR>
        <TD VALIGN="top">%mtime%</TD><TD VALIGN="top">:</TD><TD><P><A HREF="%URL%">%title%</A></P><PRE>%x-meta-updateinfo%</PRE></TD>
        </TR>
        NEW items to above -->
        </TABLE>
        <HR>
        </BODY>
        </HTML>

records
Specify update information records that is created by Whatnew.pm. If you want to two or more, you can describe separated each one by `;'. Do NOT insert space character between each define.

You can use URLs, if you use merge function in the Whatnew. For example...

        http://www.another.com/~foo/cgi-bin/whatnew.cgi&;config=another;func=get

index
Specify temporary file of index and final formatted index file.

OutResponse
Output result as response along specified function by`func'.

debug
Toggle each debug condition. Default is debug off.
configpara
Debug of parameter.

template
Debug of parsing template.

history
Debug of history information append.

index
Debug of generating index.

remote
Debug of getting records via HTTP.

records
Debug of record


SEE ALSO

Whatnew.pm, Params.pm, Timestr.pm, CGI.pm, URI.pm


AUTHOR

Tetsuya Shigetome, <t_shigetome@muf.biglobe.ne.jp>.


HISTORY

$Revision: 1.2 $
$Log: History.pm,v $ Revision 1.2 2002/04/20 13:34:21 T.Shigetome Fixed bugs

o Sort order is not numerically.

o Foever loop in UpdateHistory.

Compliant

Whatnew.pm and Params.pm

Revision: 1.1
Log: History.pm,v Revision 1.1 2001/03/31 13:42:57 shige

First release of History.pm

 History - Update history of contents for CGI.