| 1 | package AnyEvent::XMPP::Error::SASL; | ||
| 2 | 0 | ▶ | use AnyEvent::XMPP::Error; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | use strict; | ||
| 4 | our @ISA = qw/AnyEvent::XMPP::Error/; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | AnyEvent::XMPP::Error::SASL - SASL authentication error | ||
| 9 | |||
| 10 | Subclass of L<AnyEvent::XMPP::Error> | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | sub init { | ||
| 15 | my ($self) = @_; | ||
| 16 | my $node = $self->xml_node; | ||
| 17 | |||
| 18 | my $error; | ||
| 19 | for ($node->nodes) { | ||
| 20 | $error = $_->name; | ||
| 21 | last | ||
| 22 | } | ||
| 23 | |||
| 24 | $self->{error_cond} = $error; | ||
| 25 | } | ||
| 26 | |||
| 27 | =head2 METHODS | ||
| 28 | |||
| 29 | =over 4 | ||
| 30 | |||
| 31 | =item B<xml_node ()> | ||
| 32 | |||
| 33 | Returns the L<AnyEvent::XMPP::Node> object for this stream error. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | sub xml_node { | ||
| 38 | $_[0]->{node} | ||
| 39 | } | ||
| 40 | |||
| 41 | =item B<condition ()> | ||
| 42 | |||
| 43 | Returns the error condition, which might be one of: | ||
| 44 | |||
| 45 | aborted | ||
| 46 | incorrect-encoding | ||
| 47 | invalid-authzid | ||
| 48 | invalid-mechanism | ||
| 49 | mechanism-too-weak | ||
| 50 | not-authorized | ||
| 51 | temporary-auth-failure | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | sub condition { | ||
| 56 | $_[0]->{error_cond} | ||
| 57 | } | ||
| 58 | |||
| 59 | sub string { | ||
| 60 | my ($self) = @_; | ||
| 61 | |||
| 62 | sprintf "sasl error: %s", | ||
| 63 | $self->condition | ||
| 64 | } | ||
| 65 | |||
| 66 | =back | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | |||
| 71 | =head1 AUTHOR | ||
| 72 | |||
| 73 | Robin Redeker, C<< <elmex at ta-sa.org> >>, JID: C<< <elmex at jabber.org> >> | ||
| 74 | |||
| 75 | =head1 COPYRIGHT & LICENSE | ||
| 76 | |||
| 77 | Copyright 2007, 2008 Robin Redeker, all rights reserved. | ||
| 78 | |||
| 79 | This program is free software; you can redistribute it and/or modify it | ||
| 80 | under the same terms as Perl itself. | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | 1; # End of AnyEvent::XMPP | ||