line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite2::Formatter::JSON; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
42
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
217
|
|
4
|
8
|
|
|
8
|
|
39
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
171
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
1846
|
use parent 'OAuth::Lite2::Formatter'; |
|
8
|
|
|
|
|
684
|
|
|
8
|
|
|
|
|
57
|
|
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
9145
|
use JSON::XS; |
|
8
|
|
|
|
|
56885
|
|
|
8
|
|
|
|
|
592
|
|
9
|
8
|
|
|
8
|
|
2131
|
use Try::Tiny; |
|
8
|
|
|
|
|
3611
|
|
|
8
|
|
|
|
|
1550
|
|
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
1
|
|
sub name { "json" } |
12
|
0
|
|
|
0
|
1
|
|
sub type { "application/json" }; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub format { |
15
|
0
|
|
|
0
|
1
|
|
my ($self, $hash) = @_; |
16
|
0
|
|
|
|
|
|
return JSON::XS->new->encode($hash); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub parse { |
20
|
0
|
|
|
0
|
1
|
|
my ($self, $json) = @_; |
21
|
0
|
|
|
|
|
|
return JSON::XS->new->decode($json); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
OAuth::Lite2::Formatter::JSON - OAuth 2.0 JSON formatters store |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $formatter = OAuth::Lite2::Formatter::JSON->new; |
31
|
|
|
|
|
|
|
my $obj = $formatter->parse( $string ); |
32
|
|
|
|
|
|
|
$string = $formatter->format( $obj ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
OAuth 2.0 JSON formatter |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 name |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Accessor for name of this format, "json". |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 type |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Accessor for content-type of this format, "application/json". |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 format( $json_object ) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $json_string = $formatter->format( $obj ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 parse( $json_string ) |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $obj = $formatter->parse( $json_string ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SEE ALSO |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
L |
59
|
|
|
|
|
|
|
L |
60
|
|
|
|
|
|
|
L |
61
|
|
|
|
|
|
|
L |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Lyo Kato, Elyo.kato@gmail.comE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Copyright (C) 2010 by Lyo Kato |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
72
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
73
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |