NAME
    CatalystX::Controller::Sugar - Extra sugar for Catalyst controller

VERSION
    0.01

SYNOPSIS
     use CatalystX::Controller::Sugar;

     __PACKAGE__->config->{'namespace'} = q();

     private foo => sub {
       res->body('Hey!');
     };

     # /
     chain sub {
        # root chain
     };

     # /person/*
     chain '/' => 'person' => ['id'], sub {
       stash unique => rand;
       res->print( captured('id') );
     };

     # /person/*/edit/*
     chain '/person' => 'edit' => sub {
       res->body( sprintf 'Person %s is unique: %s'
         captured('id'), stash('unique')
       );
     };

     # /multi
     chain '/multi' => {
       post => sub { ... },
       get => sub { ... },
       delete => sub { ... },
       default => sub { ... },
     };

NOTE
    $self and $c is not part of the argument list inside a chain() or
    private() action. $c is acquired by calling c(), and $self is available
    by calling controller().

EXPORTED FUNCTIONS
  chain
     1. chain sub { };

     2. chain $PathPart => sub { };
     3. chain $PathPart => $Int, sub { };
     4. chain $PathPart => \@CaptureArgs, sub { };

     5. chain $Chained => $PathPart => sub { };
     6. chain $Chained => $PathPart => $Int, sub { };
     7. chain $Chained => $PathPart => \@CaptureArgs, sub { };

     8. chain ..., \%method_map;

    Same as:

     1. sub root : Chained('/') PathPart('') CaptureArgs(0) { }

     2. sub $PathPart : Chained('/root') Args { }
     3. sub $PathPart : Chained('/root') Args($Int) { }
     4. sub $PathPart : Chained('/root') CaptureArgs($Int) { }

     5. sub $PathPart : Chained($Chained) Args { }
     6. sub $PathPart : Chained($Chained) Args($Int) { }
     7. sub $PathPart : Chained($Chained) CaptureArgs($Int) { }

     8. Special case: See below

    @CaptureArgs is a list of names of the captured argumenst, which can be
    retrieved using captured().

    $Int is a number of Args to capture at the endpoint of a chain. These
    cannot be aquired using captured(), but is instead available in @_.

    %method_map can be used if you want to dispatch to a specific method,
    for a certain HTTP method: (The HTTP method is in lowercase)

     %method_map = (
        post => sub { ... },
        get => sub { ... },
        delete => sub { ... },
        default => sub { ... },
        #...
     );

  private
     private $name => sub {};

    Same as:

     sub $name :Private {};

  forward
     @Any = forward $action, @arguments;

    See Catalyst::forward().

  go
     go $action, @arguments;

    See Catalyst::forward().

  c
     $context_obj = c;

    Returns the context object for this request.

  controller
     $controller_obj = controller;

    Returns the controller class.

  req
     $request_obj = req;

    Returns the request object for this request.

  res
     $response_obj = res;

    Returns the response object for this request.

  captured
     $value = captured($name);

    Retrieve data captured in a chain, using the names set with chain().

     chain '/' => 'user' => ['id'], sub {
       res->body( captured('id') );
     };

  stash
     $hash_ref = stash $key => $value, ...;
     $value = stash $key;

    Set/get data from the stash.

  session
     $hash_ref == session $key => $value;
     $value = session $key;

    Set/get data from the session.

  init_meta
    See Moose::Exporter.

BUGS
    Please report any bugs or feature requests to
    "bug-catalystx-controller-sugar at rt.cpan.org", or through the web
    interface at
    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-Controller-Sug
    ar>. I will be notified, and then you'll automatically be notified of
    progress on your bug as I make changes.

COPYRIGHT & LICENSE
    Copyright 2007 Jan Henning Thorsen, all rights reserved.

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

AUTHOR
    Jan Henning Thorsen, "<jhthorsen at cpan.org>"

