in reply to Perl and HTML

I haven't done this with Perl, but with PHP if you have server side includes enabled in Apache, you can include a PHP file which will excute its code when the html page is fetched. I would guess you should be able to set up apache to do something similar with a Perl script.

As far as checking for cookies, the CGI.pm has something to deal with cookies CGI::Cookie or you can just search CPAN for "Cookie" here Cookie

Replies are listed 'Best First'.
Re: Perl and HTML
by MonkPaul (Friar) on Jul 06, 2005 at 14:49 UTC
    Can you not just create an overall script that gets passed some information on whether the cookies have been found or not. That way you can just include a simple statement that checks to see if the value is true or false then executes a given script based on the answer, say:
    my ($boolean) = @_; if($boolean eq 1) { #call script here } else { #call HTML page here }

    Hopefully this way you will be able to troubleshoot alot easier when you get a probelm with your code, where you can find the problem a much quicker - you know which script is causing the problem.

    MonkPaul.

      Ok, sorry, no one has the right idea. I don't want to call a html page from a cgi script. I want to call a cgi script from a HTML page. It's a short script. it does 2 things. when the user views my index.html page. the cgi script runs. It checks for to cookies. if it finds them, it says welcome back user. if it doesn't it then displays a form, so if they wanted to. they couls sign. or some thing lime that.

        Do yourself a big favor and read this: Ovid's CGI Course. It will help you understand how to work with CGI and HTML. If you want some example code that uses cookies, try these two nodes: 273481 and 273652. Just copy the code verbatim into a CGI script that can be executed by the web server. If that didn't make sense, then you need to read that first link. It will help.

        jeffa

        L-LL-L--L-LL-L--L-LL-L--
        -R--R-RR-R--R-RR-R--R-RR
        B--B--B--B--B--B--B--B--
        H---H---H---H---H---H---
        (the triplet paradiddle with high-hat)
        
Re^2: Perl and HTML
by jbrugger (Parson) on Jul 06, 2005 at 17:29 UTC
    perhaps a little off-topic, but if you really really want it, you can use embperl to code perl in html, the way php is used as well

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re^2: Perl and HTML
by bigjoe11a (Novice) on Jul 06, 2005 at 19:41 UTC
    Ok, you don't under stand. I already have the script completed . I just want to know how I can run it from with in a HTML page. If all else fails. Again. how do I run a cgi script from a HTML page Thanks