Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by marto (Cardinal)
on Dec 21, 2020 at 09:51 UTC ( [id://11125522]=note: print w/replies, xml ) Need Help??


in reply to Re^6: 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. Is it functional, sure. Does it make sense from a maintenance point of view, no. In response to this (and other replies) If what you have works for you and you don't have the time or inclination to learn modern practices nobody has a problem with that, but they way you write code "does nothing to dispel the image of Perl being old fashioned, outdated and obsolete.", and if you keep asking how to improve things you're likely only going to get the same answer you've had before, which has seemingly been dismissed without proper evaluation. At work (and elsewhere) I'm a lone developer frameworks and modern methods help me in my life, you don't need to be in a team to benefit from this. If you were to go down this path I'd suggest familiarising yourself with MVC and the Mojolicious docs, for me this along with just playing around with the thing was the way forwards.

  • Comment on Re^7: Here documents in blocks (why templates)

Replies are listed 'Best First'.
Re^8: Here documents in blocks (CSS Best Practices?)
by LanX (Saint) on Dec 21, 2020 at 15:04 UTC
    Can you recommend a "CSS Best Practices"?

    It's common knowledge that HTML is not a "programming" but a "mark-up language", hence it's "trivial".

    But does this apply to "CSS x.0" with all it's layers of OO like multiple inheritance and casual browser incompatibilities?

    (and those JS frameworks manipulating DOM and CSS don't make it easier)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      No, I can't. I mean I'd suggest the developer.mozilla stuff, which is fairly concise for all your web technology needs not just css. Where possible I tend to go for a minimalist approach. I used jQuery UI way back when it first came out, as initially it saved me a load of time, when it started taking more time and resource to get what I could achieve myself I threw it away. I'll stop now so as not to end up on a rant about how the modern interwebs is mostly broken :P

Re^8: Here documents in blocks (why templates)
by Bod (Parson) on Dec 21, 2020 at 10:56 UTC
    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

      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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-19 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found