Answer the question
In order to leave comments, you need to log in
Proper use of a controller in Mojo?
There is one application controller (mojo, MVC).
There is a code that sets the secret phrase for cookies. The developers suggest $self->secrets ('SeCreTe');
But I don't like to use the $self pointer every time, because It's not always clear where he's referring to.
Is it correct to use
my $secrets = $self->secrets;
$secrets = $self->secrets(' SeCreTe ');
Answer the question
In order to leave comments, you need to log in
It makes sense to subscribe to
mail.pm.org/mailman/listinfo/moscow-pm
moscow.pm.org
and ask there.
The mailing list is very active, they respond quickly.
Inside a controller module, $self
points to a controller; inside an application module, points to an application.
You need to set the secret once in the startup
application method:
sub startup {
my ($app) = @_;
$app->secrets(['secret']);
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question