ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/Net-XMPP2/lib/Net/XMPP2/Namespaces.pm
Revision: 1.1
Committed: Tue Jan 23 15:56:47 2007 UTC (19 years, 8 months ago) by elmex
Branch: MAIN
Log Message:
initial checkin.

File Contents

# Content
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 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 roster => 'jabber:iq:roster',
16 version => 'jabber:iq:version',
17 session => 'urn:ietf:params:xml:ns:xmpp-session',
18 xml => 'http://www.w3.org/XML/1998/namespace',
19 );
20
21 =head1 NAME
22
23 Net::XMPP2::Namespaces - A XMPP namespace collection and aliasing class
24
25 =head1 SYNOPSIS
26
27 use Net::XMPP2::Namespaces qw/xmpp_ns set_xmpp_ns_alias/;
28
29 set_xmpp_ns_alias (stanzas => 'urn:ietf:params:xml:ns:xmpp-stanzas');
30 $node->find_all ($p, [xmpp_ns ('stanzas'), 'iq']);
31
32 =head1 DESCRIPTION
33
34 This module represents a simple namespaces aliasing mechanism to ease handling
35 of namespaces when traversing Net::XMPP2::Node objects and writing XML
36 with Net::XMPP2::Writer.
37
38 =head1 XMPP NAMESPACES
39
40 There are already some aliases defined for the XMPP XML namespaces
41 which make handling of namepsaces a bit easier:
42
43 stream => http://etherx.jabber.org/streams
44 xml => http://www.w3.org/XML/1998/namespace
45
46 streams => urn:ietf:params:xml:ns:xmpp-streams
47 session => urn:ietf:params:xml:ns:xmpp-session
48 stanzas => urn:ietf:params:xml:ns:xmpp-stanzas
49 sasl => urn:ietf:params:xml:ns:xmpp-sasl
50 bind => urn:ietf:params:xml:ns:xmpp-bind
51
52 client => jabber:client
53 roster => jabber:iq:roster
54 version => jabber:iq:version
55
56 =head1 FUNCTIONS
57
58 =head2 xmpp_ns ($alias)
59
60 Returns am uri for the registered C<$alias> or undef if none exists.
61
62 =cut
63
64 sub xmpp_ns { return $NAMESPACES{$_[0]} }
65
66 =head2 set_xmpp_ns_alias ($alias, $namespace_uri)
67
68 Sets an C<$alias> for the C<$namespace_uri>.
69
70 =cut
71
72 sub set_xmpp_ns_alias { return $NAMESPACES{$_[0]} }
73
74 =head1 AUTHOR
75
76 Robin Redeker, C<< <elmex at ta-sa.org> >>
77
78 =head1 BUGS
79
80 Please report any bugs or feature requests to
81 C<bug-net-xmpp2 at rt.cpan.org>, or through the web interface at
82 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-XMPP2>.
83 I will be notified, and then you'll automatically be notified of progress on
84 your bug as I make changes.
85
86 =head1 SUPPORT
87
88 You can find documentation for this module with the perldoc command.
89
90 perldoc Net::XMPP2
91
92 You can also look for information at:
93
94 =over 4
95
96 =item * AnnoCPAN: Annotated CPAN documentation
97
98 L<http://annocpan.org/dist/Net-XMPP2>
99
100 =item * CPAN Ratings
101
102 L<http://cpanratings.perl.org/d/Net-XMPP2>
103
104 =item * RT: CPAN's request tracker
105
106 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-XMPP2>
107
108 =item * Search CPAN
109
110 L<http://search.cpan.org/dist/Net-XMPP2>
111
112 =back
113
114 =head1 ACKNOWLEDGEMENTS
115
116 =head1 COPYRIGHT & LICENSE
117
118 Copyright 2007 Robin Redeker, all rights reserved.
119
120 This program is free software; you can redistribute it and/or modify it
121 under the same terms as Perl itself.
122
123 =cut
124
125 1; # End of Net::XMPP2