Greetings,
Is this a fair approach to a controller class?
In the main app:
$self->helper( form => sub
{
state $form = DeltaR::Form->new(
record_limit => $record_limit
)
});
# ... later
$r->get( '/classes' )->to('form#classes')->name('classes');
In Form.pm:
our ( $gmt_offset, $timestamp, %params );
$gmt_offset = strftime "%z", localtime;
$timestamp = strftime "%F %T", localtime;
sub new
{
my $self = shift;
my %params = @_;
bless{};
}
sub classes
{
my $self = shift;
$self->stash(
record_limit => $params{record_limit},
timestamp => $timestamp,
gmt_offset => $gmt_offset
);
return $self->render;
}
Also, the stash does not seem to work because I get errors about global
symbol record_limit, timestamp, and gmt_offset not being defined in the
template form/classes.html.ep. What did I do wrong?
--
Neil Watson
Linux/UNIX Consultant
http://watson-wilson.ca
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.