Liz::FileSet::File - module for File objects of the FileSet
use Liz::FileSet; $fileset = new Liz::FileSet;
$file = $fileset->File; $file = $fileset->File( $fileID );
$file->update;
Provide object oriented access to files in a FileSet. Usually not accessed directly, but rather through the Liz::FileSet object and its File method.
Create a new File object from a FileSet object.
1 Liz::FileSet object 2 ID to created File object with (default: none = new file)
1 instantiated object
It is not intended to call this method directly, but rather indirectly through the Liz::FileSet module.
$fileset = new Liz::FileSet; $file = $fileset->File; $file = $fileset->File( $fileID );
Update a File object in the Liz::FileSet database.
1 ID with which the object was updated (undef = error)
$fileID = $file->update;
Delete a Liz::FileSet::File object from the database.
1 flag: whether action was successful
$file->delete;
The following methods allow you to inspect and/or change certain fields of the Liz::FileSet::File object.
Return the absolute filename of file, specified by ID. Usually used in connection with the AsIs function of Liz::Perl. Use method Contents to obtain the contents of the file.
1 absolute filename of the file
<PERL> AsIs( $file->AbsoluteFileName( $ID ) ); </PERL>
Return or set the Alt (alternate text) information of the Liz::FileSet::File object.
1 new value of the Alt (default: no change)
1 current/old value of the Alt
$file->Alt( $alt ); $alt = $file->Alt;
Return or set the Author information of the Liz::FileSet::File object.
1 new name value of the Author (default: no change)
1 current/old name value of the Author
$file->Author( $author ); $author = $file->Author;
Return the AuthorID information of the Liz::FileSet::File object. It is usually easier and more transparant to use the Author method instead.
1 current value of the AuthorID
$authorID = $file->AuthorID;
Return the number of bytes that are used for the graphics file.
1 number of bytes for the graphics file
$bytes = $file->Bytes;
Return or set the contents of the Liz::FileSet::File object.
1 new value of the contents (default: no change)
1 current/old value of the contents
$file->Contents( $newfile ); $oldfile = $file->Contents;
Return or set the Copyright information of the Liz::FileSet::File object.
1 new name value of the Copyright (default: no change)
1 current/old name value of the Copyright
$file->Copyright( $copyright ); $copyright = $file->Copyright;
Return the CopyrightID information of the Liz::FileSet::File object. It is usually easier and more transparant to use the Copyright method instead.
1 current value of the CopyrightID
$copyrightID = $file->CopyrightID;
Return the Created timestamp of the Liz::FileSet::File object.
1 current timestamp value of the Created date
$created = $file->Created;
Return or set the Data (of which the meaning is entirely up to the developer) of the Liz::FileSet::File object. The maximum amount of data is 64K bytes.
1 new value of Data (default: no change)
1 current/old value of Data
$file->Data( $data ); $data = $file->Data;
Return or set the Extension information of the Liz::FileSet::File object. The Extension information does not necessarily mean anything about the type of contents of the file. Use method MIMEType for that.
1 new value of the Extension (default: no change)
1 current/old value of the Extension
$file->Extension( 'txt' ); $extension = $file->Extension;
Return the ID of the Liz::FileSet::File object.
1 current ID of the object
$ID = $file->ID;
Return or set the MIMEType information of the Liz::FileSet::File object. The MIMEType information indicates the type of contents in the file. Use method Extension to set the extension of the file.
1 new value of the MIMEType (default: no change)
1 current/old value of the MIMEType
$file->MIMEType( 'text/plain' ); $mimetype = $file->MIMEType;
Return or set the Options information of the Liz::FileSet::File object.
1 new name value of the Options (default: no change)
1 current/old name value of the Options
$file->Options( $options ); $options = $file->Options;
Return or set the Published timestamp of the Liz::FileSet::File object.
1 new timestamp value of the Published date (default: no change)
1 current/old timestamp value of the Published date
$file->Published( $published ); $published = $file->Published;
Return or set the Status information of the Liz::FileSet::File object.
1 new value of the Status (default: no change)
1 current/old value of the Status
$file->Status( $status ); $status = $file->Status;
Return or set the Title information of the Liz::FileSet::File object.
1 new title (default: no change)
1 current/old title
$file->Title( 'The next best thing to honey' ); $title = $file->Title;
Return the Updated timestamp of the Liz::FileSet::File object.
1 current timestamp value of the Updated date
$updated = $file->Updated;
Set a number of fields in the object according to a file that was just uploaded with Liz::Perl, as specified by the name of the field in the script with which the file was uploaded.
The following fields will be automatically set when possible: 1 Title (the complete filename on the originating filesystem) 2 Extension (the extension of the uploaded file) 3 File (the contents of the uploaded file)
1 number of bytes in the file (0 if failed)
$bytes = $file->Uploaded( 'file' );
The following methods create HTML of Liz::Perl's pseudo HTML from information in a fileset.
Return the (almost) complete HTML for the display of a link to the file.
1 ALT-text to be used (default: as specified with the file)
1 HTML for a link
<A <PRINT "$file->HREF">>file</A>
Return the (almost) complete HTML for the display of the file as an IMG.
1 ALT-text to be used (default: as specified with the file)
1 HTML for a link
<IMG <PRINT "$file->SRC">>
Elizabeth Mattijsen ( lizperl@INC.nl )
(C) 1998-1999 International Network Consultants
Now no longer adds Exporter to ISA: it wasn't necessary.
Adapted methods new and update so that extra fields are now handled correctly.
Changed to new source typography.
Added documentation for the Title object: it was somehow forgotten and basically only indirectly documented in the Uploaded method.
Fixed problem in method update which would not return the ID of the object if the object was not changed.
Fixed problem that would cause a new file object to be created if a new object was updated, then changed, and then updated again.
Added support and documentation for HREF and SRC methods.
Added support for extra Data associated with the File object.
Fixed problem in Uploaded which would not set the changed flag, hence preventing a file from being updated if it was the only action on the File object.
Renamed method File to the more appropriate Contents.
Added support for method AbsoluteFileName.
Added support for MIME-types with method MIMEType and updated other parts of the module accordingly.
First version of this true Perl module. Copied from the Liz::PictureSet::Picture module, which is less general.