I'm looking for a Perl Book... I think.

G

Guy

Ok, I'm creating my own website on genealogy.

I'd like visitors to be able to search through my site, search for names
etc...

I'm alright with HTML and I've got enough experience with Javascript.

But I need to do some Server-Side programming.

The only experience I have here is with Perl, but many years ago.

I'm not sure if there are better ways but I like Perl, and, well, I'm not
familiar with anything else.

The only book I have on Perl is: "Perl5 for Web programming" circa 1998.

This book showed me basic Perl stuff such as:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "html stuff \n";
$temp = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$temp);
open (myfile, "names.txt");
foreach $items(@pairs) {

But I see stuff like this, which appears to be related to cgi.pm, and which
I never really learned.
use CGI qw/:standard/;
$q = new CGI;
@names = $q->param;
$value = $q->param('t01');
print $q->header,
$q->start_html('hello world'),
$q->end_html;

Do I need a new book on Perl, or do I need a book on CGI.pm (if such a thing
exists). I'd like to understand this $q=new CGI stuff.

Can anyone suggest a book or type of book? Thanks for all,
Guy
 
N

Nathan Keel

Guy said:
Ok, I'm creating my own website on genealogy.

I'd like visitors to be able to search through my site, search for
names etc...

I'm alright with HTML and I've got enough experience with Javascript.

But I need to do some Server-Side programming.

The only experience I have here is with Perl, but many years ago.

I'm not sure if there are better ways but I like Perl, and, well, I'm
not familiar with anything else.

The only book I have on Perl is: "Perl5 for Web programming" circa
1998.

This book showed me basic Perl stuff such as:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "html stuff \n";
$temp = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$temp);
open (myfile, "names.txt");
foreach $items(@pairs) {

But I see stuff like this, which appears to be related to cgi.pm, and
which I never really learned.
use CGI qw/:standard/;
$q = new CGI;
@names = $q->param;
$value = $q->param('t01');
print $q->header,
$q->start_html('hello world'),
$q->end_html;

Do I need a new book on Perl, or do I need a book on CGI.pm (if such a
thing
exists). I'd like to understand this $q=new CGI stuff.

Can anyone suggest a book or type of book? Thanks for all,
Guy

Look at Learning Perl, it's the standard book. You can read the docs
for the CGI module and know the rest. Lincoln Stein wrote a book about
CGI.pm, I think? Anyway, your book seems old. Depending on the
quality of the original book (I don't know anything about it), you
might want to get a better one (not just a newer one). For a Perl 5
book to give the example you did above, I'd say it's not such a good
book regardless of the year.
 
T

Tad J McClellan

Guy said:
The only book I have on Perl is: "Perl5 for Web programming" circa 1998.
But I see stuff like this, which appears to be related to cgi.pm, and which
I never really learned.
use CGI qw/:standard/;
$q = new CGI;


Where did you find this code?

One line is for using the CGI module in a function-oriented manner
while another line is for using the CGI module in an object-oriented
manner.

Sensible programs use only one or the other, not both at the same time.

I suggest not using wherever it was that you picked up that code.

Do I need a new book on Perl,


You needed a different Perl book even in 1998.

You would probably benefit from a Perl book written in the modern era.

or do I need a book on CGI.pm (if such a thing
exists).


Have you tried reading the documentation for CGI.pm that comes with CGI.pm?

I'd like to understand this $q=new CGI stuff.


It is called "Object Oriented Programming".

You can learn a good deal about OO from Perl's std docs:

perldoc perlboot
perldoc perltoot
perldoc perlobj

Can anyone suggest a book or type of book?


Perl's std docs have such suggestions as well:

perldoc perlbook
perldoc -q book
 
M

Michael Austin

Guy said:
Ok, I'm creating my own website on genealogy.

I'd like visitors to be able to search through my site, search for names
etc...

I'm alright with HTML and I've got enough experience with Javascript.

But I need to do some Server-Side programming.

The only experience I have here is with Perl, but many years ago.

I'm not sure if there are better ways but I like Perl, and, well, I'm not
familiar with anything else.

The only book I have on Perl is: "Perl5 for Web programming" circa 1998.

This book showed me basic Perl stuff such as:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "html stuff \n";
$temp = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$temp);
open (myfile, "names.txt");
foreach $items(@pairs) {

But I see stuff like this, which appears to be related to cgi.pm, and which
I never really learned.
use CGI qw/:standard/;
$q = new CGI;
@names = $q->param;
$value = $q->param('t01');
print $q->header,
$q->start_html('hello world'),
$q->end_html;

Do I need a new book on Perl, or do I need a book on CGI.pm (if such a thing
exists). I'd like to understand this $q=new CGI stuff.

Can anyone suggest a book or type of book? Thanks for all,
Guy

While perl is a very good CGI language, you might also consider PHP as
it has easier and almost as powerful a command set that integrates a lot
easier with HTML.

As for the book - the best you can do is:

google perl <whatever it is you are trying to do> example

You may see a lot of noise, but you will find that which you seek.
 
M

Michael Austin

Guy said:
Ok, I'm creating my own website on genealogy.

I'd like visitors to be able to search through my site, search for names
etc...

I'm alright with HTML and I've got enough experience with Javascript.

But I need to do some Server-Side programming.

The only experience I have here is with Perl, but many years ago.

I'm not sure if there are better ways but I like Perl, and, well, I'm not
familiar with anything else.

The only book I have on Perl is: "Perl5 for Web programming" circa 1998.

This book showed me basic Perl stuff such as:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "html stuff \n";
$temp = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$temp);
open (myfile, "names.txt");
foreach $items(@pairs) {

But I see stuff like this, which appears to be related to cgi.pm, and which
I never really learned.
use CGI qw/:standard/;
$q = new CGI;
@names = $q->param;
$value = $q->param('t01');
print $q->header,
$q->start_html('hello world'),
$q->end_html;

Do I need a new book on Perl, or do I need a book on CGI.pm (if such a thing
exists). I'd like to understand this $q=new CGI stuff.

Can anyone suggest a book or type of book? Thanks for all,
Guy

forgot to include an example pages...

http://us3.php.net/manual/en/reserved.variables.globals.php
 
N

Nathan Keel

Michael said:
While perl is a very good CGI language, you might also consider PHP as
it has easier and almost as powerful a command set that integrates a
lot easier with HTML.

Curious. What is easier about using PHP over Perl for web sites and
HTML? I've used both for about 12 years and I don't think either are
anymore difficult than the other. Granted, CGI needs execute
permissions and the header output, but that's really the only
difference beside a trivial amount of options to have Perl output HTML.
Not that I oppose your recommendation, I just find it curious that
people seem to think PHP is better or easier, when the differences are
pretty easily worked with in either.
 
G

Guy

Tad J McClellan said:
Where did you find this code?

One line is for using the CGI module in a function-oriented manner
while another line is for using the CGI module in an object-oriented
manner.

Sensible programs use only one or the other, not both at the same time.

I suggest not using wherever it was that you picked up that code.




You needed a different Perl book even in 1998.

You would probably benefit from a Perl book written in the modern era.


I just got back from our largest bookstore. There was only one book on Perl:
"Learning Perl" by O'Reilly.

It said something like "you can use CGI.pm but it's not covered in this
book".

That's what my current book says, so I didn't buy it.

Their computer lists a book on CGI.pm (I think by Lincoln Stein) but it was
published in 1998. In any case, they didn't have it on the shelf. I never
bought a 10 year old computer book before, but I'd still like to familiarize
myself with the CGI.pm library.

But then again, I think it's the Object Oriented stuff that I'd really like
to learn too. like this $q = new CGI; which I think creates instances of CGI
or something, or is this just part of CGI.pm??

Maybe I'll have to try and learn this online, but I'd much prefer there were
a good book I could read, I seem to learn more from reading books.

Thanks again for all your input.
Guy
 
C

ccc31807

Ok, I'm creating my own website on genealogy.

Guy, THE BOOK you need is Paul Dubois, MySQL and Perl for the web.

It's rather old, but not really out of date, and does more than any
book I know of to walk you through what you need to do.

Two cautions: (1) It assumes familiarity with system administration,
server administration, Perl, and SQL. If you are a beginner at any of
these, you need to remediate yourself before reading the book. (2) It
uses both CGI to output HTML and references extensively, so you need
to bone up on CGI and references. I personally don't use CGI to
generate HTML so that doesn't bother me, but I had to really get
familiar with Perl references before the book began to make sense.

CC
 
C

ccc31807

I just got back from our largest bookstore. There was only one book on Perl:
"Learning Perl" by O'Reilly.

Look on amazon.com and half.com. I haven't bought a book in a
bookstore for years, and am quite happy with used books. (Buying used
books isn't like buying used food. ;-)).
That's what my current book says, so I didn't buy it.

You don't need to use much CGI, and I have a strong distaste for using
CGI to generate my HTML. Of course, this is simply a matter of
personal preference.
Their computer lists a book on CGI.pm (I think by Lincoln Stein) but it was
published in 1998.  In any case, they didn't have it on the shelf.  Inever
bought a 10 year old computer book before, but I'd still like to familiarize
myself with the CGI.pm library.

Depends. I'm currently (re)reading a 20 year old book and getting a
lot out of it. Most of my Perl books are old books. Once you get the
basics and learn the documentation, you shouldn't need the book, just
read the documentation. Perl has particularly good documentation -
it's clear, up-to-date, and widely available. (My 20 y.o. book is a vi
manual.)
But then again, I think it's the Object Oriented stuff that I'd really like
to learn too. like this $q = new CGI; which I think creates instances of CGI
or something, or is this just part of CGI.pm??

You're much better off spending your time elsewhere if you're mainly
interested in web stuff. For example, I think that Higher Order Perl
(Dominus) is more useful than Object Oriented Perl (Conway) for just
increasing your effectiveness as a developer. I'm not critical of OOP,
it's an excellent book and well worth your study, but for me HOP was
more immediately useful. Besides, you don't really need object
oriented programming if all you're doing is building a web app.
a good book I could read, I seem to learn more from reading books.

I'm a dead tree guy myself, so I know exactly what you mean. Another
good book for your interests is Diane Zak, CGI/Perl, Course
Technology.

CC
 
G

Guy

But I see stuff like this, which appears to be related to cgi.pm, and
This was not a rhetorical question.

I really would like to know where you got that code from.

Sorry, it was just a few lines of code that I had pasted together there
myself, I didn't find it whole like that.

Have you tried reading the documentation for CGI.pm that comes with
CGI.pm?

That was not a rhetorical question either.

I bought some web space and asked that I could use Perl. I was just given a
username and a password and a domain name. I didn't install the webserver.

"Learning Perl" is the 1st in a series of 3 Perl tutorial books. It
does not cover OO programming.

"Intermediate Perl" is the 2nd, and it does cover OO.

"Mastering Perl" is the 3rd in the series.

I appreciate all your help, thanks to all,
Guy
 
G

Guy

"Learning Perl" is the 1st in a series of 3 Perl tutorial books. It
does not cover OO programming.

"Intermediate Perl" is the 2nd, and it does cover OO.

"Mastering Perl" is the 3rd in the series.

OK, I went on O'Reilly and ordered the three following books, buy 2 get 3.
- Intermediate Perl, 1Ed
- Mastering Perl, 1Ed
- CGI Programming with Perl, 2Ed

I hope to get them soon and hope they won't be bad choices.
Cheers,
Guy
 
N

Nathan Keel

Guy said:
OK, I went on O'Reilly and ordered the three following books, buy 2
get 3. - Intermediate Perl, 1Ed
- Mastering Perl, 1Ed
- CGI Programming with Perl, 2Ed

I hope to get them soon and hope they won't be bad choices.
Cheers,
Guy

You might want to add Learning Perl to that list. Unless you know a
reasonable amount of Perl now, you're probably going to have some
trouble jumping into Intermediate Perl. There's not a whole lot to
using Perl for CGI (including the CGI module, which you don't have to
use if you don't want to), so it's best to ensure you know Perl, and
things like the CGI module and writing for CGI scripts will be
incredibly easy, and you'll understand more of the why about why you do
certain things.
 
J

Jürgen Exner

Guy said:
I bought some web space and asked that I could use Perl. I was just given a
username and a password and a domain name. I didn't install the webserver.

And this comment relates to Tad's question how?

jue
 
N

Nathan Keel

Jürgen Exner said:
And this comment relates to Tad's question how?

jue

In that the OP clearly is new to this, so people should understand that
when responding, else they'll just get confused by all of the arrogant
and sarcastic remarks about the OP's response. Give them a break,
they're new to it. They don't seem to be making an effort to be off
topic or "bother anyone" by wasting their time.
 
J

Jürgen Exner

Nathan Keel said:
In that the OP clearly is new to this, so people should understand that
when responding, else they'll just get confused by all of the arrogant
and sarcastic remarks about the OP's response. Give them a break,
they're new to it. They don't seem to be making an effort to be off
topic or "bother anyone" by wasting their time.

Well, ok, fine. In that case to the OP:

You don't need a web space (nor username, password, or domain name for
such) to access the documentation of CGI.pm or any Perl module for that
matter.
Just install it locally and then a simple 'perldoc CGI' will bring up
the documentation. You want to make sure that you are using the same
version of CGI.pm locally as on your web server, otherwise the
documentation might not match what's on the server and also your code
may behave differently on the server than when you tested it on your
local installation.

If you just want a sneak preview of the documentation of a module
without installing it, then go to CPAN and search for that module. All
the documentation is there, too.

jue
 
G

Guy

You don't need a web space (nor username, password, or domain name for
such) to access the documentation of CGI.pm or any Perl module for that
matter.
Just install it locally and then a simple 'perldoc CGI' will bring up
the documentation. You want to make sure that you are using the same
version of CGI.pm locally as on your web server, otherwise the
documentation might not match what's on the server and also your code
may behave differently on the server than when you tested it on your
local installation.


I'm obviously in the dark ages here. I hope I don't upset anyone when I say
that I don't have a local server here at home. I was just planning to write
a relatively short script and testing it online, and then link to it when
it's working. I do appreciate all the info coming in.
Thanks again to all.
Guy
 
J

Jürgen Exner

Guy said:
I'm obviously in the dark ages here. I hope I don't upset anyone when I say
that I don't have a local server here at home.

You do have a computer thou, don't you? Unless you have an _extremely_
exotic OS you can install Perl and all its documentation including
CGI.pm on that computer.
I was just planning to write
a relatively short script and testing it online, and then link to it when
it's working.

Well, that's a very cumbersome workflow, in particular because the site
will be unusable while you are developing and testing the scripts.
Typically that is a big no-go for any commercial application.
Standard procedure is to develop and test in a private test environment
before publishing to the official web server.

And there are any number of web servers that can be installed locally
and allow you to develop and test locally before deploying.

jue
 
G

Guy

You don't need a 'server'. You just need a computer: the one you're
posting from will probably do fine. If it's running Win32, you can get
perl from strawberryperl.com; if it's a Mac, you've almost certainly got
perl installed already. If it's running something else, let us know and
we'll see if anyone knows how to get perl installed on it.

I'm running windows XP. I remember years ago I had installed winNT on a 2nd
computer and used its web server (apache I think) to test my scripts at
home. I don't have that option now and had never heard of StrawberryPerl. So
I tried Strawberry Perl as you suggested - I guess there's all sorts of Perl
flavors (no pun intended)!

I also did the following according to info I found, not sure what it did or
if I had to:
perl -MCPAN -e shell
install Bundle::CPAN
Then I checked my path and the version.
path
perl -v
Then I executed a "Hello World" script and it worked.
I'll be darned!
Guy
 
B

Ben Bullock

But I see stuff like this, which appears to be related to cgi.pm, and which
I never really learned.
use CGI qw/:standard/;
$q = new CGI;
@names = $q->param;
$value = $q->param('t01');
print $q->header,
$q->start_html('hello world'),
$q->end_html;

Do I need a new book on Perl, or do I need a book on CGI.pm (if such a thing
exists). I'd like to understand this $q=new CGI stuff.

What you are trying to understand is so-called "object oriented perl".

The "new" creates a CGI object.

The "$q->param" etc. call the methods of the CGI object. Methods are
functions with a first argument $q, and the syntax "$q->param" is the
same as "param($q)".

You don't need a book to understand this.
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top