> 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).
Correct. Consider: $m->comp('foo', color => [EMAIL PROTECTED] ); Mason doesn't mirror perl's table of types. It allows you to pass a variable as a reference, and to access that variable however you want. When you think about it, this is exactly the same as normal perl usage for subroutines, though: sub foo { my ($self, $args) = @_; } $self->foo({ color => [qw/blue red green/] }); The subroutine can interpret the reference however it likes. This will not cause you problems in mason the same as it doesn't in perl. If I'm in doubt about what I'm getting in then I treat it for both cases: <%args> $maybe_array => undef </%args> <%init> $maybe_array = [$maybe_array] unless ref $maybe_array; </%init> Now you know you have an array, and the processing is unified. > 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. :-) lighttpd will be your friend, if you care to try it. ------------------------------------------------------------------------- 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