On Tue, Apr 29, 2008 at 4:36 AM, Greg Evans <[EMAIL PROTECTED]> wrote:
> Hello mason-users,
>
>  I am new to mason and sorta  mostly new to perl as well. I wrote a
>  perl script to get and return some things from a CLI program and that
>  works. I am now having problems getting it to work with mason. I am
>  sure the code could be WAY better, but I would appreciate some help
>  nonetheless.  The problem is in the code below. I have also included
>  the error messages that get returned.
>
>
8< --- snip ---

Might I interject and recommend using an <%init> block for all your perl?

Use <%init> ... </%init> to surround raw perl (no need for % on each
line) and thus set up your variables. Then within the actual HTML you
can use minimal perl, e.g. % foreach or %if. The <%init> block can go
anywhere in your page. We tend to put it at the bottom so the web
monkeys don't have to confuse themselves with scary perl :)

Anyway it means that not only do you have less junk in your page, it
also means that it becomes more obvious where your syntax errors are.
If you only use print statements outside the <%init> (except for
debugging of course), and even then you use <%$foo%> to print, you'll
probably run into many fewer errors.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to