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
48 $from = $Log->GetFrom();
49 $fromJID = $Log->GetFrom("jid");
50 $type = $Log->GetType();
51 $data = $Log->GetData();
52
53 $str = $Log->GetXML();
54 @log = $Log->GetTree();
55
56 Creation functions
57
58 $Log->SetLog(type=>"error",
59 from=>"users.jabber.org",
60 data=>"The moon is full... I can't run anymore.");
61 $Log->SetFrom("foo.jabber.org");
62 $Log->SetType("warn");
63 $Log->SetData("I can't find a config file. Using defaults.");
64
65 Test functions
66
67 $test = $Log->DefinedFrom();
68 $test = $Log->DefinedType();
69
71 Retrieval functions
72
73 GetFrom() - returns either a string with the Jabber Identifier,
74 GetFrom("jid") or a Net::Jabber::JID object for the person who
75 sent the <log/>. To get the JID object set
76 the string to "jid", otherwise leave blank for the
77 text string.
78
79 GetType() - returns a string with the type <log/> this is.
80
81 GetData() - returns a string with the cdata of the <log/>.
82
83 GetXML() - returns the XML string that represents the <log/>.
84 This is used by the Send() function in Client.pm to send
85 this object as a Jabber Log.
86
87 GetTree() - returns an array that contains the <log/> tag
88 in XML::Parser Tree format.
89
90 Creation functions
91
92 SetLog(from=>string⎪JID, - set multiple fields in the <log/>
93 type=>string, at one time. This is a cumulative
94 data=>string) and over writing action. If you set
95 the "from" attribute twice, the second
96 setting is what is used. If you set
97 the type, and then set the data
98 then both will be in the <log/>
99 tag. For valid settings read the
100 specific Set functions below.
101
102 SetFrom(string) - sets the from attribute. You can either pass a string
103 SetFrom(JID) or a JID object. They must be valid Jabber
104 Identifiers or the server will return an error log.
105 (ie. jabber:bob@jabber.org/Silent Bob, etc...)
106
107 SetType(string) - sets the type attribute. Valid settings are:
108
109 notice general logging
110 warn warning
111 alert critical error (can still run but not
112 correctly)
113 error fatal error (cannot run anymore)
114
115 SetData(string) - sets the cdata of the <log/>.
116
117 Test functions
118
119 DefinedFrom() - returns 1 if the from attribute is defined in the
120 <log/>, 0 otherwise.
121
122 DefinedType() - returns 1 if the type attribute is defined in the
123 <log/>, 0 otherwise.
124
126 By Ryan Eatmon in May of 2000 for http://jabber.org..
127
129 This module is free software; you can redistribute it and/or modify it
130 under the same terms as Perl itself.
131
132
133
134perl v5.8.8 2004-08-16 Net::Jabber::Log(3)