GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Catalyst::ActionRole::HTTPMethods(3) User Contributed Perl Documentation Catalyst::ActionRole::HTTPMethods(3)

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

    package MyApp::Web::Controller::MyController;

    use Moose;
    use MooseX::MethodAttributes;

    extends 'Catalyst::Controller';

    sub user_base : Chained('/') CaptureArg(0) { ... }

      sub get_user     : Chained('user_base') Args(1) GET { ... }
      sub post_user    : Chained('user_base') Args(1) POST { ... }
      sub put_user     : Chained('user_base') Args(1) PUT { ... }
      sub delete_user  : Chained('user_base') Args(1) DELETE { ... }
      sub head_user    : Chained('user_base') Args(1) HEAD { ... }
      sub options_user : Chained('user_base') Args(1) OPTIONS { ... }
      sub patch_user   : Chained('user_base') Args(1) PATCH { ... }


      sub post_and_put : Chained('user_base') POST PUT Args(1) { ... }
      sub method_attr  : Chained('user_base') Method('DELETE') Args(0) { ... }

    __PACKAGE__->meta->make_immutable;

This is an action role that lets your Catalyst::Action match on standard HTTP methods, such as GET, POST, etc.

Since most web browsers have limited support for rich HTTP Method vocabularies we use Plack::Middleware::MethodOverride which allows you to 'tunnel' your request method over POST This works in two ways. You can set an extension HTTP header "X-HTTP-Method-Override" which will contain the value of the desired request method, or you may set a search query parameter "x-tunneled-method". Remember, these only work over HTTP Request type POST. See Plack::Middleware::MethodOverride for more.

This role requires the following methods in the consuming class.

Returns 1 if the action matches the existing request and zero if not.

This role defines the following methods

Around method modifier that return 1 if the request method matches one of the allowed methods (see "http_methods") and zero otherwise.

An array of strings that are the allowed http methods for matching this action normalized as noted above (using X-Method* overrides).

Adds a key => [@values] "HTTP_METHODS" whose value is an ArrayRef of sorted allowed methods to the ->list_extra_info HashRef. This is used primarily for debugging output.

Private method which returns 1 if $expected matches one of the allowed in "http_methods" and zero otherwise.

Catalyst Contributors, see Catalyst.pm

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
2020-07-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.