#!/usr/bin/env perl
use Mojolicious::Lite;

plugin 'PODRenderer';

helper get_var => sub {
  my ($c) = @_;
  $c->stash( var => 'ok' );
  return "end";
};


get '/' => sub {
  my $c = shift;
  $c->stash( var2 => 'ok2');
  $c->render(template => 'index');
};

app->start;
__DATA__


@@ index.html.ep
% layout 'default';
% title 'Welcome';
<h1>Hi!</h1>
% get_var;
first_call  = <%= stash('var') %><br>
second_call = <%= $var %><br>
var2        = <%= $var2 %><br>


@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
  <head><title><%= title %></title></head>
  <body><%= content %></body>
</html>

Morbo run. first_call is work, but second_call is error. Why?

-- 
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.

Reply via email to