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

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

by Bod (Parson)
on Dec 20, 2020 at 23:33 UTC ( [id://11125514]=note: print w/replies, xml ) Need Help??


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

You seem to think that templates are just about replacing variables

No - I know there is much more too it than that...I just don't understand exactly what and how yet. My foray into 'templates' (of a kind) was just about variable replacement and I didn't get any further.

But a framework has a lot of benefits in a team

I can totally see that and my limited experience of working in development teams many years ago means that makes a great deal of sense.

My 'team' (as far as coding goes) is just me which is an advantage in that I don't have anyone else to worry about regarding maintenance, consistency and best practice...it is also a huge disadvantage as I have nobody else to ensure I think about maintenance, consistency and best practice!

Frameworks are high on my list of things to look into over the festive break...
...one of many things thanks to the Wisdom of the Monastry!

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

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

    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.

      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

      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.

Re^7: Here documents in blocks (why templates)
by LanX (Saint) on Dec 21, 2020 at 14:37 UTC
    > My "team" (as far as coding goes) is just me which is an advantage in that I don't have anyone else to worry about regarding maintenance

    My team are often me, myself and I.

    When working at several projects at the same time one will often have gaps of several weeks in between. All things stored in short memory are wiped out and you start swearing about this "colleague".

    To be fair, I haven't used any template engine yet, because my vice are the dark arts of Perl wizardry (and because web dev is only a part of my endeavors)

    But the community around a framework like Mojolicious is effectively a team giving you support. So I'd certainly chose it for a serious project.

    And by all means, printing HTML line by line makes me speechless. Oo

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-25 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found