Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Possible to refer to variable defined later in script?

by sundialsvc4 (Abbot)
on Nov 13, 2012 at 01:07 UTC ( #1003533=note: print w/ replies, xml ) Need Help??


in reply to Possible to refer to variable defined later in script?

There are, IMHO, “a whole bunch of extremely good reasons why” it is best:   (a) to determine what you want to generate before you generate it; and (b) to use a templating tool to actually generate the HTML or anything-else.

One of these reasons is “separation of concerns.”   If you do it “the other way,” the day will come when someone wants you to make some page-output change, e.g. so that the page looks noticeably-different in a particular case ... and, perhaps obviously (if you’re very lucky) but perhaps quite subtly, the answers start coming out wrong.   And the logic by that time is so danged jumbled-up that you wish you could rewrite it but in the meantime that you didn’t have to touch it.


Comment on Re: Possible to refer to variable defined later in script?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2015-07-08 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls