G'day everyone,
I'm in the process of developing some course materials that involve a
discussion of Mason, and some of the naming conventions for components.
As per the discussion in HTML::Mason::Admin, I'm advocating the use of
.html for top-level components, .mhtml for components that generate
HTML, .mtxt for ones that generate text, and .mpl for ones that execute
code (but do not generate content).
However I've hit a bit of a snag when it comes to calling components
with content, such as the following, which calls 'quote' and passes it
both arguments and content:
<&| quote, author => "Larry Wall" &>
Let's call it an accidental feature.
</&>
If this generates HTML, then the standard naming convention would
dictate .mthml:
<&| quote.mhtml, author => "Larry Wall" &>
Let's call it an accidental feature.
</&>
However this does not provide us with any difference between a regular
component call, and one that requires content to operate.
One of the big advantages of using suffixes to denote function is that
it makes it easier to spot errors. However if we continue to use .mhtml
for component calls with content we lose this advantage. In particular,
without us knowing what quote.mhtml does, the following looks just fine:
<& quote.mhtml, author => "Larry Wall" &>
If we use an extension that makes it clear that it expects content, then
the error becomes more obvious, as we're clearly not providing any content:
<& quote.with_content, author => "Larry Wall" &>
I'm not suggesting that .with_content be used as a suffix, but I am very
curious to know what naming conventions others have used to denote
components that require content to operate. I usually place them all in
their own directory (often called '/filters'), but I can see perfectly
good arguments for other conventions as well.
Feedback, ideas, comments, suggestions and discussions are all very much
appreciated.
Many thanks,
Paul
--
Paul Fenwick <[EMAIL PROTECTED]> | http://perltraining.com.au/
Director of Training | Ph: +61 3 9354 6001
Perl Training Australia | Fax: +61 3 9354 2681
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users