File Coverage

blib/lib/POE/Filter/XML/NS.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package POE::Filter::XML::NS;
2             {
3             $POE::Filter::XML::NS::VERSION = '1.140700';
4             }
5              
6             #ABSTRACT: Provides constants that return appropriate namespace strings
7              
8 1     1   1107 use strict;
  1         2  
  1         44  
9 1     1   5 use warnings;
  1         8  
  1         110  
10              
11             use constant {
12 1         505 XMLNS_STREAM => 'http://etherx.jabber.org/streams',
13            
14             NS_JABBER_CLIENT => 'jabber:client',
15             NS_JABBER_COMPONENT => 'http://jabberd.jabberstudio.org/ns/component/1.0',
16             NS_JABBER_ACCEPT => 'jabber:component:accept',
17             NS_JABBER_CONNECT => 'jabber:component:connect',
18             NS_JABBER_DIALBACK => 'jabber:server:dialback',
19              
20             NS_JABBER_AUTH => 'jabber:iq:auth',
21             NS_JABBER_REGISTER => 'jabber:iq:register',
22             NS_JABBER_DISCOINFO => 'http://jabber.org/protocol/disco#info',
23             NS_JABBER_DISCOITEMS => 'http://jabber.org/protocol/disco#items',
24             NS_JABBER_ROSTER => 'jabber:iq:roster',
25              
26             NS_XMPP_SASL => 'urn:ietf:params:xml:ns:xmpp-sasl',
27             NS_XMPP_TLS => 'urn:ietf:params:xml:ns:xmpp-tls',
28             NS_XMPP_BIND => 'urn:ietf:params:xml:ns:xmpp-bind',
29             NS_XMPP_STANZA => 'urn:ietf:params:xml:ns:xmpp-stanzas',
30             NS_XMPP_SESSION => 'urn:ietf:params:xml:ns:xmpp-session',
31             NS_XMPP_STREAMS => 'urn:ietf:params:xml:ns:xmpp-streams',
32             NS_XMPP_OTHER => '##other',
33              
34             IQ_GET => 'get',
35             IQ_SET => 'set',
36             IQ_ERROR => 'error',
37             IQ_RESULT => 'result',
38              
39 1     1   6 };
  1         1  
40              
41             require Exporter;
42             our @ISA = qw/ Exporter /;
43              
44             our @EXPORT_OK = qw/ NS_JABBER_CLIENT NS_JABBER_ACCEPT
45             NS_JABBER_CONNECT NS_JABBER_COMPONENT NS_XMPP_SASL
46             NS_JABBER_DISCOINFO NS_JABBER_DISCOITEMS
47             IQ_GET IQ_SET IQ_ERROR IQ_RESULT NS_JABBER_AUTH NS_JABBER_REGISTER
48             NS_DISCOINFO NS_DISCOITEMS XMLNS_STREAM NS_JABBER_ROSTER
49             NS_XMPP_STANZA NS_XMPP_OTHER NS_XMPP_SESSION NS_XMPP_BIND NS_XMPP_TLS
50             NS_XMPP_STREAMS/;
51              
52             our %EXPORT_TAGS = (
53             JABBER => [
54             qw/ NS_JABBER_DISCOINFO NS_JABBER_DISCOITEMS NS_JABBER_AUTH
55             NS_JABBER_REGISTER NS_JABBER_CLIENT XMLNS_STREAM
56             NS_JABBER_ROSTER NS_JABBER_ACCEPT NS_JABBER_CONNECT
57             NS_JABBER_COMPONENT NS_XMPP_SASL NS_XMPP_STANZA
58             NS_XMPP_TLS NS_XMPP_BIND NS_XMPP_SESSION NS_XMPP_OTHER
59             NS_XMPP_STREAMS/
60             ],
61             IQ => [
62             qw/ IQ_GET IQ_SET IQ_ERROR IQ_RESULT /
63             ]);
64            
65             my %seen;
66            
67             push @{$EXPORT_TAGS{'all'}},
68             grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS;
69              
70             1;
71              
72              
73              
74             =pod
75              
76             =head1 NAME
77              
78             POE::Filter::XML::NS - Provides constants that return appropriate namespace strings
79              
80             =head1 VERSION
81              
82             version 1.140700
83              
84             =head1 SYNOPSIS
85              
86             use POE::Filter::XML::NS qw/ :JABBER :IQ /;
87              
88             =head1 DESCRIPTION
89              
90             POE::Filter::XML::NS provides namespace constants for use within
91             POE::Filter::XML::Nodes (or any other representation) that requires namespace
92             matching. The following export tags are explained below:
93              
94             =over 4
95              
96             =item :JABBER
97              
98             ":JABBER" tag will import various useful constants for use within a normal
99             Jabber client and component(to reference implementation server) situation.
100              
101             =item ":IQ"
102              
103             ":IQ" tag imports convenience <iq/> packet types such as set, get, result, and
104             error
105              
106             =item ":all"
107              
108             ":all" will import every tag available within the package.
109              
110             =back
111              
112             Please reference the source file to know which namespaces are explictly
113             supported and exported.
114              
115             =head1 AUTHOR
116              
117             Nicholas R. Perez <nperez@cpan.org>
118              
119             =head1 COPYRIGHT AND LICENSE
120              
121             This software is copyright (c) 2014 by Nicholas R. Perez <nperez@cpan.org>.
122              
123             This is free software; you can redistribute it and/or modify it under
124             the same terms as the Perl 5 programming language system itself.
125              
126             =cut
127              
128              
129             __END__
130