blob: 08ff41fdba9fba55e517e95cbf972f700b933c16 [file] [log] [blame]
package Kalamar::Plugin::KalamarHelpers;
use Mojo::Base 'Mojolicious::Plugin';
sub register {
my ($plugin, $mojo) = @_;
$mojo->helper(
kalamar_test_port => sub {
my $c = shift;
if (defined $c->stash('kalamar.test_port')) {
return $c->stash('kalamar.test_port');
};
if ($c->req->url->to_abs->port == 6666 ||
$c->app->mode =~ m/^development|test$/) {
$c->stash('kalamar.test_port' => 1);
return 1;
};
$c->stash('kalamar.test_port' => 0);
return 0;
});
};
1;