M
MST
Usually I use perl for system admin type things, but recently I've
been writing a flurry of CGI scripts. In the process I find my self
using (abusing?) here-docs to print chunks of HTML code. I find that
no matter how hard I try I just can't find a style of writing a
here-doc that pleases me I've tried things like this:
if($test) {
print <<HTML
<p>Some html $Junk!</p>
<p>$More junk</p>
HTML
}
and that isn't so bad. What irks me is if the here-doc isn't at the
end of a block I need to throw a ; on a line all by its lonesome. This
leaves me trying to creatively position code chunks such that the
here-doc is at the end of a block (which usually results in less
readablility in the end). The readablity of my code is fairly
important as eventually I will be passing it off to a much less
seasoned perl programmer.
What do you guys think? Should I forget it and switch to using
multiple print qq()'s? Is there a better way to format the here-doc?
Maybe I just have a stick up my butt; however I wanted to see what
kind of feedback I'd get from the .misc crowd.
been writing a flurry of CGI scripts. In the process I find my self
using (abusing?) here-docs to print chunks of HTML code. I find that
no matter how hard I try I just can't find a style of writing a
here-doc that pleases me I've tried things like this:
if($test) {
print <<HTML
<p>Some html $Junk!</p>
<p>$More junk</p>
HTML
}
and that isn't so bad. What irks me is if the here-doc isn't at the
end of a block I need to throw a ; on a line all by its lonesome. This
leaves me trying to creatively position code chunks such that the
here-doc is at the end of a block (which usually results in less
readablility in the end). The readablity of my code is fairly
important as eventually I will be passing it off to a much less
seasoned perl programmer.
What do you guys think? Should I forget it and switch to using
multiple print qq()'s? Is there a better way to format the here-doc?
Maybe I just have a stick up my butt; however I wanted to see what
kind of feedback I'd get from the .misc crowd.