ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-XMPP2/lib/Net/XMPP2/Namespaces.pm
Revision: 1.9
Committed: Thu Jul 5 19:27:35 2007 UTC (19 years, 2 months ago) by elmex
Branch: MAIN
Changes since 1.8: +1 -1 lines
Log Message:
fixed some typos and such

File Contents

# User Rev Content
1 elmex 1.1 package Net::XMPP2::Namespaces;
2     use warnings;
3     use strict;
4     require Exporter;
5     our @EXPORT_OK = qw/xmpp_ns set_xmpp_ns_alias/;
6     our @ISA = qw/Exporter/;
7    
8     our %NAMESPACES = (
9 elmex 1.6 client => 'jabber:client',
10     stream => 'http://etherx.jabber.org/streams',
11     streams => 'urn:ietf:params:xml:ns:xmpp-streams',
12     stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas',
13     sasl => 'urn:ietf:params:xml:ns:xmpp-sasl',
14     bind => 'urn:ietf:params:xml:ns:xmpp-bind',
15     tls => 'urn:ietf:params:xml:ns:xmpp-tls',
16     roster => 'jabber:iq:roster',
17     version => 'jabber:iq:version',
18     session => 'urn:ietf:params:xml:ns:xmpp-session',
19     xml => 'http://www.w3.org/XML/1998/namespace',
20     disco_info => 'http://jabber.org/protocol/disco#info',
21     disco_items => 'http://jabber.org/protocol/disco#items',
22     register => 'http://jabber.org/features/iq-register',
23 elmex 1.7 iqauth => 'http://jabber.org/features/iq-auth',
24 elmex 1.1 );
25    
26     =head1 NAME
27    
28 elmex 1.9 Net::XMPP2::Namespaces - XMPP namespace collection and aliasing class
29 elmex 1.1
30     =head1 SYNOPSIS
31    
32     use Net::XMPP2::Namespaces qw/xmpp_ns set_xmpp_ns_alias/;
33    
34     set_xmpp_ns_alias (stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas');
35     $node->find_all ($p, [xmpp_ns ('stanzas'), 'iq']);
36    
37     =head1 DESCRIPTION
38    
39     This module represents a simple namespaces aliasing mechanism to ease handling
40     of namespaces when traversing Net::XMPP2::Node objects and writing XML
41     with Net::XMPP2::Writer.
42    
43     =head1 XMPP NAMESPACES
44    
45     There are already some aliases defined for the XMPP XML namespaces
46     which make handling of namepsaces a bit easier:
47    
48     stream => http://etherx.jabber.org/streams
49     xml => http://www.w3.org/XML/1998/namespace
50    
51     streams => urn:ietf:params:xml:ns:xmpp-streams
52     session => urn:ietf:params:xml:ns:xmpp-session
53     stanzas => urn:ietf:params:xml:ns:xmpp-stanzas
54     sasl => urn:ietf:params:xml:ns:xmpp-sasl
55     bind => urn:ietf:params:xml:ns:xmpp-bind
56 elmex 1.2 tls => urn:ietf:params:xml:ns:xmpp-tls
57 elmex 1.1
58     client => jabber:client
59     roster => jabber:iq:roster
60     version => jabber:iq:version
61    
62 elmex 1.8 disco_info => http://jabber.org/protocol/disco#info
63     disco_items => http://jabber.org/protocol/disco#items
64    
65 elmex 1.5 register => http://jabber.org/features/iq-register
66 elmex 1.8 iqauth => http://jabber.org/features/iq-auth
67 elmex 1.5
68 elmex 1.1 =head1 FUNCTIONS
69    
70 elmex 1.8 =over 4
71    
72     =item B<xmpp_ns ($alias)>
73 elmex 1.1
74     Returns am uri for the registered C<$alias> or undef if none exists.
75    
76     =cut
77    
78     sub xmpp_ns { return $NAMESPACES{$_[0]} }
79    
80 elmex 1.8 =item B<set_xmpp_ns_alias ($alias, $namespace_uri)>
81 elmex 1.1
82     Sets an C<$alias> for the C<$namespace_uri>.
83    
84     =cut
85    
86     sub set_xmpp_ns_alias { return $NAMESPACES{$_[0]} }
87    
88 elmex 1.8 =back
89    
90 elmex 1.1 =head1 AUTHOR
91    
92 elmex 1.8 Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >>
93 elmex 1.1
94     =head1 COPYRIGHT & LICENSE
95    
96     Copyright 2007 Robin Redeker, all rights reserved.
97    
98     This program is free software; you can redistribute it and/or modify it
99     under the same terms as Perl itself.
100    
101     =cut
102    
103     1; # End of Net::XMPP2