Want to create a website using perl and CGI

Discussion in 'Perl Misc' started by king, Dec 18, 2006.

  1. king

    king Guest

    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
    king, Dec 18, 2006
    #1
    1. Advertising

  2. king

    John Bokma Guest

    "king" <> wrote:

    > 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?


    --
    John Experienced Perl programmer: http://castleamber.com/

    Perl help, tutorials, and examples: http://johnbokma.com/perl/
    John Bokma, Dec 18, 2006
    #2
    1. Advertising

  3. king wrote:
    > 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.

    --

    Andrew DeFaria <http://defaria.com>
    Shell to DOS... Come in DOS, do you copy? Shell to DOS...
    Andrew DeFaria, Dec 18, 2006
    #3
  4. >>>>> "ADF" == Andrew DeFaria <> writes:

    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


    --
    Charlton Wilbur
    Charlton Wilbur, Dec 18, 2006
    #4
  5. Charlton Wilbur wrote:
    >>>>>> "ADF" == Andrew DeFaria <> writes:

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

    --

    Andrew DeFaria <http://defaria.com>
    If you drink, don't park. Accidents cause people.
    Andrew DeFaria, Dec 18, 2006
    #5
  6. Andrew DeFaria <> wrote
    > 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.

    --
    thou shallst fear ..
    Robert 'phaylon' Sedlacek, Dec 18, 2006
    #6
  7. king

    Scott Bryce Guest

    Andrew DeFaria wrote:

    > 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.
    Scott Bryce, Dec 18, 2006
    #7
  8. king

    Uri Guttman Guest

    >>>>> "AD" == Andrew DeFaria <> writes:

    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

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Dec 18, 2006
    #8
  9. Scott Bryce wrote:
    > Andrew DeFaria wrote:
    >> 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.

    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?

    --

    Andrew DeFaria <http://defaria.com>
    A mainframe: The biggest PC peripheral available.
    Andrew DeFaria, Dec 19, 2006
    #9
  10. Uri Guttman wrote:
    > 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.

    --

    Andrew DeFaria <http://defaria.com>
    Backups? Backups? We don't need no stinking backups!
    Andrew DeFaria, Dec 19, 2006
    #10
  11. Sherm Pendley wrote:
    > Andrew DeFaria <> writes:
    >> 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,

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

    --

    Andrew DeFaria <http://defaria.com>
    Alzheimer's advantage: New friends every day.
    Andrew DeFaria, Dec 19, 2006
    #11
  12. "Andrew DeFaria" <> wrote

    <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=""
    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
    Jürgen Exner, Dec 19, 2006
    #12
  13. king

    Scott Bryce Guest

    Andrew DeFaria wrote:

    > Scott Bryce wrote:


    >> 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?


    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.
    Scott Bryce, Dec 19, 2006
    #13
  14. king

    Uri Guttman Guest

    >>>>> "AD" == Andrew DeFaria <> writes:

    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

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Dec 19, 2006
    #14
  15. king

    Uri Guttman Guest

    >>>>> "AD" == Andrew DeFaria <> writes:

    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

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Dec 19, 2006
    #15
  16. Uri Guttman wrote:
    >
    > 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.

    --

    Andrew DeFaria <http://defaria.com>
    Why do they use sterilized needles for lethal injections?
    Andrew DeFaria, Dec 19, 2006
    #16
  17. Sherm Pendley wrote:
    >> Why are you complaining about it?

    > 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.
    >>> This is not a "web board"

    >> I know that.

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

    --

    Andrew DeFaria <http://defaria.com>
    Sex: In America an obsession. In other parts of the world a fact. -
    Marlene Dietrich
    Andrew DeFaria, Dec 19, 2006
    #17
  18. king

    Uri Guttman Guest

    >>>>> "AD" == Andrew DeFaria <> writes:

    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

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Dec 19, 2006
    #18
  19. king

    Keith Keller Guest

    On 2006-12-19, Andrew DeFaria <> wrote:
    >
    > Uri Guttman wrote:
    >>
    >> AD> Technically CGI is just a protocol - practically you need to
    >> return HTML.


    <aol> This is not true. You repeating it will not make it true. </aol>

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


    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

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information
    Keith Keller, Dec 19, 2006
    #19
  20. >>>>> "ADF" == Andrew DeFaria <> writes:

    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


    --
    Charlton Wilbur
    Charlton Wilbur, Dec 19, 2006
    #20
    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. Jürgen Exner

    Re: CGI Perl "use CGI" statement fail

    Jürgen Exner, Jul 31, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,266
    Jürgen Exner
    Jul 31, 2003
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    540
    Michael Sparks
    Jul 30, 2005
  3. excord80
    Replies:
    17
    Views:
    636
    J Kenneth King
    Jan 29, 2009
  4. kath
    Replies:
    4
    Views:
    574
    J. Gleixner
    Apr 9, 2007
  5. pavi
    Replies:
    0
    Views:
    1,332
Loading...

Share This Page