Results 1 to 5 of 5

Thread: please help me with PERL/CGI.

  1. #1

    please help me with PERL/CGI.

    Hi
    thanx all for helping me with my last post on PERL, but now i found, yet another, silly obsticle
    to overcome: using perl with the web.

    i tried using some of my material's examples, but the same problem.

    My programs are jus read as plain txt.

    Ex1
    #begining of example
    this is my OWN perl script:

    #begining of example
    print "content-type = \"html\"\n";
    print "\n";
    print "<html>\n";
    print "<head>\n";
    print "</head>\n";
    print "<body>\n";
    print "hello";
    print "</body>";
    print "</html>";
    #end of example

    AND THIS IS WHAT IS DISPLAYED ON MY BROWSER WHEN I CALL IT WITH A <A HREF>.
    #begining of example
    print "content-type = \"html\"\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "hello"; print ""; print "";
    #end of example


    i am new @ perl and my goal with it is to use it for web information proccessing(some proggrammer, cant even get the examples to work )
    in my example they try to EMPHASIZE that u have to leave a BLAN K LINE after "CONTENT-TYPE: html/text",is that true

    and when i rename my PERLSSCRIPT.pl to PERLSCRIPT.cgi it saves it as a *.txt file,
    but when i rename it on the server self(via ftp) it changes "correctly" but i still cant use it(
    with CGI scripts it jus give me an "PAGE NOT FOUND" error).

    and that lead me to believe that CGI scripts can only be executed on a server.

    PLEASE HELP.
    thanx for reading this long post.
    Beware, you who seek first and final principles, for you are
    trampling the garden of an angry God and he awaits you just beyond the last theorem.

  2. #2
    Jaded Network Admin nebulus200's Avatar
    Join Date
    Jun 2002
    Posts
    1,356
    First of all you have to have permission to run cgi scripts on the web server itself.
    Second, you have to tell the web server how to handle extensions (be it .cgi or .pl), in
    other words you have to tell it what program to hand off the script to.

    Third, try the CGI module...

    Fourth, I think you have something wrong here:
    Code:
    print "content-type = \"html\"\n";
    print "\n";
    Try:
    Code:
    print "Content-type: text/html; charset=ISO-8859-1\n\n";
    /nebulus
    There is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect...There is no escape from it, we are forever slaves to it. Our only hope, our only peace is to understand it, to understand the 'why'. 'Why' is what separates us from them, you from me. 'Why' is the only real social power, without it you are powerless.

    (Merovingian - Matrix Reloaded)

  3. #3
    sorry , i jus copied and pasted the latest test i did(in wich i switched the : with =, but didn't work),
    what i mean is that i already tried that, and it doesn't work.
    ****

    //EDIT

    I BELIEVE ,I DONT HAVE PERMISSION FOR PL-SCRIPTS,
    and "CUSTOM" CGI scripts (what do they mean by custom,i thought all cgi-scripts are custom).
    but aint these *.pl and *.cgi scripts suppose to work ON MY PC(stand-alone)(offline)??

    i really dont know all that much about servers and those stuff.

    Beware, you who seek first and final principles, for you are
    trampling the garden of an angry God and he awaits you just beyond the last theorem.

  4. #4
    Senior Member
    Join Date
    Mar 2003
    Location
    central il
    Posts
    1,779
    They probably won't work standalone as on the server they write lines dynamicly at the web server taht turns them into the proper output (or a more corrrect statment would be that they are working, the output you see local is exactly what they should output and a web server needes to convert them into what you expect.) If the server is running apache your best bet may be MOD Perl
    Who is more trustworthy then all of the gurus or Buddha’s?

  5. #5
    thanx.
    yup i'm running a apachee server......

    i'll check it out thanx
    *****
    Beware, you who seek first and final principles, for you are
    trampling the garden of an angry God and he awaits you just beyond the last theorem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •