Looking for help figuring out a stumping error.
I've created a perl Catalyst plugin that's intended to provide a drop-in replacement method for Catalyst 5.90115's redirect_and_detach ($c->redirect_and_detach). My replacement method does nothing but call Catalyst's redirect_and_detach:
package MyApp::Catalyst::Plugin::Logger;
...
sub my_redirect_and_detach {
my ($c, $uri, $status) = @_;
$c->redirect_and_detach($uri, $status);
}
I realize this adds no value, I'm just testing to make this simple case work first.
Then I replace this working call ...
$c->redirect_and_detach($someuri);
with this call to my new plugin method ...
$c->my_redirect_and_detach($someuri);
And I get the following (abbreviated/obfuscated) error:
Parameter #2 (undef) to Catalyst::Plugin::RedirectAndDetach::redirect_and_detach was an 'undef', which is not one of the allowed types: scalar
at /usr/local/share/perl/5.26.1/Catalyst/Plugin/RedirectAndDetach.pm line 18.
Catalyst::Plugin::RedirectAndDetach::redirect_and_detach(undef, "/myuri", undef) called at /var/app/lib/MyApp/Catalyst/Plugin/Logger.pm line 95
MyApp::Catalyst::Plugin::Logger::my_redirect_and_detach(MyApp=HASH(0x5628f93e4e60), "/myuri") called at ...
I understand the Catalyst method spec requires parameter #2 to be defined. But I don't understand why the stacktrace shows undef for the first argument (thought that would be $c's class/package). I verified $c is successfully passed as first argument, and works inside my_redirect_and_detatch() to pull request parameters.
Anyone see the issue?
Thanks in advance.