File Coverage

blib/lib/Authen/CAS/Client/Response.pm
Criterion Covered Total %
statement 66 67 98.5
branch 7 8 87.5
condition n/a
subroutine 29 29 100.0
pod 5 5 100.0
total 107 109 98.1


line stmt bran cond sub pod time code
1             require 5.006_001;
2              
3 6     6   26574 use strict;
  6         13  
  6         193  
4 6     6   30 use warnings;
  6         9  
  6         1669  
5              
6             #======================================================================
7             # Authen::CAS::Client::Response
8             #
9             package Authen::CAS::Client::Response;
10              
11             our $VERSION = '0.03';
12              
13 16     16   90 sub _ATTRIBUTES () { _ok => undef, doc => undef }
14              
15             sub new {
16 16     16 1 577 my ( $class, %args ) = @_;
17              
18 16         60 my %self = $class->_ATTRIBUTES;
19 16         64 for my $attribute ( keys %self ) {
20 57 100       181 $self{$attribute} = $args{$attribute}
21             if exists $args{$attribute};
22             }
23              
24 16         94 bless \%self, $class
25             }
26              
27 8     8 1 10154 sub is_error { my ( $self ) = @_; ! defined $self->{_ok} }
  8         81  
28 8 100   8 1 5636 sub is_failure { my ( $self ) = @_; defined $self->{_ok} && ! $self->{_ok} }
  8         542  
29 8 100   8 1 4485 sub is_success { my ( $self ) = @_; defined $self->{_ok} && $self->{_ok} }
  8         59  
30              
31 8     8 1 19 sub doc { my ( $self ) = @_; $self->{doc} }
  8         44  
32              
33              
34             #======================================================================
35             # Authen::CAS::Client::Response::Error
36             #
37             package Authen::CAS::Client::Response::Error;
38              
39 6     6   39 use base qw/ Authen::CAS::Client::Response /;
  6         12  
  6         1248  
40              
41 3     3   14 sub _ATTRIBUTES () { error => 'An internal error occurred', $_[0]->SUPER::_ATTRIBUTES }
42              
43 3     3   1367 sub new { my $class = shift; $class->SUPER::new( @_, _ok => undef ) }
  3         18  
44              
45 2     2   10 sub error { my ( $self ) = @_; $self->{error} }
  2         21  
46              
47              
48             #======================================================================
49             # Authen::CAS::Client::Response::Failure
50             #
51             package Authen::CAS::Client::Response::Failure;
52              
53 6     6   35 use base qw/ Authen::CAS::Client::Response /;
  6         11  
  6         1150  
54              
55 5     5   22 sub _ATTRIBUTES () { code => undef, message => '', $_[0]->SUPER::_ATTRIBUTES }
56              
57 5     5   2047 sub new { my $class = shift; $class->SUPER::new( @_, _ok => 0 ) }
  5         25  
58              
59 2     2   32 sub code { my ( $self ) = @_; $self->{code} }
  2         12  
60 2     2   5 sub message { my ( $self ) = @_; $self->{message} }
  2         10  
61              
62              
63             #======================================================================
64             # Authen::CAS::Client::Response::AuthFailure
65             #
66             package Authen::CAS::Client::Response::AuthFailure;
67              
68 6     6   31 use base qw/ Authen::CAS::Client::Response::Failure /;
  6         12  
  6         3338  
69              
70              
71             #======================================================================
72             # Authen::CAS::Client::Response::ProxyFailure
73             #
74             package Authen::CAS::Client::Response::ProxyFailure;
75              
76 6     6   37 use base qw/ Authen::CAS::Client::Response::Failure /;
  6         10  
  6         2637  
77              
78              
79             #======================================================================
80             # Authen::CAS::Client::Response::Success
81             #
82             package Authen::CAS::Client::Response::Success;
83              
84 6     6   33 use base qw/ Authen::CAS::Client::Response /;
  6         18  
  6         740  
85              
86 7     7   3804 sub new { my $class = shift; $class->SUPER::new( @_, _ok => 1 ) }
  7         31  
87              
88              
89             #======================================================================
90             # Authen::CAS::Client::Response::AuthSuccess
91             #
92             package Authen::CAS::Client::Response::AuthSuccess;
93              
94 6     6   87 use base qw/ Authen::CAS::Client::Response::Success /;
  6         11  
  6         3697  
95              
96 3     3   17 sub _ATTRIBUTES () { user => undef, iou => undef, proxies => [ ], $_[0]->SUPER::_ATTRIBUTES }
97              
98 2     2   27 sub user { my ( $self ) = @_; $self->{user} }
  2         11  
99 2     2   5 sub iou { my ( $self ) = @_; $self->{iou} }
  2         11  
100 2 50   2   5 sub proxies { my ( $self ) = @_; wantarray ? @{ $self->{proxies} } : [ @{ $self->{proxies} } ] }
  2         8  
  0         0  
  2         16  
101              
102              
103             #======================================================================
104             # Authen::CAS::Client::Response::ProxySuccess
105             #
106             package Authen::CAS::Client::Response::ProxySuccess;
107              
108 6     6   36 use base qw/ Authen::CAS::Client::Response::Success /;
  6         12  
  6         3031  
109              
110 3     3   15 sub _ATTRIBUTES () { proxy_ticket => undef, $_[0]->SUPER::_ATTRIBUTES }
111              
112 2     2   10 sub proxy_ticket { my ( $self ) = @_; $self->{proxy_ticket} }
  2         10  
113              
114              
115             1
116             __END__