[jifty-devel] MASON error in tutorial

Malte Ubl malte.ubl at gmail.com
Fri Aug 4 07:48:39 EDT 2006


Hey,

I just installed Jifty on MacOS X 10.4 and started doing the tutorial
application.

Entering posts via the administration interface works, however when I
copy the code from the tutorial to view the posts I get a mason error.
I am new to mason (long time template toolkit fan), so it is hard to
say why this is failing:

Error:
Global symbol "$post" requires explicit package name at
/Users/malte/jifty/MyWeblog/share/web/templates/index.html line 10.
Global symbol "$post" requires explicit package name at
/Users/malte/jifty/MyWeblog/share/web/templates/index.html line 11.


Code:
<%init>
  my $posts = MyWeblog::Model::PostCollection->new();
  $posts->unlimit();
  </%init>

  <&|/_elements/wrapper, title =>
Jifty->config->framework('ApplicationName') &>
  <dl>
  % while (my $post = $posts->next) {
   <dt><%$post->title%></dt>
   <dd><%$post->body%></dd>
  % }
  </dl>
  </&>

When I try out the AJAX-driven variant I get the same error within the
page_of_posts fragment.

The whole thing seems to be a scoping problem. When I define $post
within the init-block at the top the error goes away but $post is
empty when the method title ist called, so I guess that the my $post
definition is somehow not visible on the next line.

I'm probably missing something really obvious, but thanks for your
help and great work anyway!

malte


More information about the jifty-devel mailing list