• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Perl CGI

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Thelemac

Administratively Deficient
Joined
Mar 15, 2001
Working on a web doohickey...

anybody got a good glossary of syntax for this online? Or maybe have an idea of how to do frames with Perl that doesn't involve using Print (cause that's not really using perl, now is it? :D)

On an off note, I need to oil my keyboard. It's squeaky. :D
 
www.perl.org probably has linkage.

You don't do frames in Perl, you print/echo out html to tell the browser to do that. Thats how dynamic pages work, you write the logic in a generic language like Perl that will print out different pages depending on different things.
 
Hm, well, that's my index (and not dynamic anyway, the frameset is always the same) so there's a good chance I'll just leave it in HTML. Just wanted to see if there was a way that made sense for my purposes to do it in perl, since that's kinda what we're trying to do the page in.
 
I looked around a few sites on doing frames in Perl and came up pretty empty. I found a little part about it in the ActivePerl documentation. Here's what i found.

WORKING WITH FRAMES

It's possible for CGI.pm scripts to write into several browser panels and windows using the HTML 4 frame mechanism. There are three techniques for defining new frames programmatically:

1. Create a <Frameset> document
After writing out the HTTP header, instead of creating a standard HTML document using the start_html() call, create a <FRAMESET> document that defines the frames on the page. Specify your script(s) (with appropriate parameters) as the SRC for each of the frames.

There is no specific support for creating <FRAMESET> sections in CGI.pm, but the HTML is very simple to write. See the frame documentation in Netscape's home pages for details

http://home.netscape.com/assist/net_sites/frames.htm

2. Specify the destination for the document in the HTTP header
You may provide a -target parameter to the header() method:

Code:
print $q->header(-target=>'ResultsWindow');

This will tell the browser to load the output of your script into the frame named ``ResultsWindow''. If a frame of that name doesn't already exist, the browser will pop up a new window and load your script's document into that. There are a number of magic names that you can use for targets. See the frame documents on Netscape's home pages for details.

3. Specify the destination for the document in the <FORM> tag
You can specify the frame to load in the FORM tag itself. With CGI.pm it looks like this:

Code:
print $q->start_form(-target=>'ResultsWindow');

When your script is reinvoked by the form, its output will be loaded into the frame named ``ResultsWindow''. If one doesn't already exist a new window will be created.

The script ``frameset.cgi'' in the examples directory shows one way to create pages in which the fill-out form and the response live in side-by-side frames.
 
Why do you need Perl to support some specific html feature? Its not going to, because it isn't supposed to. It would be silly if it did. Just print the html.
 
I don't *need* it in Perl, but I thought I'd see if it were an option. ;) Just wanted to see if there were a way that would make sense to do it in Perl, since that's what the majority of the project is currently coded in (albeit very poorly).
 
Well if you are so bent on it, just write some functions or something that echo the html for you.
 
Heh, I'm not. :)

Was just curious if it were an option that made sense. ;)
 
Back