The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

LCC::Documents - base class for checking document information

SYNOPSIS

 use LCC;
 $lcc = LCC->new( $source, | {method => value} );
 my $documents = $lcc->Documents( $source | {method => value} ); # auto-type
 my $documents = $lcc->Documents( 'type',$source | {method => value} );

DESCRIPTION

The Documents object of the Perl support for LCC. Do not create directly, but through the Documents method of the LCC object.

METHODS

These methods are available to the LCC::Documents object.

browse_url

 $documents->conceptual_url( \&myconceptualurl );
 $coderef = $documents->conceptual_url;

Sets (and/or returns) the subroutine reference of the subroutine that should be called to convert the document ID to a conceptual URL that the LCC will store as an internal ID.

The subroutine should accept the ID as the only parameter and return the conceptual URL that should be stored in the LCC database.

By default, a subroutine that returns the document ID, will be used.

browse_url

 $documents->browse_url( \&mybrowseurl );
 $coderef = $documents->browse_url;

Sets (and/or returns) the subroutine reference of the subroutine that should be called to convert the document ID to a URL that the LCC will store as the URL that users should use to access the document.

The subroutine should accept the ID as the only parameter and return the URL that should be used as URL for the browser.

By default, a subroutine that returns undef will be used, indicating that the browse URL is the same as the fetch_url.

fetch_url

 $documents->fetch_url( \&myfetchurl );
 $coderef = $documents->fetch_url;

Sets (and/or returns) the subroutine reference of the subroutine that should be called to convert the document ID to the URL that the LCC will use to fetch the document.

The subroutine should accept the ID as the only parameter and return the URL that should be used as URL to fetch the document.

By default, a subroutine that returns undef will be used, indicating that the browse URL is the same as the fetch_url.

next_document

 my ($id,$mtime,$length,$md5,$mimetype,$subtype) = $documents->next_document;

This method is called by the LCC::check method to obtain the information about the next document to be checked. Should return an empty list when there are no more documents to be checked.

This method is always implemented by the sub-modules. Please do not call directly.

server

 $documents->server;                          # default to `hostname` and 'html'
 $documents->server( 'www.host.com','html' ); # use specified server and ext

Sets the browse_url subroutine reference to always return undef, so that the browse URL will always be the same as the fetch URL.

Sets the fetch_url subroutine reference to allow for a simple translation from the document ID to a URL that the LCC should use to fetch the document. The input parameter specifies the server name that should be prefixed in the URL. If not specified, the server name will default to what is returned by `hostname`.

Also sets the conceptual_url subroutine reference so that the document ID is returned as the conceptual URL.

AUTHOR

Elizabeth Mattijsen, <liz@dijkmat.nl>.

Please report bugs to <perlbugs@dijkmat.nl>.

COPYRIGHT

Copyright (c) 2002 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

http://lococa.sourceforge.net, the LCC.pm and the other LCC::xxx modules.