Declarations
Because Demo::JBook is an Apache handler, it exists as a
Perl module—hence the package declaration at the top
of the file:
package Demo::JBook; use strict; use Jabber::Connection; use Jabber::NodeFactory; use Jabber::NS qw(:iq :misc); use constant SERVER => 'gnu.mine.nu'; use constant USER => 'jbook'; use constant PASS => 'pass'; use constant RESOURCE => 'jbook'; use constant JUD => 'users.jabber.org';
This code exists within the Demo::JBook
package that was declared as the handler for the
http://[
hostname
]/jbook location, shown in
Example 10-5. We’re going to make full use of
the Jabber::Connection library and bring in all
three of its modules for managing the Jabber server connection,
for dispatching elements that arrive (Jabber::Connection),
for building and manipulating elements
(Jabber::NodeFactory), and using common Jabber
programming constants (Jabber::NS). In the case of
Jabber::NS, we need only a few namespaces to
manage our JUD and vCard queries, so the
:iq and :misc tags will be used to refer a collection of constants in Jabber::NS.
The constants
SERVER,
USER,
PASS, and
RESOURCE
define the connection to the Jabber server. This connection
doesn’t have to be made to the JUD that will be queried by
Demo::JBook. By way of illustration, we have
jabber.org’s
JUD (users.jabber.org) specified as the
value for the JUD constant. For the purpose of this example, this will be the JUD that Demo::JBook will query.
You can use the reguser script, described in Section ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access