$c->req->param('token')
is not an LValue, so you cannot assign to it. Instead, you need to pass in the value.
$c->req->param('token', 1);
This behaviour is sort of documented:
Like CGI, and unlike earlier versions of Catalyst, passing multiple
arguments to this method, like this:
$c->request->param( 'foo', 'bar', 'gorch', 'quxx' );
will set the parameter foo to the multiple values bar, gorch and quxx.
Previously this would have added bar as another value to foo (creating
it if it didn't exist before), and quxx as another value for gorch.
Consider this demo:
package MyApp::Controller::Root;
use base 'Catalyst::Controller';
__PACKAGE__->config(namespace => '');
sub default : Path {
my ($self, $c) = @_;
$c->req->param('foo', 1);
$c->forward('bar');
}
sub bar : Path('foo') {
my ($self, $c) = @_;
if ($c->req->param('foo')) {
$c->res->body("Secret param set!\n");
}
else {
$c->res->body("Hello World\n");
}
return;
}