Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Pshaw.

Your "shown here" link doesn't seem to work, but the example you give above is not very convincing.

You are perfectly free to use standard Perl argument passing conventions with your Mason components:

<& my_component, $foo, $bar, $baz &> ...
my ( $foo, $bar, $baz ) = @_; ...

The <%args> block is an optional extra mechanism for retrieving arguments, which you don't need to use if it makes you paranoid.

The @elements line in an <%args> block is equivalent to something like my %ARGS = @_; my @elements = @{ $ARGS{elements} || croak("Missing required argument: elements" }. That's a useful shortcut, particularly after you factor in the support for default values, but again, it's layered on top of the normal mechanism, not a replacement for it.

I think that in constrained contexts, mini-languages and format strings can be quite useful; the succinctness allows the developer to work at a higher level. I find them particularly non-threatening in cases like HTML::Mason, where all of the mini-language code is translated to pure Perl before execution -- just look at your var/obj directory to see exactly what Perl code was produced for an %args block or other HTML::Mason markup.

If you've made up your mind that you only want to use "pure" Perl syntax, feel free to use heredocs and interpolation tricks to generate your page templates, but I think most developers would agree that this is a case in which an additional layer with a different syntax is justified.


In reply to Re^2: mini-languages for MVC view/controller manipulation by simonm
in thread mini-languages for MVC view/controller manipulation by metaperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found