1Catalyst::ActionRole::HUTsTePrMeCtohnotdrsi(b3u)ted PerlCaDtoacluymsetn:t:aAtcitoinonRole::HTTPMethods(3)
2
3
4

NAME

6       Catalyst::ActionRole::HTTPMethods - Match on HTTP Methods
7

SYNOPSIS

9           package MyApp::Web::Controller::MyController;
10
11           use Moose;
12           use MooseX::MethodAttributes;
13
14           extends 'Catalyst::Controller';
15
16           sub user_base : Chained('/') CaptureArg(0) { ... }
17
18             sub get_user     : Chained('user_base') Args(1) GET { ... }
19             sub post_user    : Chained('user_base') Args(1) POST { ... }
20             sub put_user     : Chained('user_base') Args(1) PUT { ... }
21             sub delete_user  : Chained('user_base') Args(1) DELETE { ... }
22             sub head_user    : Chained('user_base') Args(1) HEAD { ... }
23             sub options_user : Chained('user_base') Args(1) OPTIONS { ... }
24             sub patch_user   : Chained('user_base') Args(1) PATCH { ... }
25
26
27             sub post_and_put : Chained('user_base') POST PUT Args(1) { ... }
28             sub method_attr  : Chained('user_base') Method('DELETE') Args(0) { ... }
29
30           __PACKAGE__->meta->make_immutable;
31

DESCRIPTION

33       This is an action role that lets your Catalyst::Action match on
34       standard HTTP methods, such as GET, POST, etc.
35
36       Since most web browsers have limited support for rich HTTP Method
37       vocabularies we use Plack::Middleware::MethodOverride which allows you
38       to 'tunnel' your request method over POST  This works in two ways.  You
39       can set an extension HTTP header "X-HTTP-Method-Override" which will
40       contain the value of the desired request method, or you may set a
41       search query parameter "x-tunneled-method".  Remember, these only work
42       over HTTP Request type POST.  See Plack::Middleware::MethodOverride for
43       more.
44

REQUIRES

46       This role requires the following methods in the consuming class.
47
48   match
49   match_captures
50       Returns 1 if the action matches the existing request and zero if not.
51

METHODS

53       This role defines the following methods
54
55   match
56   match_captures
57       Around method modifier that return 1 if the request method matches one
58       of the allowed methods (see "http_methods") and zero otherwise.
59
60   allowed_http_methods
61       An array of strings that are the allowed http methods for matching this
62       action normalized as noted above (using X-Method* overrides).
63
64   list_extra_info
65       Adds a key => [@values] "HTTP_METHODS" whose value is an ArrayRef of
66       sorted allowed methods to the ->list_extra_info HashRef.  This is used
67       primarily for debugging output.
68
69   _has_expected_http_method ($expected)
70       Private method which returns 1 if $expected matches one of the allowed
71       in "http_methods" and zero otherwise.
72

AUTHORS

74       Catalyst Contributors, see Catalyst.pm
75
77       This library is free software. You can redistribute it and/or modify it
78       under the same terms as Perl itself.
79
80
81
82perl v5.32.0                      2020-07-2C8atalyst::ActionRole::HTTPMethods(3)
Impressum