XMPP/Extendable.pm

filter: Statementstmt 50.0% 7 / 14 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 100% 2 / 2 totaltotal 47.8% 11 / 23 CC 2 SCAR 11.0
CC
2
Cov
44%
__ANON__
6.0
add_extension
2.0
remove_extension
2.0
CRAP 3.0
« XMPP/Error/IQAuth.pm ↑ Summary XMPP/SimpleConnection.pm »
1 package AnyEvent::XMPP::Extendable;
2 1 ▶no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 AnyEvent::XMPP::Extendable - Extendable baseclass
8  
9 =head1 DESCRIPTION
10  
11 This class provides a mechanism to add extensions.
12 Please note that the class that derives from this must also
13 derive from L<AnyEvent::XMPP::Event>!
14  
15 Please see L<AnyEvent::XMPP::Ext> for more information about this mechanism.
16  
17 =over 4
18  
19 =item B<add_extension ($ext)>
20  
21 This method extends the current object with a L<AnyEvent::XMPP::Ext> object.
22 C<$ext> must be an instance of L<AnyEvent::XMPP::Ext>.
23  
24 Basically C<add_extension> makes the extension an event receiver
25 for all events that the extended object receives.
26  
27 =cut
28  
29 0 ▶sub add_extension {
Subroutine add_extension: not called CC=1 SCAR=6.9
Pod documented
30 0 my ($self, $ext) = @_;
31 0 ▶ $self->add_forward ($ext, sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
32 0 my ($self, $ext, $ev, @args) = @_;
33 0 ▶ return if $ext->{inhibit_forward}->{$ev};
Branch: 1 branch
BranchTrueFalseTotal
if $ext->{"inhibit_forward"}{$ev} 0 0 0
34 0 $ext->_event ($ev, $self, @args);
35 0 });
36 }
37  
38 =item B<remove_extension ($ext)>
39  
40 This method removes the extension C<$ext>.
41  
42 =cut
43  
44 0 ▶sub remove_extension {
Subroutine remove_extension: not called CC=1 SCAR=6.9
Pod documented
45 0 my ($self, $ext) = @_;
46 0 $self->remove_forward ($ext);
47 }
48  
49  
50 =back
51  
52 =head1 AUTHOR
53  
54 Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >>
55  
56 =head1 COPYRIGHT & LICENSE
57  
58 Copyright 2007, 2008 Robin Redeker, all rights reserved.
59  
60 This program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62  
63 =cut
64  
65 1 1; # End of AnyEvent::XMPP
« XMPP/Error/IQAuth.pm ↑ Summary XMPP/SimpleConnection.pm »