Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! - CGI.pm parse in here document?

Status
Not open for further replies.

pcorchary

MIS
Feb 23, 2002
60
US
Isn't it possible to reference a param('name') within a here document? I've tried the following, and they don't work:

my @html=<<EOF;
<somehtml> $cgi->param('floor')
<somehtml> param('mats')
<somehtml> &quot;param('covers')&quot;
EOF


HELP!?
 
I'm not sure why none of those work, but you could always assign the param values to regular scalar variables and then use those in the heredoc. Personally, I hate the CGI library. I never use it. I find it extremely cumbersome and annoying. I've written my own routines to handle most of what CGI does, and find them much easier to use. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Well, from I've been able to dig up, fuctions won't be parsed in a here-doc, so my only choice is to assign them to scalars or a hash outside the here-doc. (anyone?)

I backed myself into this corner as a very inexperienced Perl and CGI programmer, and now I have to make enhancements that are very difficult, or so a complete rewrite that I don't have time for :)
 
pcorchary,

That matches my experience. Personally, I've not run into this, because I tend to assign param() to an array or a hash to help the untainting and validation process.

I will warn you that here documents are interpolated by default. If you find that gets in the way, declare a non-interpolating here doc *or* construct the output using other techniques (concatenation, etc).

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top