csteinhilber
Programmer
We have a legacy PERL solution to build the UI on our webpages. We're migrating to a full CMS, but for the time being about 60% of our pages are still using something like:
Pageopen builds the BODY tag, the UI header and left nav bar based on several parameters passed into it on the exec command.
Pageclose closes any DIVs, etc that Pageopen opened, and closes the BODY tag.
It's served us pretty well for many years.
But now I have a real need to have several of the variables that Pageopen uses/creates by accessible to Pageclose (without any rewrite to the exec commands).
What's the best way to do this?
So options I've been thinking about:
- having Pageopen open a session and store appropriate vars there (and have Pageclose read the vars then close the session so it doesn't hang around unnecessarily).
- somehow make Pageopen run persistantly, and maybe Pageclose would be able to read it's vars if it's still running (??)
- create some sort of unique ID, write variable values to a text file with that name, which Pageclose could then read. But the unique ID would have to be assembled from some server variables that both Pageopen and Pageclose could consistantly grab and arrive at the same value. Not sure what those "server variables" would be.
- have Pageopen store values into a cookie, which Pageclose could read. But our target audience is not fond of cookies (less fond of cookies than your average user), and we can't guarantee that cookies are are turned on.
- have Pageopen use javascript to write a hidden form field or something that Pageclose could read (but I'm not at all sure how Pageclose could read it)
- store values in the scope of the page request, somehow... since it's all a single page request. But I have no idea what scope that would be in terms of CGI/PERL.
Anyone else have any other ideas, or solutions for any of the alternatives above?
Any help would be greatly appreciated!
Thanks in advance,
-Carl
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>A Page Title</title>
<meta name="description" content="About Page" />
<meta name="doctype" content="General" />
<meta name="Last-Modified" content="2/01/00" />
:
:
</head>
<!--#exec cmd="/cgi-bin/pageopen.cgi template=a1 nav=nav1 ad=ad001 login=yes" -->
<!-- BEGIN MAIN CONTENT AREA -->
Hello World
<!-- END MAIN CONTENT AREA -->
<!--#exec cmd="/cgi-bin/pageclose.cgi"-->
</html>
Pageopen builds the BODY tag, the UI header and left nav bar based on several parameters passed into it on the exec command.
Pageclose closes any DIVs, etc that Pageopen opened, and closes the BODY tag.
It's served us pretty well for many years.
But now I have a real need to have several of the variables that Pageopen uses/creates by accessible to Pageclose (without any rewrite to the exec commands).
What's the best way to do this?
So options I've been thinking about:
- having Pageopen open a session and store appropriate vars there (and have Pageclose read the vars then close the session so it doesn't hang around unnecessarily).
- somehow make Pageopen run persistantly, and maybe Pageclose would be able to read it's vars if it's still running (??)
- create some sort of unique ID, write variable values to a text file with that name, which Pageclose could then read. But the unique ID would have to be assembled from some server variables that both Pageopen and Pageclose could consistantly grab and arrive at the same value. Not sure what those "server variables" would be.
- have Pageopen store values into a cookie, which Pageclose could read. But our target audience is not fond of cookies (less fond of cookies than your average user), and we can't guarantee that cookies are are turned on.
- have Pageopen use javascript to write a hidden form field or something that Pageclose could read (but I'm not at all sure how Pageclose could read it)
- store values in the scope of the page request, somehow... since it's all a single page request. But I have no idea what scope that would be in terms of CGI/PERL.
Anyone else have any other ideas, or solutions for any of the alternatives above?
Any help would be greatly appreciated!
Thanks in advance,
-Carl