macperl-forum-digest Tuesday, April 6 1999 Volume 01 : Number 005 [MacPerl-Forum] QUE "Using Perl 5" Re: [MacPerl-Forum] QUE "Using Perl 5" ---------------------------------------------------------------------- Date: Sun, 4 Apr 1999 17:20:34 -0700 From: Robert Link <rlink@binmedia.com> Subject: [MacPerl-Forum] QUE "Using Perl 5" Friends, How many of you are working in macperl strictly with an eye to implementation on macs? Me, I'm on mac at home, trying to learn/write perl-cgi to be placed on an isp using linux. I recently acquired QUE's "Special Edition Using Perl 5 for Web Programming." I'm pleased, so far, but concerned about portability. Actually, I guess that's backwards; I'm sure what I learn in the book will work on my isp. Getting the examples to work in macperl will be the challenge. Working around the system function, piping, and other things, that's the challenge. Yes, I have MPP&E; in fact I ordered it weeks before it came out and pestered my local bookseller incessantly for a while--then finally gave up and bought it at Borders. It's a great book. I'm finding the QUE book quite a help for more web-focused learning. So, if anyone else is in this boat, I'd love to hear from you. I don't know that it's technically a "porters" issue, a "web-cgi" issue, or a "I'm too wet behind the ears to be bothering y'all" issue, so I've posted here. No, it's not a specific question, more a plea for commiseration, and maybe a chance to hook up with a "study partner" if anyone else has the same book and the same problems. One direct question I can ask: If I use mpw MacPerl, will I get a closer approximation of what I'll use on my isp? Also, I've gathered it's good programming form to program on a dedicated machine, lest a truly major snafu wreak major havok; is this fairly standard practice? I've got an iMac (hey, my folks were paying...), and I've got my old powerbook 190cs. Do I need to limit my programming explorations to the powerbook? Thanks bunches to any with the time to help out!! Robert Link rlink@binmedia.com Learn to Speed Read, Free, at: http://www.binmedia.com/users/rlink/index.html ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-forum-request@macperl.org ------------------------------ Date: Sun, 4 Apr 1999 18:49:49 -0700 From: Bruce Van Allen <bva@cruzio.com> Subject: Re: [MacPerl-Forum] QUE "Using Perl 5" Robert Link wrote: >How many of you are working in macperl strictly with an eye to >implementation on macs? Me, I'm on mac at home, trying to learn/write >perl-cgi to be placed on an isp using linux. > >I recently acquired QUE's "Special Edition Using Perl 5 for Web >Programming." I thinks that's the book featured here last week for having typos in its Perl code, to wit: if you find code with [td], that expression, including the square brackets, should be replaced in your code with (on its own line to show it clearly here): ~ That's a tilde character. Very necessary for binding pattern matches, as part of the operators =~ and !~ >I'm pleased, so far, but concerned about portability. >Actually, I guess that's backwards; I'm sure what I learn in the book will >work on my isp. Getting the examples to work in macperl will be the >challenge. Working around the system function, piping, and other things, >that's the challenge. Well, on the one hand, you need to avoid Mac-specific Perl, which you probably won't see in the Que book anyway. On the other hand, most CGIs can cope just fine without system and pipes. An example of where you'll wish your Mac could emulate UNIX/LINUX is a CGI that makes use of sendmail, the predominant email originator. Some folks in the MacPerl community have been exchanging info on email handling from Macs, but so far that's not water I'd toss a newbie into... >Yes, I have MPP&E; in fact I ordered it weeks before it came out and >pestered my local bookseller incessantly for a while--then finally gave up >and bought it at Borders. It's a great book. I'm finding the QUE book >quite a help for more web-focused learning. The main thing is to give yourself projects that make use of Perl to do various things, so you learn both what's possible and how to do it. It's 99% the same everywhere. >So, if anyone else is in this boat, I'd love to hear from you. I don't >know that it's technically a "porters" issue, a "web-cgi" issue, or a "I'm >too wet behind the ears to be bothering y'all" issue, so I've posted here. Not a porting issue. >One direct question I can ask: If I use mpw MacPerl, will I get a closer >approximation of what I'll use on my isp? I've been writing Perl scripts for a few years -- the more I learn Perl, the higher the proportion of non-WWW projects I use it for; probably 60/40 non-WWW now -- and I have yet to use MPW, despite the great introduction to it in MPPE. >Also, I've gathered it's good >programming form to program on a dedicated machine, lest a truly major >snafu wreak major havok; is this fairly standard practice? I've got an >iMac (hey, my folks were paying...), and I've got my old powerbook 190cs. >Do I need to limit my programming explorations to the powerbook? Actually, I don't know anyone who programs Perl on a dedicated machine, although I'm sure for some applications of any language that's good advice. Most of us cope with just one little box... I wouldn't have a 'mission-critical' operation going on in my machine at the same time I'm experimenting with new code. Some folks set up their Macs (w/ OS 8.5.1 especially) to run CGIs with web sharing, so their machine is both client and server. If you don't want to do that, then just rent some space on the LINUX server, dedicate a directory for testing, and upload your scripts as you develop them. Your errors get logged (some folks even catch/analyze them) but no one's really watching you as you test. :-) Best Advice #1: start all of your scripts with -w in the shebang line: #! usr/bin/perl -w or some such (check with your server admin for path) and include the line use strict; at the start. You'll be driven crazy by Perl-pickiness, an old-school teacher who raps your knuckles for EVERY mistake, but who also gives very good pointers (that is, the Perl error messages usually tell you exactly what the problem is, unlike Mac's "error -8925" messages). Once your CGI works properly, you might not want to leave the '-w' and' use strict', as your web visitors might not feel helped by the error messages. Opinions vary on this point. Best Advice #2: Use some ready-made Perl in the form of either cgi-lib.pl by Steve Brenner, or CGI.pm by Lincoln Stein. Both have been worked over to provide excellent CGI handling (secure code, good error handling, many features). Info in books and web sites available for both. Most UNIX/LINUX installations of Perl include CGI.pm (all, in fact, since v. 5.003, I think) unless the server admin has attitude or prohibits scripting. I started out writing CGIs from scratch, and still occasionally do, but generally cgi-lib.pl or CGI.pm do the grunt work and let me focus on coding my script's functionality. Opinions vary on this point, too. Best Advice #3..5: Lurk the MacPerl lists; ask specific questions; mistakes are you friends. Good luck! - - Bruce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Bruce Van Allen bva@cruzio.com 831/429-1688 P.O. Box 839 Santa Cruz, CA 95061 ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-forum-request@macperl.org ------------------------------ End of macperl-forum-digest V1 #5 ********************************* ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to ==== macperl-forum-digest-request@macperl.org