shambright has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to use Perl to create a frameset AND output content to the resulting frames without having to create and save HTML documents?? The idea is to display MySQL form data (and links) in a left hand frame and descriptions in a right hand frame, but I can't seem to figure out how to accomplish it without generating an HTML file for <FRAME SRC="mysqldata.html" NAME="left"> each time I run the script. ?

Replies are listed 'Best First'.
Re: Perl and Frames...
by dws (Chancellor) on Apr 19, 2001 at 05:50 UTC
    Something like the following script will work, once you flesh it in.
    #!/usr/bin/perl -Tw use strict; use CGI qw(:standard); my $query = new CGI; print header(); if ( defined $query->param('left') ) { # emit the left frame print start_html(); print h1("Left"); print end_html(); } elsif ( defined $query->param('right') ) { # emit the right frame print start_html(); print h1("Right"); print end_html(); } else { my $script = $ENV{'SCRIPT_NAME'}; print frameset( {-cols => "25%,75%"}, frame({-name => "left", -src => "$script?left=1"}), frame({-name => "right", -src => "$script?right=1"}) ); }
Re: Perl and Frames...
by Masem (Monsignor) on Apr 19, 2001 at 04:20 UTC
    I'm pretty sure you can do it by having some extra parameter in your script, call it 'frame'. If frame is null, generate the frame set, and for the frame documents, reference your same CGI script with the frame variable set. If the frame variable is set, generate the appropriate content for that frame and output it.


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain