NAME
Netscape::History - object class for accessing Netscape history database
SYNOPSIS
use Netscape::History;
$history = new Netscape::History();
while (defined($url = $history->next_url() ))
{
}
DESCRIPTION
The Netscape::History
module implements an object class for accessing the history database maintained by the Netscape web browser. The history database keeps a list of all URLs you have visited, and is used by Netscape to change the color of URLs which you have previously visited, for example.
CONSTRUCTOR
$history = new Netscape::History();
This creates a new instance of the Netscape::History object class.
METHODS
The Netscape::History class implements the following methods:
rewind - reset history database to first URL
next_url - get next URL from your history
delete_url - remove a URL from your history
close - close the history database
Each of the methods is described separately below.
next_url - get the next URL from your history database
$url = $history->next_url();
This method returns the next URL from your history database. If you want to process all URLs in the database, you should call the rewind method before looping over all URLs.
The URL returned is an instance of the Netscape::HistoryURL class, which works just like an instance of URI::URL, but provides an extra method visit_time(). This returns the time of your last visit to that URL.
delete_url - remove a URL from the history database
$history->delete_url($url);
This method is used to remove a URL from your history database. The URL passed can be a simple text string with the URL, or an instance of Netscape::HistoryURL, URI::URL, or any other class which can be rendered into a string.
rewind - reset internal URL pointer to first URL in history
$history->rewind();
This method is used to move the history database's internal pointer to the first URL in your history database. You don't need to bother with this if you have just created the object, but it doesn't harm anything if you do.
close - close the history database
$history->close();
This closes the history database. The destructor will do this automatically for you, so most of time you don't actually have to bother calling this method explicitly. Good programming style says you should though :-)
EXAMPLE PROGRAM
The following example illustrates use of this module, and the visit_time() method of the URLs returned. The program will list all URLs visited, along with visit time. The Date::Format module is used to format the visit time.
#!/usr/bin/perl -w
use Netscape::History;
use Date::Format;
use strict;
my $history;
my $url;
$history = new Netscape::History;
while (defined($url = $history->next_url() ))
{
print "$url : ", ctime($url->visit_time());
}
$history->close();
SEE ALSO
- Netscape::HistoryURL
-
When you call the next_url method, you are returned instances of this class.
- URI::URL
-
The underlying class for Netscape::HistoryURL, which provides the mechanisms for manipulating URLs.
- Date::Format
-
Functions for formatting time and date in strings.
AUTHOR
Neil Bowers <neilb@cre.canon.co.uk>, and Richard Taylor <rit@cre.canon.co.uk>.
COPYRIGHT
Copyright (c) 1997 Canon Research Centre Europe. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.