Net::Jabber::X::SXPM::Map - Jabber X SXPM Map Module
Net::Jabber::X::SXPM::Map is a companion to the Net::Jabber::X::SXPM module. It provides the user a simple interface to set and retrieve all parts of a Jabber SXPM Map.
To initialize the Map with a Jabber <x/> and then access the </x> you must pass it the XML::Parser Tree array from the Net::Jabber::Client module. In the callback function for the object type foo: use Net::Jabber; sub foo { my $foo = new Net::Jabber::Foo(@_); my @xTags = $foo->GetX("jabber:x:sxpm"); my $xTag; foreach $xTag (@xTags) { my @maps = $xTag->GetMaps(); my $map; foreach $map (@maps) { $map->GetXXXX(); . . . } } . . . } You now have access to all of the retrieval functions available below. To create a new IQ SXPM Map to send to the server: use Net::Jabber; $Client = new Net::Jabber::Client(); ... $foo = new Net::Jabber::Foo(); $sxpm = $foo->NewX("jabber:x:sxpm"); $foo = $sxpm->AddMap(); ... $client->Send($foo); Using $map 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.
$char = $map->GetChar(); $color = $map->GetColor(); @map = $map->GetTree(); $str = $map->GetXML();
$map->SetMap(char=>"@"); # for erasing a pixel $map->SetMap(char=>"a", color=>"#FFFFFF"); $map->SetChar('b'); $map->SetColor('#FF0000');
GetChar() - returns a string with the character of the <map/>. GetColor() - returns a string with the RGB color of the <map/>. 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.
SetMap(char=>string, - set multiple fields in the <map/> color=>string) at one time. This is a cumulative and overwriting action. If you set the "char" twice, the second setting is what is used. If you set the char, and then set the color then both will be in the <map/> tag. For valid settings read the specific Set functions below. SetChar(string) - sets the character that is associated with this color map entry. SetColor(string) - sets the color that is associated with this color map entry. Must be in RGB #xxxxxx format.
By Ryan Eatmon in January of 2001 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.