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

Dear monks,

I'm trying to include a cgi script in my main page, and not the way of
including that I get the statements out of it. But I want to run a userlist script in
a table as an alternative to frames, like with the url index.cgi?page=sec_tut.
What I have so far is this:
sub load_page { $page = param("page"); switch($page) { case "userlist" { $file = `/var/www/login/userlist.cgi`; if (-e "/var/www/login/userlist.cgi") { print $file; } } } }
The output from the above code is almost good, but I have a table created with CGI.pm
and I want userlist.cgi to load inside of the table so the users stay on the main page while
they're surfing the site. btw: I've used the commands "do" and "require".
If you need to see more code let me know.

Greeting Pr0t0n

Replies are listed 'Best First'.
Re: loading or including cgi file in main page
by NetWallah (Canon) on Jun 13, 2009 at 03:42 UTC
              ... But I want to run a userlist script in a table as an alternative to frames,

    Did you mean that you want the OUTPUT of a script to populate a part of a page ?

    If I understand your stated requirement - trying to populate a part of a table via a script - this cannot be accomplished without frames, or very fancy AJAX.

    For what I think you can do - is execute the $file, and print the result as part of the main CGI.

    Update: Oops - just noticed you used backticks to do just that.

    So what part of the output are you unhappy with ?

    Please post desired, and current output.

         Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)

Re: loading or including cgi file in main page
by Pr0t0n (Novice) on Jun 13, 2009 at 15:52 UTC
    Hello,

    I can show it better then I can tell you, if you go to my website:
    http://black-cell.no-ip.biz/index.cgi?page=userlist.
    You will see the main page, and above the table you see that the
    script is executed but I don't want it above my table but just in it
    (and then I mean the table below the banner). I have a piece of
    code what does the right thing but it is in php, maybe it can help you.
    if(isset($_GET['page'])) { $page = $_GET['page']; switch($page) { case "home": if(!file_exists("./nieuws/home.php")) { header('locati +on: main.php'); exit; } include("./nieuws/home.php"); break;

    And with this code the link index.php?page=home opens the php
    script in the desired table(row). And as you see php has a really
    nice function include(); but perl has required() that supposed to
    do the same thing. Hope you can help.

    Pr0t0n