| 1 | package Net::StackExchange::Role::Request; | ||||||||||
| 2 | 4 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | $Net::StackExchange::Role::Request::VERSION = '0.102740'; | |||||||||
| 4 | } | ||||||||||
| 5 | |||||||||||
| 6 | # ABSTRACT: Common request methods | ||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use Carp qw{ croak }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 4 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 4 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | has 'type' => ( | ||||||||||
| 13 | is => 'rw', | ||||||||||
| 14 | isa => 'Str', | ||||||||||
| 15 | 0 | ▶ | trigger => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 16 | 0 | my ( $self, $type ) = @_; | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | if ( $type ne 'jsontext' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | confess q{the only valid value is 'jsontext'}; | |||||||||
| 20 | } | ||||||||||
| 21 | }, | ||||||||||
| 22 | 4 | ); | |||||||||
| 23 | |||||||||||
| 24 | 4 | has [ | |||||||||
| 25 | qw{ | ||||||||||
| 26 | key | ||||||||||
| 27 | jsonp | ||||||||||
| 28 | } | ||||||||||
| 29 | ] => ( | ||||||||||
| 30 | is => 'rw', | ||||||||||
| 31 | isa => 'Str', | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 4 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 4 | ▶ | no Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 36 | |||||||||||
| 37 | 4 | 1; | |||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | |||||||||||
| 41 | =pod | ||||||||||
| 42 | |||||||||||
| 43 | =head1 NAME | ||||||||||
| 44 | |||||||||||
| 45 | Net::StackExchange::Role::Request - Common request methods | ||||||||||
| 46 | |||||||||||
| 47 | =head1 VERSION | ||||||||||
| 48 | |||||||||||
| 49 | version 0.102740 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 ATTRIBUTES | ||||||||||
| 52 | |||||||||||
| 53 | =head2 C<type> | ||||||||||
| 54 | |||||||||||
| 55 | The only valid value is C<jsontext>. Responds with mime-type text/json, if set. | ||||||||||
| 56 | |||||||||||
| 57 | =head2 C<key> | ||||||||||
| 58 | |||||||||||
| 59 | Accepts a key and validates this request to a specific application. | ||||||||||
| 60 | |||||||||||
| 61 | =head2 C<jsonp> | ||||||||||
| 62 | |||||||||||
| 63 | If set, the response returns JSON with Padding instead of standard JSON. | ||||||||||
| 64 | |||||||||||
| 65 | =head1 AUTHOR | ||||||||||
| 66 | |||||||||||
| 67 | Alan Haggai Alavi <alanhaggai@alanhaggai.org> | ||||||||||
| 68 | |||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 70 | |||||||||||
| 71 | This software is copyright (c) 2010 by Alan Haggai Alavi. | ||||||||||
| 72 | |||||||||||
| 73 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 74 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||
| 77 | |||||||||||
| 78 | |||||||||||
| 79 | __END__ | ||||||||||