NAME

Liz::URLSet - URLSet module


SYNOPSIS

 use Liz::URLSet;

 $url = new Liz::URLSet;


EXAMPLES

 #!/usr/local/bin/perl

 use Liz::URLSet;


DESCRIPTION

The Liz::URLSet package allows for very simple storage of sets of urls. As such it can function as a database for links associated with a client or a project.


Incorporate into Client Module

The Liz::URLSet module itself works best when incorporated into a client module because it moves the responsibility of aquiring a connection to a database to the client module and it allows any customisation to take place transparently to the developer.

Take for example the URLSet method of HN.pm module:

 sub URLSet {

 # Obtain the parameters
 # Start the url using the $hn handle as the database handle
 # Return the finished object

 my( $hn,$token ) = @_;
 my( $urlset ) = Liz::URLSet->new( $token,$hn );
 $urlset;
 }

Because of the above code in HN.pm, it is now possible to write the following code:

 $hn = new HN;
 $urlset = $hn->URLSet( 'technology' );

Note that the database connection of the url is hidden in the creation of the $hn object.


CLASS METHODS

The following methods can be called without an object specification, but as a class method such as Liz::URLSet->method().


urlsets

Return list of url identification names of all urlsets in the database specified. Usually not called by itself, but rather incorporated inside a Client Module.

Input Parameters

 1 wildcard specification to match
   (default: all)
 2 Liz::SQL compatible handle or reference to routine that performs connect
   (default: &Connect from caller's namespace)
Output Parameters

 1 reference to list of identification names in the current database
 2 reference to hash with full names
Example

 $hn = new HN;
 ($id,$name) = $hn->URLSets;
 $urlsets = @{$id};
 print "All $urlsets urlsets in Hospitality Net:\n";
 foreach( @{$id} ) {
   print " URLSet '$$name{$_}' ($_)\n";
 }

In HN.pm:

 sub URLSets { Liz::URLSet->urlsets( $_[1],$_[0] ) }


new

Create a new Liz::URLSet object. Creates connection or re-establishes connection with the MySQL database. Usually not called by itself, but rather incorporated inside a Client Module.

Input Parameters

 1 identification name of url set
   (default: default url set for database)
 2 Liz::SQL compatible handle or reference to routine that performs connect
   (default: &Connect from caller's namespace)
Output Parameters

 1 instantiated object
 2 flag whether URLSet was just created
Example

 $hn = new HN;
 $url = $hn->URLSet( 'technology' );

In HN.pm:

 sub URLSet { Liz::URLSet->new( $_[1],$_[0] ) }


delete

Delete one or more urls from the Liz::URLSet database without first having to create an object for each url to be deleted.

Input Parameters

 1..N url ID's to be deleted
Example

 $hn = new HN;
 $url = $hn->URLSet( 'technology' );
 $url->delete( 3000320,3000321 );


reset

Remove all urls from this URLSet.

Example

 $urlset->reset;
 print "All urls have been removed\n";


CONTENT METHODS

The following methods allow changes to information that is associated with an entire urlset.


Name

Specify or return the current name of the urlset object. The name can be anything to further identify the goal of the urlset.

Input Parameters

 1 new name of urlset
   (default: no change)
Output Parameters

 1 current/old name of urlset
Example

 $xxlink = new xxLINK;
 $urlset = $xxlink->URLSet( 'libris' );
 $urlset->Name( 'Links op de Libris Website' );


HTML METHODS

The following methods create HTML of Liz::Perl's pseudo HTML from information in a urlset.


HREF

Return the almost complete HTML for the display of a link to the url. Use method LINK to obtain the complete HTML for a link.

Input Parameters

 1 ID of the url of which to return the HTML
 2 ALT-text to be used
   (default: alt-text specified with the url)
Output Parameters

 1 almost complete HTML for a link
 2 title of the link in the database
Example

 <A <PRINT "$urlset->HREF( $linkID )">>link</A>


LINK

Return the complete HTML for the display of a link to the url.

Input Parameters

 1 ID of the url of which to return the HTML
 2 ALT-text to be used
   (default: alt-text specified with the url)
 3 Title to be used
   (default: title specified with the URL
Output Parameters

 1 complete HTML for a link
Example

 <PRINT "$urlset->LINK( $linkID )">


URL METHODS

The following methods allow changes to a single url in a URLSet.


URL

Create a new Liz::URLSet::URL object, either from existing information or for a new entry. For more documentation, see the Liz::URLSet::URL object itself.

Input Parameters

 1 ID to create URL object with
   (default: none = new url)
Output Parameters

 1 instantiated URL object
Example

 $hn = new HN;
 $urlset = $hn->URLSet( 'technology' );

 $url = $urlset->URL;
 $url = $urlset->URL( $urlID );


List

Return an SQL statement handle for a list of urls. This list can be either from the top or of all urls immediately belonging to another url.

The following fields may be specified with the 2nd parameter:

 ID
 The ID of the url

 title
 The title of the url

 serverID
 The ID of the server on which the URL is located

 uri
 The part of the URL after the servername

 anchor
 Any internal anchor specification (always begins with "#")

 parameters
 Any extra CGI-like parameters (always begin with "?")

 alt
 The default ALT-texts to be used with this url

 published
 Timestamp value when this url was published

 lastchecked
 Timestamp value when this url was last checked

 created
 Timestamp value when this url was created

 updated
 Timestamp when the url was last updated

 options
 Options associated with the url

 status
 The status of this url
Input Parameters

 1 fields to return (comma delimited)
   (default: 'ID,title,serverID,uri,anchor,parameters,alt,published,lastchecked,created,updated,options,status' );
 2 fieldname on which to order the result
   (default: 'created')
 3 extra condition to be applied
   (default: none)
Output Parameters

 1 SQL statement handle (on which method "fetchrow" can be applied)


AUTHOR

Elizabeth Mattijsen ( lizperl@INC.nl )


COPYRIGHT

(C) 1998-1999 International Network Consultants


HISTORY

Version 0.19, 3 December 1999

Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method new.

Version 0.18, 25 November 1999

Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method URL.

Version 0.17, 30 September 1999

Now no longer puts Exporter in ISA: it was not needed.

Version 0.16, 31 August 1999

Fixed problem introduced on August 20th.

Version 0.15, 20 August 1999

Added support for extra fields to method new.

Version 0.14, 17 August 1999

Method urlsets reduced to a call to Liz::SQL's ``sets''.

Method new now calls Liz::SQL's ``new'' to create object.

Changed to new source typography.

Version 0.13, 14 August 1999

Removed dependency on local GetSetMeta internal subroutine and replaced this with a call to the new method TableMeta of the Liz::SQL module.

Version 0.12, 9 July 1999

Changed CREATE TABLE to new Liz::SQL 'create' method format.

Version 0.11, 23 June 1999

Changed from using method ``Exists'' to ``Count'' in method new to allow for a much faster check on the existence of a table.

Version 0.1, 7 January 1999

First version of this true Perl module.