NAME
Net::XMPP::X - XMPP X Module
SYNOPSIS
Net::XMPP::X is a companion to the Net::XMPP module. It
provides the user a simple interface to set and retrieve all
parts of an XMPP X.
DESCRIPTION
Net::XMPP::X differs from the other modules in that its behavior
and available functions are based off of the XML namespace that is
set in it. This module is mainly a place holder for Net::Jabber or
others to inherit and populate with their own namespaces.
Each of these namespaces provide Net::XMPP::X with the functions
to access the data. By using the AUTOLOAD function the functions for
each namespace is used when that namespace is active.
A Net::XMPP can be retrieved from another object passed to a callback
function. Also, the first argument to the callback functions is the
session ID from XML::Streams. There are some cases where you might
want this information, like if you created a Client that connects to
two servers at once, or for writing a mini server.
use Net::XMPP qw(Client);
sub messageCB {
my ($Mess) = @_;
my $x = $Mess->GetX("custom:namespace");
.
.
.
}
You now have access to all of the retrieval functions available.
To create a new x to send to the server:
use Net::XMPP qw(Client);
my $message = new Net::XMPP::Message();
my $x = $message->NewX("other-custom-namespace");
Now you can call the creation functions for the X as defined in the
proper namespace. See below for the general <x/> functions broken down
by namespace.
METHODS
Generic Retrieval functions
GetXMLNS() - returns a string with the namespace of the packet that
the <x/> contains.
$xmlns = $X->GetXMLNS();
GetX(string) - since the behavior of this module depends on the
namespace, an X object may contain X objects. This
helps to leverage code reuse by making children
behave in the same manner. More than likely this
function will never be called.
@x = GetX();
@x = GetX("urn:you:xml:data");
Generic Creation functions
SetXMLNS(string) - sets the xmlns of the <x/> to the string.
$X->SetXMLNS("http://server/unique/path");
CUSTOM NAMESPACES
Part of the flexability of this module is that you can define your own
namespace. For more information on this topic, please read the
Net::XMPP::Namespaces man page.
AUTHOR
Ryan Eatmon
COPYRIGHT
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.