Net::Jabber::IQ::Register - Jabber IQ Registration Module
Net::Jabber::IQ::Register is a companion to the Net::Jabber::IQ module. It provides the user a simple interface to set and retrieve all parts of a Jabber IQ Registration query.
To initialize the IQ with a Jabber <iq/> and then access the register 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 iq { my $iq = new Net::Jabber::IQ(@_); my $register = $iq->GetQuery(); . . . } You now have access to all of the retrieval functions available. To create a new IQ register to send to the server: use Net::Jabber; $Client = new Net::Jabber::Client(); ... $IQ = new Net::Jabber::IQ(); $Register = $IQ->NewQuery("register"); ... $Client->Send($IQ); Using $Register 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.
$username = $Register->GetUsername(); $password = $Register->GetPassword(); $resource = $Register->GetResource(); @register = $Register->GetTree(); $str = $Register->GetXML();
$Register->SetRegister(username=>'test', password=>'user', resource=>'Test Account'); $Register->SetUsername('bob'); $Register->SetPassword('bobrulez'); $Register->SetResource('Bob the Great');
GetUsername() - returns a string with the username in the <query/>. GetPassword() - returns a string with the password in the <query/>. GetResource() - returns a string with the resource in the <query/>. GetXML() - returns the XML string that represents the <presence/>. This is used by the Send() function in Client.pm to send this object as a Jabber Presence. GetTree() - returns an array that contains the <presence/> tag in XML::Parser Tree format.
SetRegister(username=>string, - set multiple fields in the <iq/> password=>string, at one time. This is a cumulative resource=>string) and over writing action. If you set the "username" twice, the second setting is what is used. If you set the password, and then set the resource then both will be in the <query/> tag. For valid settings read the specific Set functions below. SetUsername(string) - sets the username for the account you are trying to connect with. Leave blank for an anonymous account. SetPassword(string) - sets the password for the account you are trying to connect with. Leave blank for an anonymous account. SetResource(string) - sets the resource for the account you are trying to connect with. Leave blank for an anonymous account.
By Ryan Eatmon in December of 1999 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.