In Catalyst framework there is a global init sub(executed before any controller). i want the set some config variable from DB(like supper admin id or admin email for GPG configuration ).
i tried to use auto and 'begin' actions but those actions are just executed for its corresponding controller.
in Root.pm file:
sub auto :Private {
my ($self, $c) = @_;
my $config = $c->model('DB')->resultset('Config')->single();
$c->config->{var1} = $config->var1;
};
When i request another controller like Controller2 and begin , the $c->config->{var1} was empty..