DOKK / manpages / debian 12 / libnet-jabber-perl / Net::Jabber::Log.3pm.en
Net::Jabber::Log(3pm) User Contributed Perl Documentation Net::Jabber::Log(3pm)

Net::Jabber::Log - Jabber Log Module

  Net::Jabber::Log is a companion to the Net::Jabber module.
  It provides the user a simple interface to set and retrieve all 
  parts of a Jabber Log.

  To initialize the Log with a Jabber <log/> you must pass it the 
  XML::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 passed
  to 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 before
  sending it.
  For more information about the array format being passed to the CallBack
  please 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();

Retrieval functions

  GetFrom()      -  returns either a string with the Jabber Identifier,
  GetFrom("jid")    or a Net::Jabber::JID object for the person who
                    sent the <log/>.  To get the JID object set 
                    the string to "jid", otherwise leave blank for the 
                    text 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 send
             this object as a Jabber Log.
  GetTree() - returns an array that contains the <log/> tag
              in XML::Parser Tree format.

Creation functions

  SetLog(from=>string|JID, - set multiple fields in the <log/>
         type=>string,       at one time.  This is a cumulative
         data=>string)       and over writing action.  If you set
                             the "from" attribute twice, the second
                             setting is what is used.  If you set
                             the type, and then set the data
                             then both will be in the <log/>
                             tag.  For valid settings read the
                             specific Set functions below.
  SetFrom(string) - sets the from attribute.  You can either pass a string
  SetFrom(JID)      or a JID object.  They must be valid Jabber 
                    Identifiers or the server will return an error log.
                    (ie.  jabber:bob@jabber.org/Silent Bob, etc...)
  SetType(string) - sets the type attribute.  Valid settings are:
                    notice     general logging
                    warn       warning
                    alert      critical error (can still run but not 
                               correctly)
                    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.

By Ryan Eatmon in May of 2000 for http://jabber.org..

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2022-06-16 perl v5.34.0