NAME
Net::Jabber::Log - Jabber Log Module
SYNOPSIS
Net::Jabber::Log is a companion to the Net::Jabber module.It provides the user a simple interface to set and retrieve allparts of a Jabber Log.
DESCRIPTION
To initialize the Log with a Jabber <log/> you must pass it theXML::Parser Tree array. For example:my $log = new Net::Jabber::Log(@tree);There has been a change from the old way of handling the callbacks.You no longer have to do the above, a Net::Jabber::Log object is passedto the callback function for the log:use Net::Jabber;sub log {my ($Log) = @_;...}You now have access to all of the retrieval functions available.To create a new log to send to the server:use Net::Jabber;$Log = new Net::Jabber::Log();Now you can call the creation functions below to populate the tag beforesending it.For more information about the array format being passed to the CallBackplease read the Net::Jabber::Client documentation.
Retrieval functions
$from = $Log->GetFrom();$fromJID = $Log->GetFrom("jid");$type = $Log->GetType();$data = $Log->GetData();$str = $Log->GetXML();@log = $Log->GetTree();
Creation functions
$Log->SetLog(type=>"error",from=>"users.jabber.org",data=>"The moon is full... I can't run anymore.");$Log->SetFrom("foo.jabber.org");$Log->SetType("warn");$Log->SetData("I can't find a config file. Using defaults.");
Test functions
$test = $Log->DefinedFrom();$test = $Log->DefinedType();
METHODS
Retrieval functions
GetFrom() - returns either a string with the Jabber Identifier,GetFrom("jid") or a Net::Jabber::JID object for the person whosent the <log/>. To get the JID object setthe string to "jid", otherwise leave blank for thetext string.GetType() - returns a string with the type <log/> this is.GetData() - returns a string with the cdata of the <log/>.GetXML() - returns the XML string that represents the <log/>.This is used by the Send() function in Client.pm to sendthis object as a Jabber Log.GetTree() - returns an array that contains the <log/> tagin XML::Parser Tree format.
Creation functions
SetLog(from=>string|JID, - set multiple fields in the <log/>type=>string, at one time. This is a cumulativedata=>string) and over writing action. If you setthe "from" attribute twice, the secondsetting is what is used. If you setthe type, and then set the datathen both will be in the <log/>tag. For valid settings read thespecific Set functions below.SetFrom(string) - sets the from attribute. You can either pass a stringSetFrom(JID) or a JID object. They must be valid JabberIdentifiers or the server will return an error log.(ie. jabber:[email protected]/Silent Bob, etc...)SetType(string) - sets the type attribute. Valid settings are:notice general loggingwarn warningalert critical error (can still run but notcorrectly)error fatal error (cannot run anymore)SetData(string) - sets the cdata of the <log/>.
Test functions
DefinedFrom() - returns 1 if the from attribute is defined in the<log/>, 0 otherwise.DefinedType() - returns 1 if the type attribute is defined in the<log/>, 0 otherwise.
AUTHOR
By Ryan Eatmon in May of 2000 for http://jabber.org..
COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.