The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Catalyst::Controller::SingletonResource - Catalyst Singleton Resource Controller

SYNOPSIS

  package MyApp::Controller::Account;
  use base 'Catalyst::Controller::SingletonResource';
  
  # POST /account
  sub create {
      my ($self, $c) = @_;
  }
  
  # GET /account
  sub show {
      my ($self, $c) = @_;
  }
  
  # PUT /account
  sub update {
      my ($self, $c) = @_;
  }
  
  # DELETE /account
  sub destroy {
      my ($self, $c) = @_;
  }
  
  # GET /account/new
  sub post {
      my ($self, $c) = @_;
  }
  
  # GET /account/edit
  sub edit {
      my ($self, $c) = @_;
  }

DESCRIPTION

This controller defines HTTP verb-oriented actions for singleton resource, inspired by map.resource (Ruby on Rails).

In your controller:

  package MyApp::Controller::Account;
  use base 'Catalyst::Controller::SingletonResource';

This base controller exports Catalyst action attributes to your controller, and setup singleton resource as /account.

RESERVED ACTIONS

create

called by POST /resource request

show

called by GET /resource request

update

called by PUT /resource request

destroy

called by DELETE /resource request

post

called by GET /resource/new request

edit

called by GET /resource/edit request

delete

called by GET /resource/delete request

AUTHOR

NAKAGAWA Masaki <masaki@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Catalyst::Controller, Catalyst::Controller::Resources, http://api.rubyonrails.org/classes/ActionController/Resources.html