That is indeed a tricky case. But there's no way to solve it without  
Mason knowing a lot more about Perl parsing than it currently does (or  
cares to).

In fact, Mason 2 will fail in this case as well, because while it will  
discard whitespace around certain blocks (<%perl>, etc.), it will  
never discard an arbitrary whitespace line in the middle of text.

The general rule of thumb is that if you ever get a syntax error you  
don't understand, or a component is behaving in a way you don't  
expect, take a look at the object file (in your Mason directory) to  
see how Mason is converting the component into Perl. In this case you  
would see the intervening statement where Mason is appending  
whitespace to your buffer.

Best
Jon

On Jun 30, 2010, at 7:47 AM, Furst, Carl wrote:

> So if you have a component that has the following code:
> <%args>
> $something => undef,
> $seomthingelse => undef
> </%args>
> %
> % if ($something) {
> %# do something
> %}
>
> % elsif ($dosomethingelse) {
>
>
> %# do something else
> %}
>
> This component crashes... Why? Because of whitespace between the end  
> of the
> if block and the elsif. I wouldn't say it's a bug, but it would be
> convenient if we didn't have to decipher the following error message  
> as "you
> have something that mason considers code between your if and elsif":
>
> Error during compilation of ifthenelse.mhtml:
> syntax error at ifthenelse.mhtml line 10, near "elsif"
> (Might be a runaway multi-line '' string starting on line 9)
> Global symbol "$dosomethingelse" requires explicit package name at
> /cms/cfurst/head/newsroom/htdocs/ifthenelse.mhtml line 10.
>
>
> Carl Furst
> o/~ What a difference a byte makes... o/~
>
>
>
>
>
> **********************************************************
>
> MLB.com: Where Baseball is Always On
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- 
> http://p.sf.net/sfu/sprint-com-first_______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to