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->stack->[-1]->namespace;
- $command_copy = "${namespace}/${command}";
+ my $prefix =
+ Catalyst::Utils::class2prefix( $caller,
+ $c->config->{case_sensitive} )
+ || '';
+ $command_copy = "${prefix}/${command}";
}
unless ( $command_copy =~ /\// ) {