Lite/Problems.pm

filter: Statementstmt 100% 72 / 72 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 22 / 22 Podpod 100% 1 / 1 totaltotal 100% 97 / 97 SCAR 6.9
CC
2
Cov
100%
match
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Lite/SignatureMethod.pm ↑ Summary Lite.pm »
1 package OAuth::Lite::Problems;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 our %EXPORT_TAGS = ( all => [qw/
9 VERSION_REJECTED
10 PARAMETER_ABSENT
11 PARAMETER_REJECTED
12 TIMESTAMP_REFUSED
13 NONCE_USED
14 SIGNATURE_METHOD_REJECTED
15 SIGNATURE_INVALID
16 CONSUMER_KEY_UNKNOWN
17 CONSUMER_KEY_REJECTED
18 CONSUMER_KEY_REFUSED
19 TOKEN_USED
20 TOKEN_EXPIRED
21 TOKEN_REVOKED
22 TOKEN_REJECTED
23 ADDITIONAL_AUTHORIZATION_REQUIRED
24 PERMISSION_UNKNOWN
25 PERMISSION_DENIED
26 USER_REFUSED
27 /] );
28  
29 3 our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS;
30  
31 3 ▶use constant VERSION_REJECTED => 'version_rejected';
Subroutine BEGIN: called CC=1 SCAR=0.0
32 3 ▶use constant PARAMETER_ABSENT => 'parameter_absent';
Subroutine BEGIN: called CC=1 SCAR=0.0
33 3 ▶use constant PARAMETER_REJECTED => 'parameter_rejected';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 3 ▶use constant TIMESTAMP_REFUSED => 'timestamp_refused';
Subroutine BEGIN: called CC=1 SCAR=0.0
35 3 ▶use constant NONCE_USED => 'nonce_used';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 3 ▶use constant SIGNATURE_METHOD_REJECTED => 'signature_method_rejected';
Subroutine BEGIN: called CC=1 SCAR=0.0
37 3 ▶use constant SIGNATURE_INVALID => 'signature_invalid';
Subroutine BEGIN: called CC=1 SCAR=0.0
38 3 ▶use constant CONSUMER_KEY_UNKNOWN => 'consumer_key_unknown';
Subroutine BEGIN: called CC=1 SCAR=0.0
39 3 ▶use constant CONSUMER_KEY_REJECTED => 'consumer_key_rejected';
Subroutine BEGIN: called CC=1 SCAR=0.0
40 3 ▶use constant CONSUMER_KEY_REFUSED => 'consumer_key_refused';
Subroutine BEGIN: called CC=1 SCAR=0.0
41 3 ▶use constant TOKEN_USED => 'token_used';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 3 ▶use constant TOKEN_EXPIRED => 'token_expired';
Subroutine BEGIN: called CC=1 SCAR=0.0
43 3 ▶use constant TOKEN_REVOKED => 'token_revoked';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 3 ▶use constant TOKEN_REJECTED => 'token_rejected';
Subroutine BEGIN: called CC=1 SCAR=0.0
45 3 ▶use constant ADDITIONAL_AUTHORIZATION_REQUIRED => 'additional_authorization_required';
Subroutine BEGIN: called CC=1 SCAR=0.0
46 3 ▶use constant PERMISSION_UNKNOWN => 'permission_unknown';
Subroutine BEGIN: called CC=1 SCAR=0.0
47 3 ▶use constant PERMISSION_DENIED => 'permission_denied';
Subroutine BEGIN: called CC=1 SCAR=0.0
48 3 ▶use constant USER_REFUSED => 'user_refused';
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 3 my %PROBLEMS = map { __PACKAGE__->$_() => 1 } @EXPORT_OK;
51  
52 sub match {
53 20 ▶ my $class = shift;
Subroutine match: called CC=2 SCAR=6.9
Pod documented
54 20 my $error = shift;
55 20 ▶ return $PROBLEMS{$error} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$PROBLEMS{$error} ? : 18 2 20
56 }
57  
58  
59 3 1;
60  
61 =head1 NAME
62  
63 OAuth::Lite::Problems - constants for OAuth Problem Reporting Extension
64  
65 =head1 SYNOPSIS
66  
67 use OAuth::Problems qw(:all);
68  
69 $server->error( TOKEN_REJECTED );
70  
71 =head1 DESCRIPTION
72  
73 This provides constants which used in OAuth Problem Reporting spec.
74  
75 =head1 METHODS
76  
77 =head2 match($error)
78  
79 my $error = 'token_rejected';
80 if (OAuth::Lite::Problems->match($error)) {
81 say "This error is OAuth Problem";
82 $server->error(sprintf "oauth_problem=%s", $error);
83 }
84  
85 =head1 CONSTANTS
86  
87 =head2 VERSION_REJECTED
88 =head2 PARAMETER_ABSENT
89 =head2 PARAMETER_REJECTED
90 =head2 TIMESTAMP_REFUSED
91 =head2 NONCE_USED
92 =head2 SIGNATURE_METHOD_REJECTED
93 =head2 SIGNATURE_INVALID
94 =head2 CONSUMER_KEY_UNKNOWN
95 =head2 CONSUMER_KEY_REJECTED
96 =head2 CONSUMER_KEY_REFUSED
97 =head2 TOKEN_USED
98 =head2 TOKEN_EXPIRED
99 =head2 TOKEN_REVOKED
100 =head2 TOKEN_REJECTED
101 =head2 ADDITIONAL_AUTHORIZATION_REQUIRED
102 =head2 PERMISSION_UNKNOWN
103 =head2 PERMISSION_DENIED
104 =head2 USER_REFUSED
105  
106 =head1 SEE ALSO
107  
108 http://oauth.pbworks.com/ProblemReporting
109  
110 =head1 AUTHOR
111  
112 Lyo Kato, C<lyo.kato _at_ gmail.com>
113  
114 =head1 COPYRIGHT AND LICENSE
115  
116 This library is free software; you can redistribute it and/or modify
117 it under the same terms as Perl itself, either Perl version 5.8.6 or,
118 at your option, any later version of Perl 5 you may have available.
119  
120 =cut
121  
« Lite/SignatureMethod.pm ↑ Summary Lite.pm »