Want to create a website using perl and CGI

K

king

I only have knowledge of perl and I have never worked in CGI.

I want to develop a webpage or website of my own using perl and cgi.

Can anybody suggest me how to start with and which book or website I
will get all the help from.

Regards
 
J

John Bokma

king said:
I only have knowledge of perl and I have never worked in CGI.

I want to develop a webpage or website of my own using perl and cgi.

Just curious: why?

And how do you want to use CGI? For dynamic page generation?
Can anybody suggest me how to start with and which book or website I
will get all the help from.

Be sure to check out the CGI module. Some books I have seen come up with
badly by the author written CGI libraries. (I never like books that write
101 modules in the first place).

type at the command line:

perldoc CGI

perldoc -q cgi

-> Where can I learn about CGI or Web programming in Perl?
 
A

Andrew DeFaria

king said:
I only have knowledge of perl and I have never worked in CGI.
CGI is nothing more than a program that spits out HTML for a web server
to consume.
I want to develop a webpage or website of my own using perl and cgi.
Big question: Why? What is it you are trying to accomplish in your web
site? What makes you think you need to use Perl to do it?
Can anybody suggest me how to start with and which book or website I
will get all the help from.
To write HTML using Perl cgi scripts start first with understanding how
to write just web pages in plain HTML. Once you understand that look
into CGI.pm iff you need to generate a web page using Perl.
 
C

Charlton Wilbur

ADF> CGI is nothing more than a program that spits out HTML for a
ADF> web server to consume.

Er, no. CGI is the protocol that the webserver uses to communicate
form values back to the server.

Charlton
 
A

Andrew DeFaria

Charlton said:
ADF> CGI is nothing more than a program that spits out HTML for a
ADF> web server to consume.

Er, no. CGI is the protocol that the webserver uses to communicate
form values back to the server.
Yeah and that protocol effectively says "I'll call you, give you certain
things as input and I expect to see HTML handed back to me, complete
with proper headers - otherwise I'll complain". Ergo "CGI is nothing
more than a program that spits out HTML for a web server to consume".
 
R

Robert 'phaylon' Sedlacek

Andrew DeFaria said:
Yeah and that protocol effectively says "I'll call you, give you certain
things as input and I expect to see HTML handed back to me, complete
with proper headers - otherwise I'll complain". Ergo "CGI is nothing
more than a program that spits out HTML for a web server to consume".

CGI is not even a "program." As stated earlier, CGI is a spec. And
excuse me for being anal, but a spec defining how "certain things" are
passed "as inputs" and what to expect as output is a completely
different thing as "nothing more than a program that spits out HTML for
a webserver."

That's like saying cheese is nothing more than old juice squeezed out
of a cow.
 
S

Scott Bryce

Andrew said:
Yeah and that protocol effectively says "I'll call you, give you certain
things as input and I expect to see HTML handed back to me

Most CGI scripts I write don't hand back HTML. The CGI protocol doesn't
care what is sent back to the browser.
 
U

Uri Guttman

AD> Er, no. CGI is the protocol that the webserver uses to
AD> communicate form values back to the server.

AD> Yeah and that protocol effectively says "I'll call you, give you
AD> certain things as input and I expect to see HTML handed back to
AD> me, complete with proper headers - otherwise I'll complain". Ergo
AD> "CGI is nothing more than a program that spits out HTML for a web
AD> server to consume".

and did you know that you can send any format of content back to the
server, not just html? that is the whole point that was made, cgi is the
PROTOCOL for a web server to fork and communicate with a subprocess. it
has nothing to do with the content sent back by the process. CGI ne
HTML. just like PERL (sic) ne CGI as we tell web newbies all the time.

uri
 
A

Andrew DeFaria

Scott said:
Most CGI scripts I write don't hand back HTML. The CGI protocol
doesn't care what is sent back to the browser.
When you write a CGI script and the web server calls it and you send
back "foobar" the web server complains because you did not send back a
valid HTML header. Or at least that's what happens when I do it. What
happens when you just send back "foobar" to the web server?
 
A

Andrew DeFaria

Uri said:
and did you know that you can send any format of content back to the
server, not just html?
And if you do the web server errs out.
that is the whole point that was made, cgi is the PROTOCOL for a web
server to fork and communicate with a subprocess. it
has nothing to do with the content sent back by the process. CGI ne
HTML. just like PERL (sic) ne CGI as we tell web newbies all the time.
Again, if you do not send back a valid HTML header the web server (or at
least every web server I've ever used) displays an error complaining
about invalid headers.

Technically CGI is just a protocol - practically you need to return HTML.
 
A

Andrew DeFaria

Sherm said:
It says no such thing about the output. A CGI-compliant app can
produce HTML, SWF, PDF, XML, JPEG... anything.
It needs to at least return a proper header.
By the way, why are you posting HTML-formatted messages to usenet?
Why are you complaining about it? If you don't like it then feel free
not to read it.
This is not a "web board" I know that.
- please stop doing that.
Sorry but I won't.
 
J

Jürgen Exner

<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Scott Bryce wrote:
<blockquote cite="(e-mail address removed)"
type="cite">Andrew DeFaria wrote:
<br>
<blockquote type="cite">Yeah and that protocol effectively says "I'll
call you, give you certain things as input and I expect to see HTML
handed back to me
<br>
</blockquote>
Most CGI scripts I write don't hand back HTML. The CGI protocol doesn't
care what is sent back to the browser.
<br>
</blockquote>
When you write a CGI script and the web server calls it and you send
back "foobar" the web server complains because you did not send back a
valid HTML header. Or at least that's what happens when I do it. What
happens when you just send back "foobar" to the web server?<br>
</body>
</html>

Are you by chance confusing HTML header (which is the <head>...</head> tag,
see above in your convoluted posting) with HTTP header?
Because if your CGI script returns let's say plain text or a JPEG picture,
then you won't have an HTML header.

jue
 
S

Scott Bryce

Andrew said:
Scott Bryce wrote:

When you write a CGI script and the web server calls it and you send
back "foobar" the web server complains because you did not send back a
valid HTML header. Or at least that's what happens when I do it. What
happens when you just send back "foobar" to the web server?

Most of the CGI scripts I write generate PDF documents. As long as I
send the correct headers for the PDF document, both the webserver and
the browser are happy.
 
U

Uri Guttman

AD> Uri Guttman wrote:
AD> and did you know that you can send any format of content back to the
AD> server, not just html?

AD> And if you do the web server errs out.

you know not of what you talk.


AD> Again, if you do not send back a valid HTML header the web server
AD> (or at least every web server I've ever used) displays an error
AD> complaining about invalid headers.

there is no such thing as an HTML header. none. nada. it is an HTTP
header. please learn the difference. it will save your life one day.

AD> Technically CGI is just a protocol - practically you need to return HTML.

no. is a GIF/JPEG/PNG html? is xml html? is plain text html? you don't
seem to understand this at all.

i give up. you know more than all the web hackers in the world.

uri
 
U

Uri Guttman

AD> Sherm Pendley wrote:

AD> This is not a "web board"

AD> I know that.

AD> - please stop doing that.

AD> Sorry but I won't.

you are losing all possible help here. not that you would listen or
learn anyhow. i bet you call html a programming language too.

insult: you are the target audience for php. the clueless (no security)
leading the clueless (don't know they have no security).

AD> Alzheimer's advantage: New friends every day.

you must be living that. have fun!

uri
 
A

Andrew DeFaria

Uri said:
AD> Uri Guttman wrote:
AD> and did you know that you can send any format of content back to the
AD> server, not just html?

AD> And if you do the web server errs out.

you know not of what you talk.


AD> Again, if you do not send back a valid HTML header the web server
AD> (or at least every web server I've ever used) displays an error
AD> complaining about invalid headers.

there is no such thing as an HTML header. none. nada. it is an HTTP
header. Whatever.
please learn the difference. it will save your life one day. Yeah right.
AD> Technically CGI is just a protocol - practically you need to
return HTML.

no. is a GIF/JPEG/PNG html? is xml html? is plain text html? you don't
seem to understand this at all.
You know what I mean... Hmmm... Perhaps you don't.
 
A

Andrew DeFaria

Sherm said:
Because this is usenet, not a web board. HTML-formatted messages are
not welcome here. Have you read the posting guidelines that are posted
here frequently?
Guidelines, not rules nor laws.
So you're posting HTML to a plain-text medium on purpose? Exactly.
What's the point of doing that
To piss you off. Is it working?
- do you *want* to look like a fool?
I see. So anybody who doesn't agree with you is a fool. Right.
 
U

Uri Guttman

AD> Uri Guttman wrote:

AD> there is no such thing as an HTML header. none. nada. it is an HTTP
AD> header.

AD> Whatever.

shows you care about your work

AD> please learn the difference. it will save your life one day.

AD> Yeah right.

well, it will save your job at least.

AD> Technically CGI is just a protocol - practically you need to return
AD> HTML.

AD> no. is a GIF/JPEG/PNG html? is xml html? is plain text html? you don't
AD> seem to understand this at all.

AD> You know what I mean... Hmmm... Perhaps you don't.

no, you don't know what you mean. i am the one telling you the
difference. so did several others. please go learn php. it was designed
for kindergarten level web monkeys.

uri
 
K

Keith Keller

You know what I mean... Hmmm... Perhaps you don't.

Clearly you either don't know what you mean, or don't know what you're
talking about. Let's be clear: CGI does not have to send HTML! It can
send, for example, a dynamically-generated JPEG, directly to the web
server, which in turn (if the CGI has also sent the proper HTTP headers)
sends it to the client. There's no HTML involved.

All a CGI program needs to return is a valid HTTP header and content.
Sometimes you want a CGI to send text/html; sometimes you don't.

Perhaps you are confusing what everyone has been telling you with
sending HTML like <img src="/blah.img"> . If you send that as HTML
from your CGI, then the client sends another request for /blah.img,
and the webserver handles that separately, outside the CGI. But one
could also send <img src="/cgi-bin/blah.pl"> , where /cgi-bin/blah.pl in
turn is a dynamic image creator. Surely even you can see that blah.pl
must send back an appropriate HTTP Content-type header (e.g., image/jpeg)
and the same binary data that generating and saving the image to
blah.img would make the webserver send if requested statically.

If you don't understand the above, you should really learn more about
CGI before giving advice on it (not to mention arguing with folks far
more experienced in CGI than you or me).

--keith
 
C

Charlton Wilbur

ADF> Technically CGI is just a protocol - practically you need to
ADF> return HTML.

Wait -- a minute ago you were telling us that CGI was a computer
program! You need to stop and think before you post.

The thing you are trying and failing to explain (possibly because you
don't understand it fully yourself) is this: part of the CGI protocol
is that the web server expects the child process to output HTTP (*not*
HTML) headers first to indicate what sort of data it is producing. If
you indicate with the Content-Type header that your child process will
produce HTML, then you need to produce HTML.

If memory serves, this is all hidden from you in PHP. This may be why
you are confused.

Charlton
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top