| 1 |
elmex |
1.1 |
package Net::XMPP2::Extendable; |
| 2 |
|
|
use warnings; |
| 3 |
|
|
use strict; |
| 4 |
|
|
|
| 5 |
|
|
=head1 NAME |
| 6 |
|
|
|
| 7 |
|
|
Net::XMPP2::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<Net::XMPP2::Event>! |
| 14 |
|
|
|
| 15 |
|
|
Please see L<Net::XMPP2::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<Net::XMPP2::Ext> object. |
| 22 |
|
|
C<$ext> must be an instance of L<Net::XMPP2::Ext>. |
| 23 |
|
|
|
| 24 |
|
|
=cut |
| 25 |
|
|
|
| 26 |
|
|
sub add_extension { |
| 27 |
|
|
my ($self, $ext) = @_; |
| 28 |
|
|
$self->add_forward ($ext, sub { |
| 29 |
|
|
my ($self, $ext, $ev, @args) = @_; |
| 30 |
|
|
$ext->event ($ev, $self, @args); |
| 31 |
|
|
}); |
| 32 |
|
|
} |
| 33 |
|
|
|
| 34 |
|
|
=item B<remove_extension ($ext)> |
| 35 |
|
|
|
| 36 |
|
|
This method removes the extension C<$ext>. |
| 37 |
|
|
|
| 38 |
|
|
=cut |
| 39 |
|
|
|
| 40 |
|
|
sub remove_extension { |
| 41 |
|
|
my ($self, $ext) = @_; |
| 42 |
|
|
$self->remove_forward ($ext); |
| 43 |
|
|
} |
| 44 |
|
|
|
| 45 |
|
|
=back |
| 46 |
|
|
|
| 47 |
|
|
=head1 AUTHOR |
| 48 |
|
|
|
| 49 |
|
|
Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >> |
| 50 |
|
|
|
| 51 |
|
|
=head1 COPYRIGHT & LICENSE |
| 52 |
|
|
|
| 53 |
|
|
Copyright 2007 Robin Redeker, all rights reserved. |
| 54 |
|
|
|
| 55 |
|
|
This program is free software; you can redistribute it and/or modify it |
| 56 |
|
|
under the same terms as Perl itself. |
| 57 |
|
|
|
| 58 |
|
|
=cut |
| 59 |
|
|
|
| 60 |
|
|
1; # End of Net::XMPP2 |