Skip to content

Instantly share code, notes, and snippets.

@bimmerlabs
Last active May 16, 2017 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bimmerlabs/f3f3842bab444c20ef398b8e7ea80737 to your computer and use it in GitHub Desktop.
Save bimmerlabs/f3f3842bab444c20ef398b8e7ea80737 to your computer and use it in GitHub Desktop.
users route
get '/users' => sub {
my $self = shift;
my (%users, $count) = MyApp::Model::Users::list_users($self);
$self->stash(users => \%users, count => $count);
$self->render(template => 'users');
};
# in the template (none of these work):
@@ users.html.ep
% my %users = %{$users};
% my $usercount = 1;
% until ($usercount > $count) {
<td><%= $usercount %></td>
<td><%= $users{$usercount}{'name'} %></td>
<td><%= $users{$usercount}->{'name'} %></td>
<td><%= $users->{$usercount}->{'name'} %></td>
% $usercount++;
% }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment