Game Development Community

Any PERL programmers in the house?

by Kirby Webber · in Technical Issues · 06/10/2003 (5:39 am) · 6 replies

I can't seem to find any information on this particular problem.

If you'll indulge me for a moment, I'll explain.

I have a navigation iFrame within my document that I want to populate dynamically, based on user interaction. I'm doing this with frames in order to aviod reloading the whole page with every movement of the user.

Within this frame, I want the nav buttons to be rollovers. In order to keep things simple, I placed the necessary Javascript functions in a text file that is then read by the script which populates the nav iframe. Once this textfile is read, each line is then fed to the browser in a simple foreach loop. I have validated that the functions are printing to the source correctly.

Now within the PERL code, a series of print statements write the images to the page, calling the respective functions when the mouse is moved over them. I have verified that this works with straight html, however when generate the page using my *.cgi's the button shows up, but there is no mouseover effect. It appears as a static image.

I know this is a stretch, and is a far cry from game development, but does anyone around here have any ideas? I'm stumped!

#1
06/10/2003 (2:12 pm)
I don't know much about Perl, so if this is stupid, please forgive me.

Do you have your own server? Because if you're using some service (like tripod or something), generally no CGI scripts will work except for scripts that they provide you with. They don't want people to be able to execute custom CGI stuff that might delete files from their server or fill their server with files or something.
#2
06/11/2003 (6:02 am)
Hi Steve. Actually, I got it already.

To answer, yes, I have my own server setup on my local machine as a dev server, and then a full virtual hosting plan on the web.

*.cgi's aren't a problem, as long as I'm careful about porting from my wintel machine into the unix server, which my host runs.

What I am doing essentially is parsing Javascript through a *.pl/ *.cgi to create dynamic pages and content based on user input/ selections.

Now to figure out how to change multiple frames through PERL without using Javascript (which has it's own set of "issues" when it comes to that.)

Thanks though!
#3
06/11/2003 (4:20 pm)
Aaahhh.. too late. Well, for future reference, I program in Perl and Java.. among others.
#4
06/12/2003 (6:10 am)
Hmmm... new trouble. I have a site layout that utilizes frames heavily. For example, my nav bar (on the right) has 5 frames, and loads the buttons dynamically through a combo of PERL and Javascript, which each in turn target the main content frame in their link attributes.

The end result, is that when you would normally enter a sub-domain (trying to get away from domain "clutter"), the navbar changes and populates only with buttons that are useful (if you follow me.)e.g. Top level has 5 links (home, company, blah, blah) while the products page has one (so far ;) at which time all the other frames (2-5) are rendered with a bg image and no liks.

Now the only problem I'm having is that the back button only affects one frame at a time. Essentially, I'm looking for a method to make a single click of the back button go back 6 instances in the history, thus changing all applicabe frames.

Any clues on how the h*ll this is done? Everywhere I look people assume that if you want to manipulate the history of a browser, that you must be a porn or warez site. -How unfortunately short sighted. =(
#5
06/12/2003 (4:04 pm)
Have you considered using one of the Template modules that Perl has? Sounds like you could save yourself some maintenance headaches by keeping it simple. I'll dare to ask : Have you designed a site map and a functional flowchart to help define what your requirements are for navigation on your site? It really does help.

I don't use frames, period. I use JavaScript for form validation, pop-ups, dynamic page-only events - Perl or ASP or JSP / Servlets do the actual thinking / lifting.. but never JavaScript. If you have time I'd also recommend looking up what a MVC pattern is (Model-View-Controller), that might give you some inspiration for your design efforts.
#6
07/04/2003 (1:41 am)
Javascript is client side where as Perl is server side. Once Perl has written code to the browser, it's job ends there, meaning that any errors in the page are going to be within that page source. Your best bet is to run the perl script and then compare the resulting code with the static page that works. There's likely a very simple error that's stopping it from working.

Run the page and check the icon in the status bar in the bottom left corner of the page. If there is a yellow icon, that suggests a JavaScript or VBScript error. Double clicking this icon will tell you the error and the line in the source where the error is occurring.

If all else fails... Feel free to send me the pages. I've been pro developing for 4 years and know perl and javascript like they were english.