Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
[Corion]: ambrus: AnyEvent(::HTTP) doesn't integrate well with Prima, that's my main problem
[Corion]: There is a weirdo shim because there is a POE integration for Prima, and if you use that, you can use the POE adapter of AnyEvent. What I'd want is something transport agnostic that parses HTTP or produces HTTP output, so that the communication with ...
[Corion]: ... the socket is done by my code. Ideally that module would not be based on callbacks ;)
[Corion]: Basically, something that decouples the HTTP parsing (+ determining whether to redirect, etc) from the IO
[Corion]: All clients I'm aware of don't do that but issue all IO themselves

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2016-12-07 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.