Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Learning CGI & DBI well

by legLess (Hermit)
on Jun 07, 2001 at 23:46 UTC ( #86699=perlquestion: print w/replies, xml ) Need Help??

legLess has asked for the wisdom of the Perl Monks concerning the following question:

What's the best way for me to learn (a) CGI and (b) database manipulation (MySQL, PostgreSQL) with Perl? I've been using Perl for about 6 months, and I find it incredibly useful. Contrary to those who liken Perl to line noise, I find it very intuitive. But I realize there's much I don't know.

I've been lurking here for a while, and picked up some good information. I've read most of the Camel book (tho' not understood it all ;) and the O'Reilly CD Bookshelf (just in time for a new edition - bah). I've just subscribed to the "beginners-cgi-subscribe@perl.org" list. I read the Risks Digest and SecurityFocus. I haven't posted to comp.lang.perl.misc, but I've read their excellent introductory "spam." I've seen Ovid's "Web Programming Using Perl" Course.

I know of the O'Reilly Rat CGI book, and the Panther DBI book. I've also seen a review here of "Writing CGI Applications with Perl" by Meltzer and Michalski.

I could go on, but perhaps you see my point: I'm drowning in potential information, and I don't have enough experience to filter it into "useful," "bad," and "redundant" categories. I rather enjoy reading TFM, but at this point I've got a (virtual) stack of 5,000 pages in front of me. I don't mind buying a few books, but I don't want to kill trees needlessly.

Many thanks for any direction you monks can give me.

Replies are listed 'Best First'.
Re: Learning CGI & DBI well
by chromatic (Archbishop) on Jun 08, 2001 at 00:06 UTC
    The best way to learn, at least after you've read about it, is to build it.

    You have the resources to help you out if you get into a corner (I consult the Mouse and the Panther fairly regularly), so now you have to find a task where you can apply them.

    There are a hundred Freshmeat records for web applications that track CDs. Why? They're useful, and they're good first projects. Start your own. Or a book database. Or an online survey. Or some mechanism where people can send me flowers, candy, and money.

    From there, you might spawn a hundred interesting ideas of improvements and enhancements and further projects.

      You beat me with the answer, chromatic.

      100% agree. Programming is a skill, and cannot be learned by reading books only - same as you cannot learn to speak any human language by reading books only and never trying to speak.

      Looks to me that best project for LegLess now will be database of perl books, including fields Animal, Read, NotYetUnderstand... ;^)

      I do not have XP points now, but tomorrow LegLess is my candidate...

      pmas

      To make errors is human. But to make million errors per second, you need a computer.

Re: Learning CGI & DBI well
by andreychek (Parson) on Jun 08, 2001 at 00:03 UTC
    I went the route of the books you mentioned, "CGI Programming with Perl"
    and "Programming the Perl DBI". While both are a bit "thin", I have
    found them to be most useful.

    The Perl CGI book goes into all sorts of technologies, from
    how to use CGI.pm and HTML::Template, all the way to using WDDX and
    Javascript in your applications. I found that it is a well rounded book.
    It won't make you an expert in everything, but will get you kick
    started in a bunch of areas.

    I also found the DBI book to be useful, although I haven't had
    the time to dig through it as much as the CGI one.

    Depending on what you are looking to accomplish, there is also
    the book "Official Guide to Programming With Cgi.pm", written by
    Lincoln Stein, also the author of the module. While I can't
    tell you how good the book is, I'm sure it would get into a lot
    of neat nitty gritty if you know what I mean :-)

    These two books were also cheap for me, as I was able to convince the company
    I work for to purchase them. While they are company property,
    I use them both at home and work. YMMV :-)
    -Eric
Re: Learning CGI & DBI well
by Zaxo (Archbishop) on Jun 08, 2001 at 00:28 UTC

    I sounds like you have enough knowlege and reference information to do a good job. All you need now is experience to show you which bits of wisdom are the wisest.

    I'd recommend diving right in and coding now. Close the books, devise a small cgi application, and code it. One or two database tables and four to eight display pages would be a good size. The subject doesn't matter, but you will get more out of it if there are several interesting views of the data.

    It is convenient to choose an application where you can import the database itself, rather than rely on public interest to populate the tables. File systems, logs and the like are handy for this. GIS, math tables, census, and academic projects can also provide for you.

    Use perldoc when you need specific information. Assume that you will be using the application for years to come (it might be true). Share your code here, listen to comments.

    When you're done, reread the excellent books you mentioned. Their clarity and intellegence will astound you and you will get a new round of benefit from them.

    After Compline,
    Zaxo

Re: Learning CGI & DBI well
by Daddio (Chaplain) on Jun 08, 2001 at 05:00 UTC

    I'd say you have a good list of books, and a good bit of advice here with all the other Monks' comments.

    The only thing I have to add to this list are the modules themselves. I don't know how many times I have actually looked at the code in the DBI.pm module (or any other for that matter) to actually figure out what was going on. The perldoc is definitely helpful in most cases, but sometimes it takes a look at the code to "get it right" and really understand it.

    I also agree strongly with the "just do it" philosohpy, and it sounds like you are further along in your understanding of the process that I was when I started (and that was on a project for a client!).

    And as Zaxo was saying, share your project (or bits of it) here, and watch the help you get from the Brother Monks. I'll tell you, it sure has helped me seeing the code and comments!

    D a d d i o

Re: Learning CGI & DBI well
by shotgunefx (Parson) on Jun 08, 2001 at 12:41 UTC
    In my experience, "what" I should learn has been a function of what problems I have had to solve. As far as what the best tact to take, that will depened on what you're trying to do. You can never know too much. When it all comes down to it, it's the same skills applied to different domains.

    This is probably a good time to pick an application and do it just for the sake of doing it. Even if it's been done. Maybe an online address book or an editable, Favorite links database. As far as the CGI aspect is concerned, I would pick something that requires
    • 1. Multiple Screens,
    • 2. Database Access (Sort by date, type,name whatever),
    • 3. Authorization.


    Something like this will require some sort of persitance, some sort of database access and some thought into security. At the least, a cursory glance into some of the bigger issues with CGI. Chances are, whatever you write, you'll see totally wrong in six months because of your experience writing it.

    Good luck!

    -Lee

    "To be civilized is to deny one's nature."
Re: Learning CGI & DBI well
by PaC (Initiate) on Jun 09, 2001 at 15:36 UTC
    Well I don't think I need to tell you about "Programming the Perl DBI" as it's been plastered in all of the other replies.

    I've yet to see a book on PostgreSQL, but there's a MySQL book that has Perl DBI examples and teaches you MySQL at the same time. It also has examples for other languages which I don't feel I need to stress.

    MySQL by Paul DuBois. New Riders is the publisher.
Re: Learning CGI & DBI well
by merlyn (Sage) on Jun 08, 2001 at 17:18 UTC
Thanks, kids
by legLess (Hermit) on Jun 09, 2001 at 04:46 UTC
    That's a good bunch of advice; thanks. I am actually working on a project for a client. My employer, really, and I've got oodles of time. And yes, Randal (heh - my name's Randall, plus I live in Portland :), your site's an incredible resource that I'm using as best I can. Thank you!

    And thanks to everyone else, too. What a nice response for my first post.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://86699]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2022-08-19 17:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?