| 1 | package OAuth::Lite2::Client::Error; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | use overload | ||||||||||||||||||||
| 7 | 33 | ▶ | q{""} => sub { shift->message }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 7 | ▶ | fallback => 1; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 0 | ▶ | sub default_message { "error" } | ||||||||||||||||||
|
Subroutine
default_message: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | sub new { | ||||||||||||||||||||
| 13 | 33 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||
| 14 | bless { | ||||||||||||||||||||
| 15 | 33 | ▶ | message => $args{message} || $class->default_message, | ||||||||||||||||||
|
Condition33%1/3
$args{'message'} || $class->default_message
MC/DC0%0/2
$args{'message'} || $class->default_message
$args{'message'}
$class->default_message
Truth table33%1/3
A || B
A= $args{'message'}B= $class->default_message
| |||||||||||||||||||||
| 16 | }, $class; | ||||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | sub throw { | ||||||||||||||||||||
| 20 | 33 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||
|
Subroutine
throw: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 21 | 33 | die $class->new(%args); | |||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | sub message { | ||||||||||||||||||||
| 25 | 33 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 26 | 33 | return $self->{message}; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | package OAuth::Lite2::Client::Error::InvalidResponse; | ||||||||||||||||||||
| 30 | 7 | our @ISA = qw(OAuth::Lite2::Client::Error); | |||||||||||||||||||
| 31 | 0 | ▶ | sub default_message { "invalid response" } | ||||||||||||||||||
|
Subroutine
default_message: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | package OAuth::Lite2::Client::Error::InsecureRequest; | ||||||||||||||||||||
| 34 | 7 | our @ISA = qw(OAuth::Lite2::Client::Error); | |||||||||||||||||||
| 35 | 0 | ▶ | sub default_message { "insecure request" } | ||||||||||||||||||
|
Subroutine
default_message: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | package OAuth::Lite2::Client::Error::InsecureResponse; | ||||||||||||||||||||
| 38 | 7 | our @ISA = qw(OAuth::Lite2::Client::Error); | |||||||||||||||||||
| 39 | 0 | ▶ | sub default_message { "insecure response" } | ||||||||||||||||||
|
Subroutine
default_message: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | package OAuth::Lite2::Client::Error; | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | =head1 NAME | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | OAuth::Lite2::Client::Error - OAuth 2.0 client error | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | =head1 SYNOPSIS | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | OAuth::Lite2::Client::Error::InvalidResponse->throw( | ||||||||||||||||||||
| 50 | message => q{invalid format}, | ||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | =head1 DESCRIPTION | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | OAuth 2.0 client error | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | =head1 ERRORS | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =over 4 | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | =item OAuth::Lite2::Client::Error::InvalidResponse | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | =item OAuth::Lite2::Client::Error::InsecureRequest | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | =item OAuth::Lite2::Client::Error::InsecureResponse | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | =back | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | =head1 AUTHOR | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | Copyright (C) 2010 by Lyo Kato | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||
| 78 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||||||||||||||||||||
| 79 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | =cut | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 7 | 1; | |||||||||||||||||||