line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite2::Formatter::JSON; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
27
|
use strict; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
189
|
|
4
|
8
|
|
|
8
|
|
26
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
178
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
1181
|
use parent 'OAuth::Lite2::Formatter'; |
|
8
|
|
|
|
|
688
|
|
|
8
|
|
|
|
|
44
|
|
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
5207
|
use JSON::XS; |
|
8
|
|
|
|
|
36418
|
|
|
8
|
|
|
|
|
394
|
|
9
|
8
|
|
|
8
|
|
1072
|
use Try::Tiny; |
|
8
|
|
|
|
|
2522
|
|
|
8
|
|
|
|
|
981
|
|
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; |