my ( $self, $c ) = @_;
if ( $c->action ) {
- $c->forward( join( '/', '', $c->namespace, '_DISPATCH' ) );
+ $c->forward( join( '/', '', $c->action->namespace, '_DISPATCH' ) );
}
else {
my $c = shift;
my $command = shift;
+ # Get the calling class
+ my $caller = ( caller(0) )[0];
+ if ( $caller->isa('Catalyst') ) {
+ if ( ( caller(2) )[3] =~ /detach$/ ) { $caller = caller(3) }
+ elsif ( ( caller(0) )[3] =~ /forward$/ ) { $caller = caller(1) }
+ }
+
unless ($command) {
$c->log->debug('Nothing to forward to') if $c->debug;
return 0;
my $command_copy = $command;
unless ( $command_copy =~ s/^\/// ) {
- my $namespace = $c->namespace;
- $command_copy = "${namespace}/${command}";
+ my $prefix =
+ Catalyst::Utils::class2prefix( $caller,
+ $c->config->{case_sensitive} )
+ || '';
+ $command_copy = "${prefix}/${command}";
}
unless ( $command_copy =~ /\// ) {
return map { $_->getNodeValue } @match;
}
+=item $self->register( $c, $action )
+
+=cut
+
sub register {
my ( $self, $c, $action ) = @_;