S_Shrum has asked for the wisdom of the Perl Monks concerning the following question:
I posted this about 2 weeks ago but it's not working so I thought I'd start fresh so everyone could see it and input.
I have a CGI created hash (%input) of parameters that are passed to this script. I want to be able to go through the hash and replace matching tokens in a template file with these values.
Example: 'http://someserver/cgi/somecall.pl?file=this.dat', I could then do a search and replace on the $page_template for $file$, where the parameter name is between the wrapper character (in this case '$').
This is what I have currently:
my $w = $input->param('wrapper'); for ( keys %input ) { $page_template =~ s/\Q$w$_$w/$input->param($_)/eg; $page_template =~ s/\Q$w\lc\_$_\E$w/$input->param(lc)/eg; $page_template =~ s/\Q$w\uc\_U$_\E$w/$input->param(uc)/eg; }
...but this is not working.
Note that I am also doing a upper and lower case replacement as well. Parameter names will be appended with a "lc_" or "uc_" depending on the template writers need.
Any help getting this to work would be greatly apprechiated as this is the only thing in my script that I have left to fix (I think) ;-p.
TIA
======================
Sean Shrum
http://www.shrum.net
|
|---|