Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Here documents in blocks

by tybalt89 (Monsignor)
on Dec 19, 2020 at 20:39 UTC ( [id://11125468]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Here documents in blocks
in thread Here documents in blocks

It's just a tradeoff between danger and beauty :)

Personally I put the HERE-IS block at the left hand edge, and skip the whole "indent" thing.
(A what (indent) you see, is what you get.)

Replies are listed 'Best First'.
Re^4: Here documents in blocks
by LanX (Saint) on Dec 19, 2020 at 20:47 UTC
    > Personally I put the HERE-IS block at the left hand edge, and skip the whole "indent" thing. (A what (indent) you see, is what you get.)

    me too, mostly at the end of a sub.

    If I need a template, then it'll normally also merit a sub.

    sub html_admin { my($user_number)=@_; my $HTML_restricted = ""; $HTML_restricted = <<"__HTML__" if $user_number == 20; <tr> <td class="someClass">Restricted</td> </tr> __HTML__ return << "__HTML__"; <table> <tr> <td class="someclass" style="text-align:center">Some Content +</td> </tr> $HTML_restricted </table> __HTML__ }

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

      Personally I put the HERE-IS block at the left hand edge, and skip the whole "indent" thing. (A what (indent) you see, is what you get.)

      me too, mostly at the end of a sub.

      I think that LanX and tybalt89 have answered much of my question...is there an accepted best practice?
      Sounds like it's to just ignore the whole indent problem.

        > is there an accepted best practice?

        yes, but you won't like it. :)

        It's use one of the many template systems, especially for HTML.

        You can role your own, but at the end you will reinvent the wheel.

        Personally I'm stuck with a system at $work where I have to roll my own :/

        Another best practice is MVC ... well separation of code and templates at least.

        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://11125468]
help
Chatterbox?
and the web crawler heard nothing...

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

      No recent polls found