cx-sugar.txt

# http://foo.com/cmts/1.2.3.4/interface/foo/bar/baz
#============================================================================
package MyApp::Controller::Root;
use CatalystX::Controller::Sugar;
__PACKAGE__->config(namespace => '');

chain sub {};

chain cmts => [qw/ip/], sub {
    my $ip = shift; # '1.2.3.4'
    stash ip => $ip;
};

#chain 'cmts:1' => interface => 3 => sub { # restrict to three args
chain 'cmts:1' => interface => sub {
    my @interface = @_; # qw/foo bar baz/
    my $ip = captured('ip'); # '1.2.3.4' or stash('ip') or stash->{'ip'};

    stash interface => \@interface;
};

#============================================================================
package MyApp::Controller::CMTS;
use CatalystX::Controller::Sugar;

chain sub {};

chain '' => [qw/ip/], sub {
}

chain ':1' => interface => sub {
};

#============================================================================
# i think this will work with standard catalyst:

package MyApp::Controller::Root;
__PACKAGE__->config(namespace => '');

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

package MyApp::Controller::CMTS;

sub root :Chained('/root') PathPart('cmts') CaptureArgs(1) {
    my $ip = $_[2];
}

sub interface :Chained('/cmts/root') PathPart Args(3) {
    my @interface = @_[2..$#_]; # qw/foo bar baz/
}