my $o = Whatsnew->new(
target=>'/full_path_to/whatsnew.html',
limit => 20,
);
$o->add(
link_url => 'http://nowhere.com/new_index.html',
link_title => 'New link',
dir_url => 'http://nowhere.com',
dir_title => 'The main Dir',
description => 'This is a description of the new link',
);
$o->delete(
link_url => 'http://nowhere.com/index.html'
);
$o->save;
The idea is to have a html file with special format (I made it with table), which is updated automatically when some change to your WWW site is done. Just add a little snippet of code to the function that changes the site (writes/deletes the file) to call this module, or run it manually in case you are the one who perform the changes.
The number of links to keep is specified by 'limit' parameter of the
new() method If you add a link and your list of links cross
the limit the oldest links will be removed (the ones at the bottom). The
fresh links go to the top of the list.
The date of modification is automatically handled by the module, the html shows the modification dates.
When you do update, there is a big chance that the link is still on the
whatsnew page. But you don't have to try to delete the previous version of
the link, Whatsnew does it automatically, when you call the
add() method, Whatsnew first deletes the previous instance of
the link if it finds such.
After you create call new() method, you can add/delete as many
links as you want and only when you call save() method the
file will be updated and saved to the disk.
my $o = Whatsnew->new(
target=>'/full_path_to/whatsnew.html',
limit => 20,
);
target is the full path to the file you want to work with (perl will die of the file will be not in place or it'll be inaccessable )
limit is optional parameter, the default is specified by LIMIT_DEFAULT (=10). It tells how many links to keep on the page. When one cross the limit, the oldest files are getting deleted
add a new item to top of list of links. delete the old one if it existed before on the list. The link_url parameter is unique per whatsnew file.
$o->add(
link_url => 'http://nowhere.com/new_index.html',
link_title => 'New link',
dir_url => 'http://nowhere.com',
dir_title => 'The main Dir',
description => 'This is a description of the new link',
);
link_url - the URL of the updated link (it's the key of the whole item)
link_title - the title of the URL, the string that user will see
dir_url - the URL of the parent Directory so user will be able to go directly to the updated directory
dir_title - the title of the parent directory, the string that user will see
description - when user put mouse over the link_url, the description will show up at the status bar of the browser (browser version < 4 of netscape/explorer) or in a new layer (similar to ALT) using the dynamic html (browser version >= 4 of netscape/explorer)
Delete some item from the list of links. The item is identified by the unique link_url.
$o->delete(
link_url => 'http://nowhere.com/index.html'
);
link_url - pass the link_url of the item you want to delete
or directly
$o->delete('http://nowhere.com/index.html');
save the modified html into target file. This method was added to allow perfoming more than one add/delete operation at once. So you can call a few add() and delete() methods and when you have finished call the save() method to save the changes.
$o->save;
use Whatsnew;
my $o = Whatsnew->new(
target=>'/full_path_to/whatsnew.html',
limit => 20,
);
$o->add(
link_url => 'http://nowhere.com/new_index.html',
link_title => 'New link',
dir_url => 'http://nowhere.com',
dir_title => 'The main Dir',
description => 'This is a description of the new link',
);
$o->save;
use Whatsnew;
my $o = Whatsnew->new(
target=>'/full_path_to/whatsnew.html',
limit => 20,
);
$o->delete(
link_url => 'http://nowhere.com/index.html'
);
$o->save;
use Whatsnew;
my $o = Whatsnew->new(
target=>'/full_path_to/whatsnew.html',
limit => 20,
);
$o->add(
link_url => 'http://nowhere.com/new_index.html',
link_title => 'New link',
dir_url => 'http://nowhere.com',
dir_title => 'The main Dir',
description => 'This is a description of the new link',
);
$o->delete(
link_url => 'http://nowhere.com/index.html'
);
$o->save;
use Whatsnew;
Whatsnew->new ( target=>'/full_path_to/whatsnew.html', limit => 20, )->add ( link_url => 'http://nowhere.com/new_index.html', link_title => 'New link', dir_url => 'http://nowhere.com', dir_title => 'The main Dir', description => 'This is a description of the new link', )->delete ( link_url => 'http://nowhere.com/index.html' )->save;
new(target=>'path/file') specify
in the target the real file you want to edit
See the ./tmpl/whatsnew.shtml (see the includes)
<HTML> YOUR HEADER custom html code and other stuff <!--end of top--> Here Whatsnew will write the dynamic content <!--start of bottom--> Your BOTTOM custom html codeand other stuff </HTML>
See the ./tmpl/whatsnew.html template file
* Complete rewrite to make it OO Perl designed * New parsing scheme * Dynamic target and limit value specification
04/18/97 by Stas, Bekman <stas@stason.org>
* Internal locking, * Custom Deletion, * Converted to perl5
11/14/97 by Stas, Bekman <stas@stason.org>
* The first draft has been written
09/04/97 by Stas, Bekman <stas@stason.org>
perl(1).