How does a script language work in a server

J

jaialai.technology

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.
 
C

ccc31807

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.
 
J

Jürgen Exner

John said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top