Hi all,

A very newbie question, but I'm trying to learn Mason with the O'Reilly 
book by D. Rolsky and K. Williams.  I got to a point that got me 
scratching my head so I'm wondering what I'm missing.

If you have the book, on page 34, in the section "Argument Examples", 
they're assuming that the component being called contains this <%args> 
block:

<%args>
$colors
@colors
%colors
</%args>

They then show various ways of calling this component.  Here's one example:

<----->
/some/component?colors=blue
<& /some/component, colors => 'blue' &>

In both cases, $colors is the string "blue" and "colors is a 
single-element array containing ('blue'). ...  The component will die 
when it is called, however, because Mason does not allow you to assign 
an odd number of elements to a hash, so the assignment to %colors is fatal.
<----->

Up to this point, I thought this component would take three arguments, a 
scalar, an array, and a hash.  At least, Perl would see them 
differently.  But is this not the case with Mason?  Does this mean it is 
generally bad practice to have the same variable name in an %args block, 
even if they are preceded by a different sigil ($, %, or @)?  I guess it 
is a limitation of requests through URIs (that you can't tell the 
difference between $, %, or @ in a request).

I know creating a few examples and running them through my web server 
would answer this question...alas, I haven't yet set up Mason with 
Apache yet.  :-( But I haven't admitted defeat yet so I'm still trying 
to get it working...stubborn, perhaps.  :-)

Ray



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to