1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

CGI/Perl Tutorials

Discussion in 'Software Development' started by Regicide, Mar 26, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. Regicide

    Regicide Thread Starter

    Joined:
    Aug 8, 2003
    Messages:
    307
    I'm looking for a good Perl/CGI tutorial. Or if anyone knows any good books about this, it would help alot. Thanks!
     
  2. malice

    malice

    Joined:
    Jun 18, 2003
    Messages:
    56
  3. SpeedRacer5

    SpeedRacer5

    Joined:
    Feb 10, 2004
    Messages:
    201
  4. malice

    malice

    Joined:
    Jun 18, 2003
    Messages:
    56
    wow i could really use something like that for javascript

    is there something like that too for javascript?
     
  5. Regicide

    Regicide Thread Starter

    Joined:
    Aug 8, 2003
    Messages:
    307
    Thanks for the quick responses on tutorials. Now I only have a few questions. What is the differences between CGI and Perl, other than syntax? And which is the better language?
     
  6. -Sx-

    -Sx-

    Joined:
    Mar 27, 2004
    Messages:
    20
    In answer to your question let me say that CGI isn't a language - it is an Interface.

    The Common Gateway Interface allows for applications to communicate using a "common" syntax. You can have COBOL speak CGI to another application which understands CGI also.

    This is a Unix shell script which talks CGI:
    #!/bin/sh
    # disable filename globbing
    set -f

    echo Content-type: text/plain
    echo

    echo $GATEWAY_INTERFACE test script report:
    echo

    echo argc is $#. argv is "$*".
    echo

    echo SERVER_SOFTWARE = $SERVER_SOFTWARE
    echo SERVER_NAME = $SERVER_NAME
    echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
    echo SERVER_PROTOCOL = $SERVER_PROTOCOL
    echo SERVER_PORT = $SERVER_PORT
    echo REQUEST_METHOD = $REQUEST_METHOD
    echo HTTP_ACCEPT = "$HTTP_ACCEPT"
    echo PATH_INFO = "$PATH_INFO"
    echo PATH_TRANSLATED = "$PATH_TRANSLATED"
    echo SCRIPT_NAME = "$SCRIPT_NAME"
    echo QUERY_STRING = "$QUERY_STRING"
    echo REMOTE_HOST = $REMOTE_HOST
    echo REMOTE_ADDR = $REMOTE_ADDR
    echo REMOTE_USER = $REMOTE_USER
    echo AUTH_TYPE = $AUTH_TYPE
    echo CONTENT_TYPE = $CONTENT_TYPE
    echo CONTENT_LENGTH = $CONTENT_LENGTH


    A Perl example:
    #!/usr/local/bin/perl
    ##
    ## printenv -- demo CGI program which just prints its environment
    ##

    print "Content-type: text/plain\n\n";
    foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
    }


    You can see a more complex Perl example here:
    http://insecurity.org/cgi/cgi_reflect.cgi

    Perl is a advanced programming language with as much power and C with 1/10th the coding effort.

    CGI.pm is a CGI Perl Module which extends the Perl language so that you have an exposed Interface for writing CGI without having to know all the gory details.

    HTH/Bill
     
  7. Regicide

    Regicide Thread Starter

    Joined:
    Aug 8, 2003
    Messages:
    307
    THANKS MAN! That helps alot!
     
  8. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/214783

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice