A client of mine had a website developed some years ago and has a very simple CMS which is based on a simple flat file database with a text file and perl script. The client does not want to pay for a rewrite of the site (my experience is in PHP) but wants to make a simple change to the site which I cannot work out with my very limited knowledge of perl.
From what I can see, the perl script does a number of substitutions from the site template. For instance $include[filename.html] entered into the template will mimic the equivalent of an SSI command. This only works when entering a filename. I need to change the script so it also calls in a script (banner script) or url.
How do I change the $include code below to make this happen. I understand I will need to use get and call LWP::Simple; from the beginning of the script, but I'm not sure what I else I need to do.
I thought about adding another variable $geturl and edited / duplicated the $include statement to no avail.
You're on the right track. change $formTemplate=~s/$geturl\[([^\]]+)]/qx(get ""$1"")/ge; to $formTemplate=~s/\$geturl\[([^\]]+)\]/get($1)/ge;
and you should be fine. qx would run it as a systemcommand, and get from LWP::Simple is a perlfunction. It'll require complete URLs (http://host/uri), unlike SSI would. You forgot to escape the closing square brackets and I escaped the $ in the matching part just to make it clear that it's not a variable named $geturl, but it'd work without it, too.