How does a script language work in a server

Discussion in 'Perl Misc' started by John, May 25, 2012.

  1. John

    John Guest

    When someone uses s browser and goes to a www.somesite.com/someperl.pl how does
    it work at the server end? Let's say I'd like to create a "perl-clone" or
    something like perl or php where would I get more info?
     
    John, May 25, 2012
    #1
    1. Advertising

  2. John

    Guest

    On 5/25/12 2:34 PM, John wrote:
    > When someone uses s browser and goes to a www.somesite.com/someperl.pl how does
    > it work at the server end?


    The web server will either return the raw contents of that page or, if
    configured to do so, execute the file and instead return the output.
    Again, this is a server specific configuration.

    >Let's say I'd like to create a "perl-clone" or
    > something like perl or php where would I get more info?


    You'd like to design a new language? Jeez, kind of a big thing to do.
    I'd start with the basics. Here is a free online book that I think is
    really good and is very approachable if you already know Perl.
    http://billhails.net/Book/
    After you make it through that take what you learned and check out
    some real life examples. There is no shortage of code for you to
    go through in this area. Look at what Perl6, Jython, or PHP are
    doing, for example.
     
    , May 25, 2012
    #2
    1. Advertising

  3. John

    ccc31807 Guest

    On May 25, 2:34 pm, John <> wrote:
    > When someone uses s browser and goes to awww.somesite.com/someperl.plhow does
    > it work at the server end? Let's say I'd like to create a "perl-clone" or
    > something like perl or php where would I get more info?


    There are a number of ways this /could/ work, but the simplest case
    perhaps is CGI. It works like this:

    1. The client user accesses http://example.com/script.cgi
    2. The client browser constructs an HTTP header and perhaps body
    3. The package is sent over the wire to some web server
    4. The web server receives the HTTP request and parses it
    5. The web server decides that 'cgi' represents a call to a script,
    and hands it off to a script, invoking the Perl executable, and sends
    the appropriate parameters
    6. The Perl executable executes the script, accepting the parameters
    as input and returning the appropriate results as output. This usually
    consists of HTML, but could consists of other things and usually
    involves some other kinds of machinations behind the scenes, like
    running some SQL against a database and munging the SQL results
    7. The web server receives the return value from the script and sends
    it back down the wire to the client browser
    8. The client browser renders the HTML, or does some else (like show a
    Flash movie or play a wav file)

    CC.
     
    ccc31807, May 25, 2012
    #3
  4. John <> wrote:
    >When someone uses s browser and goes to a www.somesite.com/someperl.pl how does
    >it work at the server end?


    That depends totally upon how the server is configured. The server may
    respond by sending the content of this file (provided this URL actually
    does refer to a file), it may execute this file as a program and return
    any output this program generates (those two are common scenarios), it
    may query a database and return all results that are found using the
    query someperl.pl (not so common), or it may do any of a gazillion
    different things. It all depends on how the server is configured.

    >Let's say I'd like to create a "perl-clone" or
    >something like perl or php where would I get more info?


    At relevant graduate classes about "Design of Programming Languages" and
    "Compiler Construction" at your favourite university.

    jue
     
    Jürgen Exner, May 25, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    4,939
    Craig Deelsnyder
    Oct 31, 2003
  2. Edward
    Replies:
    1
    Views:
    5,868
    ge0rge
    Apr 3, 2006
  3. misterdi
    Replies:
    0
    Views:
    581
    misterdi
    Jul 28, 2009
  4. Rajat
    Replies:
    3
    Views:
    747
    Jorgen Grahn
    Jan 8, 2010
  5. rigo
    Replies:
    0
    Views:
    189
Loading...

Share This Page