Hi Paul,

Paul Vixie wrote:
> Raymond Wan <r...@kuicr.kyoto-u.ac.jp> writes:
>> Thank you for your explanation!  I never knew about the difference
>> between the two.  Actually, I never knew that "return" could take a URL
>> as an argument.
> 
> return isn't taking a URL as an argument.  in fact the function's return
> value is meaningless, and the real intent is to call $m->comp() and then
> immediately return.  this:
> 
>       if (not $success) {
>          return $m->comp('/BAR', %ARGS);
>       }
> 
> is shorthand for this:
> 
>       if (not $success) {
>            $m->comp('/BAR', %ARGS);
>          return;
>       }


I think I'm cluing in [finally!].  I guess that the first set of statements 
*is* legal Perl since the "return" statement takes an expression.  
"$m->comp('/BAR', %ARGS)" in this case is treated as an expression and is 
evaluated first before returning.  That's all.

However, I didn't know that $m->comp returns a value.  It could return 
additional code that would be displayed in the web page, but it doesn't have 
to.  So, $m->comp seems still different from something like:

if (not $success) {
  return (fn());
}

where fn() is a function/subroutine that [hopefully] returns a value to the 
current function which then gets passed back up again.

Otherwise, it seems just a little different from Perl...

Ray



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to