1Net::Jabber::Log(3) User Contributed Perl Documentation Net::Jabber::Log(3)
2
3
4
6 Net::Jabber::Log - Jabber Log Module
7
9 Net::Jabber::Log is a companion to the Net::Jabber module.
10 It provides the user a simple interface to set and retrieve all
11 parts of a Jabber Log.
12
14 To initialize the Log with a Jabber <log/> you must pass it the
15 XML::Parser Tree array. For example:
16
17 my $log = new Net::Jabber::Log(@tree);
18
19 There has been a change from the old way of handling the callbacks.
20 You no longer have to do the above, a Net::Jabber::Log object is passed
21 to the callback function for the log:
22
23 use Net::Jabber;
24
25 sub log {
26 my ($Log) = @_;
27 .
28 .
29 .
30 }
31
32 You now have access to all of the retrieval functions available.
33
34 To create a new log to send to the server:
35
36 use Net::Jabber;
37
38 $Log = new Net::Jabber::Log();
39
40 Now you can call the creation functions below to populate the tag before
41 sending it.
42
43 For more information about the array format being passed to the CallBack
44 please read the Net::Jabber::Client documentation.
45
46 Retrieval functions
47 $from = $Log->GetFrom();
48 $fromJID = $Log->GetFrom("jid");
49 $type = $Log->GetType();
50 $data = $Log->GetData();
51
52 $str = $Log->GetXML();
53 @log = $Log->GetTree();
54
55 Creation functions
56 $Log->SetLog(type=>"error",
57 from=>"users.jabber.org",
58 data=>"The moon is full... I can't run anymore.");
59 $Log->SetFrom("foo.jabber.org");
60 $Log->SetType("warn");
61 $Log->SetData("I can't find a config file. Using defaults.");
62
63 Test functions
64 $test = $Log->DefinedFrom();
65 $test = $Log->DefinedType();
66
68 Retrieval functions
69 GetFrom() - returns either a string with the Jabber Identifier,
70 GetFrom("jid") or a Net::Jabber::JID object for the person who
71 sent the <log/>. To get the JID object set
72 the string to "jid", otherwise leave blank for the
73 text string.
74
75 GetType() - returns a string with the type <log/> this is.
76
77 GetData() - returns a string with the cdata of the <log/>.
78
79 GetXML() - returns the XML string that represents the <log/>.
80 This is used by the Send() function in Client.pm to send
81 this object as a Jabber Log.
82
83 GetTree() - returns an array that contains the <log/> tag
84 in XML::Parser Tree format.
85
86 Creation functions
87 SetLog(from=>string|JID, - set multiple fields in the <log/>
88 type=>string, at one time. This is a cumulative
89 data=>string) and over writing action. If you set
90 the "from" attribute twice, the second
91 setting is what is used. If you set
92 the type, and then set the data
93 then both will be in the <log/>
94 tag. For valid settings read the
95 specific Set functions below.
96
97 SetFrom(string) - sets the from attribute. You can either pass a string
98 SetFrom(JID) or a JID object. They must be valid Jabber
99 Identifiers or the server will return an error log.
100 (ie. jabber:bob@jabber.org/Silent Bob, etc...)
101
102 SetType(string) - sets the type attribute. Valid settings are:
103
104 notice general logging
105 warn warning
106 alert critical error (can still run but not
107 correctly)
108 error fatal error (cannot run anymore)
109
110 SetData(string) - sets the cdata of the <log/>.
111
112 Test functions
113 DefinedFrom() - returns 1 if the from attribute is defined in the
114 <log/>, 0 otherwise.
115
116 DefinedType() - returns 1 if the type attribute is defined in the
117 <log/>, 0 otherwise.
118
120 By Ryan Eatmon in May of 2000 for http://jabber.org..
121
123 This module is free software; you can redistribute it and/or modify it
124 under the same terms as Perl itself.
125
126
127
128perl v5.32.0 2020-07-28 Net::Jabber::Log(3)