Net::Jabber::Query::Time - Jabber IQ Time Module
Net::Jabber::Query::Time is a companion to the Net::Jabber::Query module. It provides the user a simple interface to set and retrieve all parts of a Jabber Time query.
To initialize the Query with a Jabber <iq/> and then access the time query you must pass it the XML::Parser Tree array from the Net::Jabber::Client module. In the callback function for the iq: use Net::Jabber; sub iqCB { my $iq = new Net::Jabber::IQ(@_); my $time = $iq->GetQuery(); . . . } You now have access to all of the retrieval functions available. To create a new Query time to send to the server: use Net::Jabber; $client = new Net::Jabber::Client(); ... $iq = new Net::Jabber::IQ(); $time = $iq->NewQuery("jabber:iq:time"); ... $client->Send($iq); Using $time 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.
$utc = $time->GetUTC(); $timezone = $time->GetTZ(); $display = $time->GetDisplay();
$time->SetTime(utc=>'20000314T09:50:00', tz=>'EST', display=>'2000/03/14 09:50 AM'); $time->SetUTC('20000419T13:05:34'); $time->SetTZ('CST'); $time->SetDisplay('2000/04/19 01:50 PM');
GetUTC() - returns a string with the universal time constant time in the <query/>. GetTZ() - returns a string with the timezone in the <query/>. GetDisplay() - returns a string with the displayin the <query/>.
SetTime(utc=>string, - set multiple fields in the <iq/> at one tz=>string, time. This is a cumulative and over display=>string) writing action. If you set the "utc" twice, the second setting is what is used. If you set the tz, and then set the display then both will be in the <query/> tag. For valid settings read the specific Set functions below. SetUTC(string) - sets the universal time constant time for the <query/>. The format for the UTC is: yyyymmddThh:nn:ss yyyy - year mm - month dd - day hh - hour nn - minute ss - second SetTZ(string) - sets the timezone of the local client in the <query/>. SetDisplay(string) - sets the string to display as the local time in UTC format in the remote client.
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.
To install Net::Jabber, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Jabber
CPAN shell
perl -MCPAN -e shell install Net::Jabber
For more information on module installation, please visit the detailed CPAN module installation guide.