Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Embeding Perl in HTML the PHP way

by GrandFather (Cardinal)
on Sep 12, 2012 at 10:32 UTC ( #993205=note: print w/ replies, xml ) Need Help??


in reply to Re: Embeding Perl in HTML the PHP way
in thread Embeding Perl in HTML the PHP way

these days, neither does PHP(!)

I really wish that were true, but it isn't, at least in my limited experience. The worst offenders seem to be some of the big guns like Drupal and Joomla (I've not looked at WordPress in sufficient detail to know)!

Those systems positively encourage template files that are a sea of PHP immersed in an ocean of HTML with the result that you can generally find neither the forest nor the trees.

Having worked with PHP extensively over the last few months I can confirm all the rumours that suggest PHP took only those parts of Perl the author understood (not very much actually), reimplemented badly those bits that weren't understood, provided multiple inconsistent implementations where there were several alternatives, and then added functions for anything anyone ever asked for. The result is not good!

True laziness is hard work


Comment on Re^2: Embeding Perl in HTML the PHP way
Re^3: Embeding Perl in HTML the PHP way
by tobyink (Abbot) on Sep 12, 2012 at 20:08 UTC

    That's the templates though. Intermingled code and HTML are par for the course when it comes to templates. (TT2 does this just as much. Example from the documentation. It's not Perl code intermingled - it's worse; its a whole other Turing-complete language.) The files that the browsers actually hit start with <?php and don't contain a ?>, so they're PHP all the way; not HTML with little chunks of PHP.

    There are plenty of awful things about the design of Drupal. This is not one of them though.

    Update: in case anyone doubts the Turing completeness of TT2...

    use Template; my $template = Template->new({ POST_CHOMP => 1, EVAL_PERL => 0, # note: false! }); $template->process(\*DATA, {}, \*STDOUT) or die $template->error; __DATA__ [% MACRO fib(n) BLOCK %] [% IF (n < 2) %] [% n %] [% ELSE %] [% fib(n - 1) + fib(n - 2) %] [% END %] [% END %] Fibonacci sequence... [% FOREACH i IN [ 1 2 3 4 5 6 7 8 9 10 ] %] [% fib(i) +%] [% END %]
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2014-09-16 23:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (53 votes), past polls