Liz::Forum::Message - module for Message objects at the Forum site
use Liz::Forum; $forum = new Liz::Forum;
$message = $forum->Message; $message = $forum->Message( $messageID );
$message->update;
Provide object oriented access to the Message table of the Hospitality Net website. Usually not accessed directly, but rather through the Liz::Forum object and its Message method.
Create a new Forum Message object from a Forum object.
1 Liz::Forum object 2 ID to created Message object with (default: none = new message)
1 instantiated object
It is not intended to call this method directly, but rather indirectly through the Liz::Forum module.
$forum = new Liz::Forum; $message = $forum->Message; $message = $forum->Message( $messageID );
Create a new Forum Message object from a Forum object and a Liz::Mail object.
1 Liz::Forum object 2 Liz::Mail object
1 instantiated Liz::Forum::Message object
Update a Forum Message object in the Liz::Forum database.
1 ID with which the object was updated
$message->update;
Delete a Liz::Forum::Message object from the database.
1 flag: whether action was successful
$message->delete;
Reset all message information in the forum.
$forum->reset; print "All messages has been removed\n";
The following methods allow changes to information that is associated with the message object.
Set or return the AuthorID information of the message object.
1 current value of the AuthorID
$message->AuthorID( $authorID ); $authorID = $message->AuthorID;
Specify the body of the message. Look at method HTML also if you would like to send an alternate version of the message in HTML format.
1 new body (default: no change)
1 current/old body
$message->Body( <<EOD ); Hi,
what do you think of this message? It was created with the Liz::Forum::Message module!
Kind regards,
Liz EOD
Return the Created timestamp of the message object.
1 current timestamp value of the Created date
$created = $message->Created;
Return or set the DirectorMessage information of the message object. The meaning is entirely up to the developer, but is generally intended to indicate some judgement on the contents of the message by the people maintaining the forum.
1 new value of the DirectorMessage (0..255) (default: no change)
1 current/old value of the DirectorMessage
$message->DirectorMessage( 1 ); $directormessage = $message->DirectorMessage;
Create a Liz::FileSet::File object for a new file associated with the object, or create a Liz::FileSet::File object for an existing file associated with the object, specified by its ID.
Use method FileIDs to obtain the list of IDs of files associated with the object.
Liz::FileSet::File objects created in this way, are automatically updated when the Message object is updated.
1 ID for existing associated file (default: create a new Liz::FileSet::File object)
1 instantiated Liz::FileSet::File compatible object
$file = $message->File; $file->Title( 'image.jpg' ); $file->Extension( 'jpg' ); $file->MIMEType( 'image/jpeg' ); $file->Contents( $contents ); $message->update;
($fileID) = $message->FileIDs; $file = $message->File( $fileID ); $contents = $message->File( $fileID )->Contents;
Return the ID's of the Liz::FileSet::File objects that are associated with this object. Use method File to obtain the Liz::FileSet::File object with the ID specified.
1..N ID's of associated Liz::FileSet::File objects
foreach( $message->FileIDs ) {
$message->File( $_ )->Get( qw(Title MIMEType Bytes) );
print "$title ($mimetype,$bytes bytes)\n";
}
Specify the foreign key of the message. It is an additional means to identify a message in a forum, just as the ID.
The purpose of the foreign key is entirely up to the developer. When a message is converted from a Liz::Mail object with the receive method, then this method returns the value of the Message-Id field in the header of the email message.
1 new value of foreign key (default: no change)
1 current/old value of foreign key
$foreignkey = $message->ForeignKey; $message->ForeignKey( '358jhkjs89878ahkjj' );
Specify the header of the message. Look at method Body to specify the body of the message.
The purpose of the Header is entirely up to the developer. When a message is converted from a Liz::Mail object with the receive method, then this method returns the full header of the email message.
1 new contents of Header (default: no change)
1 current/old contents of Header
$header = $message->Header; $message->Header( "This is a custom header\n" );
Specify the body of the message in HTML-format. This is an alternative version of the text specified with the Body method.
When a message object is created from a Liz::Mail object with the receive method, then this method returns the HTML-version of the email message when available.
1 new HTML-version of the body (default: no change)
1 current/old HTML-version of the body
$mail->HTML( <<EOD ); <HTML><BODY BGCOLOR="yellow"> Hi, <P> what do you think of this message? It was created with the Liz::Forum::Message module! <HR> Kind regards,
<I>Liz</I> </BODY></HTML> EOD
Although intended for the HTML-version of the message, this field can of course be (ab)used for anything the developer likes.
Return the ID of the message object. Please note that this value is only set after the first time the object is updated to the database with the update method.
1 current ID of the object
$ID = $message->ID;
Set or return the Options of the Message object.
1 new value of Options (default: no change)
1 old/current value of Options
$message->Options( $options ); $options = $message->Options;
Return or set the Published timestamp of the message object.
1 new timestamp value of the Published date (default: no change)
1 current/old timestamp value of the Published date
$message->Published( $published ); $published = $message->Published;
Return or set the Status information of the message object. The meaning is entirely up to the developer.
1 new value of the Status (0..255) (default: no change)
1 current/old value of the Status
$message->Status( $status ); $status = $message->Status;
Specify/Return the Subject: of the message object. This can also be done when the object is created with the new method.
1 new subject (default: no change)
1 current/old subject
$message->Subject( 'About this and that' ); $subject = $message->Subject;
Remove a Liz::FileSet::File object associated with the object, specified by its ID.
Use method FileIDs to obtain the list of IDs of files associated with the object.
1..N ID's for existing associated files
$message->UnFile( $fileID );
Return the Updated timestamp of the message object.
1 current timestamp value of the Updated date
$updated = $message->Updated;
Elizabeth Mattijsen ( lizperl@INC.nl )
(C) 1998-1999 International Network Consultants
Put module name between quotes to fix obscure bug in Perl 5.005x under ModPerl in method reset.
Now no longer adds Exporter to ISA: it wasn't necessary.
Any errors obtaining an existing record now sets the global variable ERROR with the error message (method new).
Removed references to the old Attachments table in method new.
Adapted new and update so that the entire module can be subclassed with extra fields without having create specific ``new'' and ``update'' methods.
Changed typography of the source to the new indented format.
Fixed problem in method update which would not return the ID of the object if the object was not changed.
Method delete now properly deletes any associated files also.
Moved main part of File, FileIDs and UnFile to Liz::Forum. Only stubs remain if applicable.
Fixed problem with DirectorMessage that was introduced on April 9th.
Now inherits from Liz::Forum.
Now also imports the internal field LANGUAGE in methods new and receive so that language settings are inherited.
Added documentation for all possible methods for the message object, even the AUTOLOADed ones.
Added support for HTML-version for a message, to maintain compatibility with Liz::Mail. The HTML version of a message can be specified with the new HTML method.
Adapted method receive to Liz::Mail 2.0.
Adapted method receive to the new File method.
Added method UnFile: remove the indicated file and its connection to the object.
Added method FileIDs: return list of ID's of Liz::FileSet::File objects that are associated with the object.
Changed method File to return a Liz::FileSet::File object, instead of doing propriatary things. This is ** INCOMPATIBLE ** with the previous version, but a preliminary investigation revealed that the old method had only been used in situations that can be easily mended.
Fixed problem with receive if the From email address included a name also.
Fixed problem with method Options which would take the options of the Forum object, instead of the message object itself.
Support for Status added.
Support for foreign keys added.
Method receive now stores the Message-ID of a mail header (e.g. when obtained from a mailing list or a news group) in the ForeignKey so that it can be easily used for searching later on.
New method ForeignKey added: set or return the foreign key of the message.
Reduced memory footprint by fully qualifying global variables and external subroutines.
Method update now returns the ID with which the object was created.
Fixed problems in File and update. File attachments to messages now finally work.
Fixed problem in File. Also added last updated information in the output parameters.
Changed attachment table name to xxx__Attachments.
Method update now collects any possible error messages and stores the in the ERROR field for later use.
New method receive: create a Liz::Forum::Message object from a Liz::Mail object.
Changed methods new, File and update so that attached files are updated to the database at the moment an update is done, not before.
Updated to new Bulk method.
First version of this true Perl module.