Well, here we have a envirionment that embeds Perl into HTML, yes another of this kind. It's similar to PHP, but the code is Perl, and have a lot of resources to work with OO entities, portable DB, etc... Well, it have all that we need to make portals fast.
Now I'm working to extend the Perl syntax, so, I made some simple analysis, and saw that the more common commands are:
But we know that when we declare a HTML with quotes is just sux! For example, when we want to declare with multiple lines, or to declare quotes and variables inside the quoted string:print "<b>some quoted HTML<b>" ; ## and my $html = "<i>assign some html</i>" ;
Well, the syntax above is still simple, but remember that this is something that we write all the time! So, a long time ago we have added HTML blocks to the template system:print qq` <font color="#000000"> multiple lines and quotes </font> ` ;
But I still see some developers declaring a lot of qq``! Why that? Because they don't want to create a new HTML BLOCK in the template just to print simple things. They think that HTML BLOCKS are very useful, but for blocks that will be used and called in many places.<html> <% print <% html_foo>(@args) ; %> <% html_foo(@args) <font color="#000000"> Args: @args </font> %> </html>
So, I had some idea in the last week. Why not use some delimiter to declare a full line as a quoted string for output or assigment, making something similar to Perl comments:
And the advantage is that is not needed to open and close quotes, or to care about the use of quotes inside it, what is perfect for HTML data:>> this is an output! ## similar to: print "this is an output!\n" ;
Than I have added the same idea for assigment:<table border="0"> <% for ( @names ) { >> <tr> >> <td color="#333333">$_</td> >> </tr> } %> </table>
Well, what I really want is to know what you think about this extensions. I already have implemented basically the new syntax into our template system, just to see it working. I also think that this syntax can be helpfull to make a code cleanner, what will make us to win time on maintenance of this codes.<% for ( @names ) { $html .= << <tr> . << <td color="#333333">$_</td> . << </tr> } %>
Thanks in advance!
Graciliano M. P.
"Creativity is the expression of the liberty".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extending the Perl Syntax on PERL + HTML envirionments.
by davorg (Chancellor) on Aug 05, 2004 at 10:39 UTC | |
|
Re: Extending the Perl Syntax on PERL + HTML envirionments.
by Arunbear (Prior) on Aug 05, 2004 at 10:28 UTC | |
|
Re: Extending the Perl Syntax on PERL + HTML envirionments.
by BUU (Prior) on Aug 05, 2004 at 07:11 UTC | |
by gmpassos (Priest) on Aug 05, 2004 at 20:15 UTC | |
|
Re: Extending the Perl Syntax on PERL + HTML envirionments.
by Aristotle (Chancellor) on Aug 05, 2004 at 21:51 UTC | |
by zby (Vicar) on Aug 06, 2004 at 09:05 UTC | |
|
Re: Extending the Perl Syntax on PERL + HTML envirionments.
by zby (Vicar) on Aug 05, 2004 at 07:06 UTC |