Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^8: Here documents in blocks (why templates)

by Bod (Parson)
on Dec 21, 2020 at 10:56 UTC ( [id://11125525]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Here documents in blocks (why templates)
in thread Here documents in blocks

Even your HTML needs some work, a mix of css classes and inline styles

The snippet of HTML you refer to was written some 6 years ago, as was mentioned in the post...
Whilst I cannot say I never add an inline style declaration to an existing class, it is very very rare these days.

seemingly been dismissed without proper evaluation

In less than 5 weeks of being here I have adopted strict, got rid of require *.pl; in favour of use *.pm; usage, adopted use FindBin; and use lib; which I previously knew existed but were shielded away in a cloak of mystery, plus numerous other improvements. Not to mention all the stuff I have taken on board about the *nix environment thanks to working with a Raspberry Pi. Change has to be paced!

Templating certainly has not been dismissed...
I do get the feeling that Mojolicious may be a step too far as it has the potential to break existing code. I am tending towards Template as a more universal solution that can be incrementally adopted.

Templating is being evaluated as described in Templating system choice

Replies are listed 'Best First'.
Re^9: Here documents in blocks (why templates)
by marto (Cardinal) on Dec 21, 2020 at 12:09 UTC

    Combining css and inline styles is something which hasn't been 'the done thing' in more than ten years. "In less than 5 weeks of being here", "I have been using Perl Monks for, probably, 20 years on and off.", your account is 5 weeks old, but given you tell us that you've been been here longer I'm not sure what point, if any, you're trying to make. All of these things points you list are regularly covered here in threads. Regardless I'm glad to hear they've been beneficial. Perhaps participation/engagement has helped progress matters. "Change has to be paced!" I think I've been clear that nobody expects you do spend time on anything, let alone rush into things. If these things happen at all I'd advise taking your time. Moving to templating is a great first step, being able to have people not familiar with programming alter templates can free up a considerable amount of your time.

      Combining css and inline styles is something which hasn't been 'the done thing' in more than ten years

      At first I took this on face-value as I accept that in theory, CSS and in-line styles are best kept separate. But then I wondered how true this is in the real world so looked at a few big name sites. The first I looked at have dynamical created content: Google, BBC. So I looked at Booking.com as I've seen this held up in a number of places as being (one of) the top sites written in Perl.

      Look what I found within moments of examining the source HTML...

      <input style="display: none" type="number" class="bui-stepper__input" data-bui-ref="input-stepper-field" id="group_children" name="group_children" min="0" max="10" value="0" data-group-children-count />

      This is just one of many examples on the site today.

      I'm not suggesting that bad practice in one place is justification for not trying to adopt best practice. However, it does show that I am hardly alone in this approach regardless of how much it isn't the 'done thing'. I'm not sure debating one bit of sample HTML which was shared to demonstrate something completely different helps with the original question about heredocs or with the subsequent divergence into templates.

        "I'm not sure debating one bit of sample HTML which was shared to demonstrate something completely different helps with the original question about heredocs or with the subsequent divergence into templates."

        My reply was the first to suggest templating, and commented on this as a side note. Printing literally each line of HTML at a time, substituting values within blocks of code like that is arcane. If it works for you it isn't a problem obviously, as mentioned more than once now, however when posting clunky things on a forum to help people learn how to do things better, expect someone to flag it up. Which shouldn't be surprising given previous conversations about modern perl and what it can do. From experience of writing and maintaining clean interfaces in sane ways, the learning curve isn't too steep and each small thing you learn to do better makes life a lot easier. Booking.com may be doing this to satisfy some other problem, as LanX has mentioned certain JavaScript UI toolkits do weird things. 22 requests pulling in 2MB of JavaScript, I'm not going to bother delving into any of that bloat. JavaScript is sometimes a necessary evil best used sparingly but just all too often misused these days, hence the bloated interwebs.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-16 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found