Want to create a website using perl and CGI

C

cartercc

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

Hi, king.

I've developed web projects in Perl/CGI since 2000. I've also used
other technologies, such as ASP, Python, ColdFusion, JSP - but not PHP
(yet!). Perl is a great tool, but it's only a tool. If you want to do
this simply for the sake of learning how, that's great, and I wish you
all the best. If, however, you have a specific reason for the project,
I'd make sure that Perl is the right tool. Perl does have its costs,
and I would suit the tool for the job rather than the other way around.

I have found these two books very helpful:
- Perl/CGI by Diane Zak, Course Technology
- Perl and MySQL by Paul Dubios, New Riders

The Zak book is a very nice, lightweight introduction for the beginner,
but it focuses on CGI at the expense of the more traditional
programming topics. The Dubios book is a deep and voluminous study of
connecting databases to web sites. It's not limited to MySQL, I use
Postgres (which I find superior to MySQL). Be very sure you are
comfortable with references before you begin the Dubios book.

As a practical matter, I have found using the CGI module for building
the interface not very helpful. It's great for passing values between
scripts, but I'd highly recommend sticking with the traditional
technologies (CSS, JavaScript, even Flash) for building the interface.

Finally, I have found that using Perl requires me to build a lot of
custom modules, unlike ColdFusion, say, where most everything is
prebuilt. IMO, this is a Good Thing for a large project, because you
can build it to your specifrications. IMO, this is a Bad Thing for
small projects, because it forces you to do a lot of work that the size
of the project may not justify.

Good luck, and have fun.

CC
 
R

Robert 'phaylon' Sedlacek

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.

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

No, but I can give you a few projects names: Catalyst, Jifty, Gantry,
Maypole, CGI-Application. These are all Web Development/Application
framework. Some are thought to run as CGI, some are too heavy for it.

And because some people seem to be on the "Perl is not suited for
serious web applications" trip, I'd have to disagree. I have _very_ good
experiences and results from using Perl as web development language.

gr.,
Robert
 
M

Mumia W. (on aioe)

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

LOL

Just yesterday, I got two phish sites shut down that were on PHPBB
sites. In one case, I talked with the operators of one forum, and they
admitted that they were neophytes and that they "kept getting hacked."

They asked me for links to PHP security websites--which I gave them.

One of the operators immediately deleted the phish site without
attempting to find out how the intrusion occurred. (I wonder why they
keep getting hacked? :) )

In the case of the other PHPBB site, the operators never responded, so I
notified the ISP, and they shut the site down.

Probably the majority of PHP's problem relate to register_globas="On"
and the scripts that are written to use that. Also PHP is probably the
"Windows" of server-embedded scripting: easy to use, used by millions,
and the biggest and most profitable target for hackers.
 
M

Marc Espie

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.

Why would you want to use CGI ?

Writing CGI scripts is painful, and often a bit slow.

If you're really starting on web coding, have a look at some of the
more advanced frameworks, they're faster and work better.

Depending on your former knowledge, you might want to explore
HTML::Mason, or Maypole, or Catalyst (okay, Catalyst is a little big),
and other `nicer' perl modules to handle HTML stuff, like HTML::Widget.

These days, CGI.pm is only fit for quick and dirty work, but I wouldn't
try to code anything useful with it...
 
C

cartercc

Marc said:
Why would you want to use CGI ?

The term 'CGI' has a lot of ambiguity associated with it. You can read
some of the previous posts in this thread to see what I mean.
Technically, I don't use CGI, but perl-mod. Be that as it may, many
times CGI is used as a shorthand for a method of building web projects.
The idea is that you build scripts that spit out little pieces of
markup, rather than, like PHP, JSP, CF, and others, building markup
that spits out little pieces of scripts. Why would you want to do one
rather than the other? One reason might be separation of your business
logic from your interface, another might be education and training, and
another might be personal preference.
Writing CGI scripts is painful, and often a bit slow.

True. Perl isn't what I'd call a RAD technology, at least compared to
..NET, in which you can built a fully functional database project in
just a few hours. OTOH, you can accompolish things in Perl that you
can't in other technologies, including building a library that does
exactly what you want it to do. Having done that, you can build a web
project of arbitrary size with simply a database and one script of
fifty lines or less. Do that with .NET!
Depending on your former knowledge, you might want to explore
HTML::Mason, or Maypole, or Catalyst (okay, Catalyst is a little big),
and other `nicer' perl modules to handle HTML stuff, like HTML::Widget.

Embedded Perl has its uses, but I do not like embedded technologies. If
you want an embedded technology, use ColdFusion.
These days, CGI.pm is only fit for quick and dirty work, but I wouldn't
try to code anything useful with it...

To each his own. In my current position, I use four technologies, .NET,
CFMX, JSP, and Perl, and (depending on the project) I'd say that Perl
certainly holds its own.

CC
 
C

Charlton Wilbur

You say:

cc> OTOH, you can accompolish things in Perl that you can't in
cc> other technologies, including building a library that does
cc> exactly what you want it to do. Having done that, you can
cc> build a web project of arbitrary size with simply a database
cc> and one script of fifty lines or less.

And then you say:

cc> Embedded Perl has its uses, but I do not like embedded
cc> technologies. If you want an embedded technology, use
cc> ColdFusion.

Er, ColdFusion is possibly the worst possible choice in this regard:
the language itself is badly broken, a string of workarounds for bad
design decisions, with syntax designed to be non-threatening to web
designers who think HTML is a difficult programming language.

There is not a single thing you can do in ColdFusion that is not
better done in PHP. Yes, that's damning with faint praise.

The best solution is to put your logic in Perl modules and use
something like Mason or Text::Template to handle only the logic
absolutely necessary for display. This is what Catalyst does, for
instance.

And if you simply must use ColdFusion, the solution there is to write
the real logic in Java and use ColdFusion merely as a display layer --
but if you are going to do that in the first place, you might as well
use Perl and save yourself a good deal of pain.

Charlton
 
C

cartercc

Charlton said:
Er, ColdFusion is possibly the worst possible choice in this regard:
the language itself is badly broken, a string of workarounds for bad
design decisions, with syntax designed to be non-threatening to web
designers who think HTML is a difficult programming language.

Hey, Bubba, you're talking to a guy who uses CFMX every day, along with
Perl, Java, and other tools, and who has used it for at leat five
years. Even if everything you say is true (I don't care to get into a
pissing contest), CFMX is a wonderful little language for connecting to
a database and throwing up a web page. I do it all the time, and it
probably takes about one tenth the time than doing it in Perl.

And yes, I've developed database applications in Perl more often that I
have with CFMX, so I know by experience the difference between the two.
There is not a single thing you can do in ColdFusion that is not
better done in PHP. Yes, that's damning with faint praise.

Never having used PHP, I can't answer that.

And if you simply must use ColdFusion, the solution there is to write
the real logic in Java and use ColdFusion merely as a display layer --
but if you are going to do that in the first place, you might as well
use Perl and save yourself a good deal of pain.

You missed the point, Bubba. You use CF in cases where you don't need
any real logic. My big beef with CF is that it mixes presentation and
logic. See my first post in this thread.

Sometimes you buy the ingredients at the grocery store and cook it up
from scratch, sometimes you buy the premixed product and just add water
and bake, and sometimes you just say, 'To hell with it,' and buy the
frozen variety that you microwave and eat. Who are you to insist that
we all become cooks when we just want to eat?

CC
 
C

Charlton Wilbur

CC> Hey, Bubba, you're talking to a guy who uses CFMX every day,

First: in my idiolect, referring to someone as "Bubba" is highly
insulting. I'm going to assume that's not what you intended.

CC> along with Perl, Java, and other tools, and who has used it
CC> for at leat five years. Even if everything you say is true (I
CC> don't care to get into a pissing contest), CFMX is a wonderful
CC> little language for connecting to a database and throwing up a
CC> web page. I do it all the time, and it probably takes about
CC> one tenth the time than doing it in Perl.

Yes, I use ColdFusion every day. That's how I know what I'm talking about.

CC> Never having used PHP, I can't answer that.

Obviously.

Charlton
 
C

cartercc

Charlton said:
First: in my idiolect, referring to someone as "Bubba" is highly
insulting. I'm going to assume that's not what you intended.

No, I didn't intend to insult anyone. Substitute 'Bubba' for 'Man' or
'Guy.'
Yes, I use ColdFusion every day. That's how I know what I'm talking about.

So what do you do when the boss says to you, 'I'm giving a talk in 30
minutes and I need for you to create some charts displaying data that
can be available for me in a web browser.' ? Simple - you create a web
page on the server with a CF query and use the appropriate CF charting
tags. You're a hero. Next time, you only get 20 minutes. ;-)
CC> Never having used PHP, I can't answer that.

Obviously.

Hey, Bubba (insult intended), I've a very busy guy. I'm teaching two CS
courses (undergraduate), taking two CS courses (graduate), working 40
hours a week, and trying to maintain a respectable presence in three
organization. I have a list of technologies I'm going to learn someday,
which list includes PHP (also Ruby and Lisp). Okay, I've not learned
PHP yet. Next time, when I cook noodles, I'll slap myself with one,
courtesy of Charlton.

CC
 
C

cartercc

Sherm said:
A CGI is an external program (not necessarily a script) that's launched by
a web server and communicates with the web server by following the CGI
protocol. Anything else is not a CGI.

CGI is an abbreviation for the Common Gateway Interface, which is a
standard developed IIRC by the NCSA. It is very rarely used in this
sense -- mostly when people talk about Perl/CGI they mean a particular
programming style. If you don't believe me, visit your local Borders or
B&N and look at all the 'Teach Yourself CGI in 24 Hours' books. I don't
think there's a recent book that's been published that actually uses
CGI, especially not for Perl or Python. I live in different programming
communities, and whenever people use the term 'CGI' I have discovered
it behooves me to ask then what they mean before continuing the
conversation. This is what I meant by ambiguity in the term -- you
don't always know what the person who uses the term is referring to.
The definition of what's a CGI and what's not is crystal clear. If it's not
clear to *you*, that simply shows that you don't quite grok the concepts as
well as you thought you did.

I have a pretty good idea. I taught CGI in a CIS program on the Jr.
College level and have partly authored several papers on CGI.
Two misconceptions here. First, regardless of whether the server-side tech
is CGI or not, the output is not required to be markup. Any kind of content
can be dynamically produced - images, Flash animations, PDFs, anything.

That's right. Especially text and XML. I wasn't being rigorous in my
post, please excuse me.
And second, the use of CGI is entirely unrelated to the use of embedded logic
inside of markup. The PHP engine, for instance, can be run as a CGI, as an
Apache module, or even as a standalone script interpreter.

Again, that's right. Usually, though, a CGI script implies that the
output is 'markup.'
Fortunately for you, none of the above frameworks requires app logic to be
embedded in markup. Catalyst in particular is very strong on separating
application and presentation logic using the MVC design pattern. I've read
that Maypole is too, but I haven't used that.

And you can use CF to create a web app using the MVC pattern, but who
ever does that except just to prove that it can be done. All these
things are just tools. When you have a nail, you use a hammer, when you
have a bolt, you use a wrench, and when you have a screw, you use a
screwdriver. Just because you can set a screw with a hammer and drive a
nail with a wrench doesn't mean that you should do it in the normal
course.

The OP asked for help with resources. This is a topic that I actually
know something about. If you have constructive comments to help the OP,
make them. Otherwise, just accept that I have a little different
background and experience and therefore approach things a little
differently.

I'm not meaning to be ugly in this post. You were correct in what you
said, and I accept that I was a little loose with terms. But let's
don't forget that this isn't a critical issue, just a little guidance
from someone wanting to do something new.

CC
 
C

cartercc

Tad said:
Name calling does not advance your position, it weakens it.

I didn't engage in name calling. Maybe a little misplaced camraderie,
but not name calling. I thought I had previously addressed this, but
you must have not read that post. There's no difference between 'Hey,
guy' or 'Hey, dude' or Hey, bro' or 'Hey, pal' or 'Hey, Bub [Bubba]'
except some people take it as a friendly greeting and others take it as
an insult. I guess you are one of the latter, but I certainly did not
mean it as an insult, and besides, I don't have a 'position.' I didn't
post to stir up trouble or to create an argument, and certainly not to
take sides in any debate.
Take it outside.

I read a number of newsgroups, and participate actively in a couple. I
read c.l.p.m. almost every day, but seldom contribute because, in my
judgment, this ng is full of emotional cripples. A disporportionate
number of people who post here regularly are ill mannered, ill natured
know-it-alls, and frankly I get very tired of every post I make seeming
to create a fuss. After a while, I'm going to respond to the last post
Sherm Pendly made in this thread, not to CORRECT MISTAKES that he made
(because as far as I am concerned he didn't make any) but to put a
little perspective on the nature of language and society.

I am an old man who has been in business for many years and a
practicing professional in a field other than information technology. I
just don't have the time or energy anymore to play with children. You
can take this as an insult if you want, although I don't mean it as an
insult to your or anyone else in particular. I mean it solely as a
comment on the culture of c.l.p.m.

Charles Carter
 
C

cartercc

Hi, Sherm,

Just a few more or less random thoughts:

1. CGI as a web methodology is at best obscelecent, if not obselete.
The CGI idea is that a request from another process (such as a web
server) spawns a new process, which does its thing and responds to the
first process, and then dies. 15 years ago, this was a cool idea, but
we all know the history and the replacement for CGI. CGI as it was
originally designed is dead, I doubt more than a few REAL CGI scripts
have been written in the last five years, and it would surprise me if
more than a small handful were written in the next five.

2. My comments about the bookstore were meant to illustrate the current
usage of the term CGI. English is a descriptive language, not a
prescriptive one, and you normally get your meaning from the ordinary
and usual meaning rather than the rare and unusual meaning. Three
examples:

- (a) A 'Christmas carol' is a hymn with a specifically Christian
message, such as 'O Come, All Ye Faithful' or 'Hark The Herald Angels
Sing.' Yet in modern usage it means any Christmas song, so if you
suggest that 'Jongle Bells' and 'Rudolph the Red Nosed Reindeer' are
not Christmas carols, people will look at you strangely.
- (b) Schools graduate, not people, so it's not correct to say, 'I
graduated from State University in 2006,' but rather 'State University
graduated me in 2006.' You never hear the latter form anymore but only
the former, and most people would >correct< you if you said, 'State
University graduated ...'
- (c) When I was going through school (almost 50 years ago) I was
taught that the term 'computer' referred to a person, not a thing. A
'computer' was a person who computed for a living, and yes, it was a
real jub title, check any older edition of the Occupational Handbook. I
remeber getting a bad mark because I used 'computer' to refer to a
machine rather than a person, this was around 1959.

When people say CGI now, they mostly mean a program that spits out some
kind of markup (such as 'print "<h1>This is My Header</h1>\n";'). The
evidence? As close at hand as your favorite book store. Experts may
quibble, experts may quake, but that's how people talk, and if you
don't know this, you might want to consider getting out more.

BYW, I agree with your assessment that the 'Teach Yourself' books are
horrible, but I wasn't citing them as authority, only as evidence.

4. Pardon me, but I have never hear the expression 'a CGI.'
Anyway, what you're saying above doesn't contradict what I said. The term
"a CGI" refers to a program that implements the CGI protocol. It's incorrect
to use it when referring to anything else.

I am associated with four colleges and universities, including two very
large state universities, as a teacher, student, and staff member. I
teach programming and web design. I talk to hundreds of people a year
from all walks of life about web stuff. I have never heard any of these
people use the expression 'a CGI.' Maybe in your milieu you use that
expression, but just because I don't doesn't mean that I don't know
what I'm talking about. (I don't say this to boast but merely to give
you some idea of my background, I have a doctorate and two masters
degrees, and a number of technical certifications including one in web
design. I've also been a partner in two private web companies, one
which went belly up in the dot com bust, the other of which is still
active and hosts about 60 production sites. This doesn't mean anything
more than that I have a background in this topic, and I don't claim to
be a Perl expert or programmer.)

Sherm, I've just wasted about 20 minutes, and I'm through. You can have
the last word, I won't reply. As I said elsewhere, I just intended to
give the OP the benefit of a little I had learned, not to get into a
pissing contest. I don't derive my self image by making others conform
to my world view (as many on c.l.p.m. appear to do), so I'll just leave
off participating any more in this thread.

Charles Carter
 
U

Uri Guttman

c> 1. CGI as a web methodology is at best obscelecent, if not obselete.
c> The CGI idea is that a request from another process (such as a web
c> server) spawns a new process, which does its thing and responds to the
c> first process, and then dies. 15 years ago, this was a cool idea, but
c> we all know the history and the replacement for CGI. CGI as it was
c> originally designed is dead, I doubt more than a few REAL CGI scripts
c> have been written in the last five years, and it would surprise me if
c> more than a small handful were written in the next five.

wow are you off base. cgi may not be the primary web technology but it
is still a major way to get dynamic pages. it isn't the best for high
volume sites but most (by far) sites aren't high volume. i am developing
a small storefront that will use cgi. i have found an accounting system
(open source perl) that is all cgi. for a small business it is easy to
install and manage without the hassles of mod_perl. cgi's main benefit
is that you don't have to do any fancy web config, the api to the
process is simple, well defined and supported by modules. these are fine
attributes that won't go away because you think they will.

c> When people say CGI now, they mostly mean a program that spits out some
c> kind of markup (such as 'print "<h1>This is My Header</h1>\n";'). The
c> evidence? As close at hand as your favorite book store. Experts may
c> quibble, experts may quake, but that's how people talk, and if you
c> don't know this, you might want to consider getting out more.

i think you have you head buried in too many books. take your own advice.

c> Sherm, I've just wasted about 20 minutes, and I'm through. You can have
c> the last word, I won't reply. As I said elsewhere, I just intended to
c> give the OP the benefit of a little I had learned, not to get into a
c> pissing contest. I don't derive my self image by making others conform
c> to my world view (as many on c.l.p.m. appear to do), so I'll just leave
c> off participating any more in this thread.

multiply that time wastage by all the people who will read this too.

uri
 
C

Charlton Wilbur

SP> To a layman, this strong emphasis on precision may seem too
SP> "uptight" or "anal retentive",

I believe the term chosen by the highly- and redundantly-credentialled
original poster, affiliated as he is with no fewer than four
universities, was "emotionally crippled."

SP> If you seriously want anyone to benefit from what you're
SP> saying, give them clear, detailed, and accurate information,
SP> not the same vague mumbling and hand-waving they'd find in any
SP> "Learn X in Y hours" book.

Imprecision in thought is reflected by imprecision in language.

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top