MacPerl-Digest Thursday, April 8 1999 Volume 01 : Number 036 [MacPerl] Need help on GetFileInfo... [MacPerl] sendmail.pl Re: [MacPerl] sendmail.pl Re: [MacPerl] Need help on GetFileInfo... Re: [MacPerl] Need help on GetFileInfo... Re: [MacPerl] sendmail.pl [MacPerl] Vacation GETAWAY! [MacPerl] What are MacPerl's capabilities Re: [MacPerl] sendmail.pl Re: [MacPerl] What are MacPerl's capabilities Re: [MacPerl] sendmail.pl Re: [MacPerl] sendmail.pl Re: [MacPerl] sendmail.pl Re: [MacPerl] What are MacPerl's capabilities Re: [MacPerl] What are MacPerl's capabilities ---------------------------------------------------------------------- Date: Wed, 07 Apr 1999 09:57:53 -0700 From: Brenda Cannon <bcannon@cmsplatform.com> Subject: [MacPerl] Need help on GetFileInfo... Hi, Yes, I'm a newbie. (Not much I can do about it, so I guess I won't bother apologizing). Anyways, I am having trouble getting the following to work correctly: my ($target_link, @dir_list, $file_type, @movie_list); @dir_list = readdir IMAGEDIRECTORY; foreach $target_link (@dir_list) { $file_type = MacPerl::GetFileInfo($target_link); } if ($file_type eq "MooV") { push @movie_list, $file_type; } When I try to access $file_type in the 6th line of code, I get a "use of uninitialized value" message. I tried printing $file_type and it appears to be NULL ($target_link has the correct value when I print it). I'm using the latest version of MacPerl (downloaded yesterday). What am I missing here? Thanks for your time! ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 16:43:04 +0100 From: james@djassociates.com (James Fox) Subject: [MacPerl] sendmail.pl Can someone send me a copy of sendmail.pl ? I am not using a unix server, I am using a Mac with First Class running macperl. (yes, finally got it working!). cheers James ~ James Fox ~ james@djassociates.com ~ +44 (0) 114 2210525 ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 12:02:38 -0400 From: Chris Nandor <pudge@pobox.com> Subject: Re: [MacPerl] sendmail.pl At 11.43 -0400 1999.04.07, James Fox wrote: >Can someone send me a copy of sendmail.pl ? I am not using a >unix server, I am using a Mac with First Class running macperl. >(yes, finally got it working!). Never heard of sendmail.pl. Try usin MailTools or Net::SMTP by itself. - -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 12:04:45 -0400 From: Chris Nandor <pudge@pobox.com> Subject: Re: [MacPerl] Need help on GetFileInfo... At 12.57 -0400 1999.04.07, Brenda Cannon wrote: > @dir_list = readdir IMAGEDIRECTORY; > > foreach $target_link (@dir_list) { Are you currently in the directory specified by IMAGEDIRECTORY? If not, you need to either append that directory to the variable (e.g., "$dir:$target_link" or "$dir$target_link") or change directories to it (e.g., chdir($dir) or die "Can't chdir to '$dir'"). - -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 12:38:49 -0400 From: "Paul L. Suh" <psuh@apple.com> Subject: Re: [MacPerl] Need help on GetFileInfo... - -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 4/7/99 12:57 PM, Brenda Cannon bcannon@cmsplatform.com tickled the keyboard to say: >Hi, > >Yes, I'm a newbie. (Not much I can do about it, so I guess I won't >bother apologizing). Anyways, I am having trouble getting the following >to work correctly: > >my ($target_link, @dir_list, $file_type, @movie_list); > > @dir_list = readdir IMAGEDIRECTORY; > > >When I try to access $file_type in the 6th line of code, I get a "use >of uninitialized value" message. I tried printing $file_type and it >appears to be NULL ($target_link has the correct value when I print >it). I'm using the latest version of MacPerl (downloaded yesterday). >What am I missing here? This may not be all of it, but it certainly is part of it: your if statement is _outside_ your foreach loop; this leads to a problem that the $file_type variable is reassigned each time through the loop and comes out with just the last value. Second, you're push the file type on your movie list, not the file name which is in $target_link, which is what I think you want to do (otherwise you end up with a list of {"MooV", "MooV", ... }). I think you want something more like this: foreach $target_link (@dir_list) { $file_type = MacPerl::GetFileInfo($target_link); if ($file_type eq "MooV") { push @movie_list, $target_link; } } - - --Paul - -----BEGIN PGP SIGNATURE----- Version: PGP 6.0.2 iQA/AwUBNwuKB29ORSfn1gnaEQILhgCgti8N6SVZkG9Jx/linzykfsyH4uMAnjcr zxMl5HXqtNy2VYUcrfwjxGxv =7U1K - -----END PGP SIGNATURE----- ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 99 11:01:25 -0700 From: Brian McNett <webmaster@mycoinfo.com> Subject: Re: [MacPerl] sendmail.pl >>Can someone send me a copy of sendmail.pl ? I am not using a >>unix server, I am using a Mac with First Class running macperl. >>(yes, finally got it working!). > >Never heard of sendmail.pl. Try usin MailTools or Net::SMTP by itself. What Chris said. Short and very sweet example using Net::SMTP and Mac::InternetConfig (The latter just to get the sender's email address). Can't recall if this is on the MPPE CD-ROM. I don't *think* I wrote this, although a greatly modified version now resides on my hard disk. Mailtools makes some Unixy assumptions which Paul Schinder has taken care of most of in the Mac port. If you use Mailtools be sure to read the "README.Mailtools.mac" file (duh!). #!perl use strict; use Net::SMTP; use Mac::InternetConfig; my($smtp, $email, @emails, $subject, $message); $smtp = Net::SMTP->new(); $email = $InternetConfig{kICEmail()}; # get sender from IC @emails = 'some_user@some.domain'; # recipient goes here $subject = "Subject: MacPerl test message\n\n"; $message = <<EOM; Place test message here EOM $smtp->mail($email) or warn('failure'); $smtp->to(@emails) or warn('failure'); $smtp->data() or warn('failure'); $smtp->datasend($subject) or warn('failure'); $smtp->datasend($message) or warn('failure'); $smtp->datasend() or warn('failure'); $smtp->quit() or warn('failure'); ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 10:43:05 From: bahamanian@korea.com Subject: [MacPerl] Vacation GETAWAY! "Congratulations" PACK YOUR BAGS! You have been selected to ENTER a Florida-Bahama Getaway OFFER!!! Will You be One of the Lucky Ones? ENTER for a LIMITED TIME ONLY http://www.lanpfirm.com ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 07 Apr 1999 09:40:52 -0500 From: Robert Pollard <robpoll1@bellsouth.net> Subject: [MacPerl] What are MacPerl's capabilities Hey guys, I have looked at MacPerl and read the manual to a point. I am impressed so far but I have a couple of questions: 1) How far can MacPerl go in allowing me to use the Mac Toolbox to do things like display a window with the ability to enter into fields any information I want and store it in a database of my own design? 2) If so, does MacPerl hide the Mac Toolbox enough that I don't have to be a C/C++ programmer to use it? 3) What resource is their for understanding the OO portion of MacPerl. I don't want to buy books and programming tools for MacPerl unless it will meet my needs. Currently I work with 4th Dimension and Oracle. I would like to have an alternative to 4D for developing front ends. Thanks in advance!!! Robert Pollard ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 14:22:47 -0400 From: "Paul J. Schinder" <schinder@pobox.com> Subject: Re: [MacPerl] sendmail.pl On Wed, Apr 07, 1999 at 11:01:25AM -0700, Brian McNett wrote: } } Mailtools makes some Unixy assumptions which Paul Schinder has taken care } of most of in the Mac port. If you use Mailtools be sure to read the } "README.Mailtools.mac" file (duh!). Just to be pendantic, there's no longer a Mac port of Mailtools. Mailtools now includes MacPerl support in the standard distribution, and you can just grab and install the latest version from any CPAN site. There are also no longer Mac ports of libnet, libwww-perl-5, and URI, and I will be sending off patches for Font::AFM and File::CounterFile shortly. Let's hope that in the near future the only need for "Mac ports" will be for XS modules. - -- Paul Schinder schinder@pobox.com ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 14:38:54 -0400 From: Chris Nandor <pudge@pobox.com> Subject: Re: [MacPerl] What are MacPerl's capabilities At 10.40 -0400 1999.04.07, Robert Pollard wrote: >1) How far can MacPerl go in allowing me to use the Mac Toolbox to do >things like display a window with the ability to enter into fields any >information I want and store it in a database of my own design? Yes. :) >2) If so, does MacPerl hide the Mac Toolbox enough that I don't have to >be a C/C++ programmer to use it? Yes, though the functions are mapped closely to their C equivalents, so being a C programmer of the Mac helps. The best resources for using the functions themselves is still Inside Macintosh, available for free as PDF and HTML files at <URL:http://www.appler.com/developer/>. For the MacPerl usage, see this list, the MacPerl book, and the macperl-toolbox list. >3) What resource is their for understanding the OO portion of MacPerl. The best resources for OO in MacPerl are not specific to MacPerl. Several books are good, including Perl: The Programmer's Companion, Effective Perl Programming. There is the MacPerl book, which does not discuss OO more than a page or two. There are some good manpages, that come with perl and are here: <URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perlref.html> <URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perldsc.html> <URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perllol.html> <URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perltoot.html> <URL:http://www.perl.com/CPAN-local/doc/manual/html/pod/perlobj.html> You can skip dsc and lol if you like, but if you want to understand references well, you might want to read them. Then there is the article from MJD that is a new manpage as of 5.005_03, for more on references: <URL:http://www.plover.com/~mjd/perl/FAQs/references.html> >I don't want to buy books and programming tools for MacPerl unless it >will meet my needs. There really isn't much of a need to buy tools. Most tools are free and open, as are most docs. Some excellent books cost money, but you can get good books for not much. I recommend, in addition to the books mentioned above, the Perl Cookbook as a compendium for every perl programmer. The others you should get as needed. Good luck, - -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 14:41:08 -0400 From: Chris Nandor <pudge@pobox.com> Subject: Re: [MacPerl] sendmail.pl At 14.22 -0400 1999.04.07, Paul J. Schinder wrote: >There are also no longer Mac ports of libnet, libwww-perl-5, and URI, >and I will be sending off patches for Font::AFM and File::CounterFile >shortly. Let's hope that in the near future the only need for "Mac >ports" will be for XS modules. And in case I haven't said it lately, thanks, Paul! Three cheers! - -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 14:54:18 -0400 From: "Paul J. Schinder" <schinder@pobox.com> Subject: Re: [MacPerl] sendmail.pl On Wed, Apr 07, 1999 at 02:41:08PM -0400, Chris Nandor wrote: } At 14.22 -0400 1999.04.07, Paul J. Schinder wrote: } >There are also no longer Mac ports of libnet, libwww-perl-5, and URI, } >and I will be sending off patches for Font::AFM and File::CounterFile } >shortly. Let's hope that in the near future the only need for "Mac } >ports" will be for XS modules. } } And in case I haven't said it lately, thanks, Paul! Three cheers! Well Chris, as I recall you or Matthias provided the Internet Config patch to Graham for Mailtools, you and Arved are doing all the XS builds, and you did the CPAN port. So thank you, too! } } -- } Chris Nandor mailto:pudge@pobox.com http://pudge.net/ } %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) } - -- Paul Schinder schinder@pobox.com ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 07 Apr 1999 22:42:22 +0200 From: Milivoj Ivkovic <mi@alma.ch> Subject: Re: [MacPerl] sendmail.pl >#!perl > >use strict; >use Net::SMTP; >use Mac::InternetConfig; > >my($smtp, $email, @emails, $subject, $message); > >$smtp = Net::SMTP->new(); >$email = $InternetConfig{kICEmail()}; # get sender from IC >@emails = 'some_user@some.domain'; # recipient goes here >$subject = "Subject: MacPerl test message\n\n"; >$message = <<EOM; > >Place test message here > >EOM > >$smtp->mail($email) or warn('failure'); >$smtp->to(@emails) or warn('failure'); >$smtp->data() or warn('failure'); >$smtp->datasend($subject) or warn('failure'); >$smtp->datasend($message) or warn('failure'); >$smtp->datasend() or warn('failure'); >$smtp->quit() or warn('failure'); Sorry, but I couldn't resist rewriting it using Mail::Sendmail. It's shorter and will also give you clear error messages if needed, do Mime quoted-printable encoding for you, etc... #!perl use strict; use Mail::Sendmail; use Mac::InternetConfig; my %mail = ( From => $InternetConfig{kICEmail()}, # get sender from IC To => 'some_user@some.domain', # recipients go here Subject => "MacPerl test message", ); $mail{Message} = <<EOM; Place test message here EOM sendmail(%mail) or warn $Mail::Sendmail::error; ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 7 Apr 1999 16:33:25 -0500 From: David Steffen <steffen@biomedcomp.com> Subject: Re: [MacPerl] What are MacPerl's capabilities Robert: In reply to: >does MacPerl hide the Mac Toolbox enough that I don't have to >be a C/C++ programmer to use it? >What resource is their for understanding the OO portion of MacPerl. >Currently I work with 4th Dimension and Oracle. I >would like to have an alternative to 4D for developing front ends. >I don't want to buy books and programming tools for MacPerl unless it >will meet my needs. I am not the C or Perl programmer that some of the folks on this list are, but I do have lots of work writing database front ends in general and using 4D in particular. My experience has lead me to the following conclusions: MacToolbox from MacPerl is easier than MacToolbox from C, but that is not to say that it is easy. It is much (Much MUCH!) harder to use the MacPerl MacToolbox to create a database front end than it is to use 4D. IMHO, (Mac)Perl's strength is text processing. MacPerl's toolbox routines, while greatly appreciated, do not yet make it my front end tool of choice. Similarly, Perl is not my favorite object environment; when I want objects, I use Python. YMMV. Mac's weakness in memory and process management impact MacPerl relative to Unix Perl; you can easily run out of memory in MacPerl, and the only solution is to quit MacPerl and manually (and semipermanently) allocate more memory to it. You can only run one MacPerl program at a time. (Similar limitations apply to MacPython; I use MacPerl alot, Unix Python alot, but rarely use MacPython.) My experience with all software tools is that books are about the best investment I can make. The cost of a book for a tool I don't use is dwarfed by the cost of even a small investment of my time. MacPerl, Power and Ease is a wonderful introduction, especially if you haven't worked with Perl a lot (and even if you have; it puts all the Mac-specific stuff together very nicely). - -David- David Steffen, Ph.D. President, Biomedical Computing, Inc. <http://www.biomedcomp.com/> Phone: (713) 610-9770 FAX: (713) 610-9769 E-mail: steffen@biomedcomp.com ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ Date: Wed, 07 Apr 1999 21:35:32 GMT From: bart.lateur@skynet.be (Bart Lateur) Subject: Re: [MacPerl] What are MacPerl's capabilities On Wed, 07 Apr 1999 09:40:52 -0500, Robert Pollard wrote: >I have looked at MacPerl and read the manual to a point. I am impressed >so far but I have a couple of questions: >1) How far can MacPerl go in allowing me to use the Mac Toolbox to do >things like display a window with the ability to enter into fields any >information I want and store it in a database of my own design? Sorry but I have to disagree with Chris on this one. Methinks that MacPerl is a poor choice to build user-interfaces in. That stage is still, huh, "under construction". Now, talk about grabbing data from web forms or report logs, and putting the data into a data base, or the reverse, getting data from a database and generate HTML files on the fly (for example), now *that* is really something that MacPerl (huh, "Perl" in general) really excels in. If you ever need to do data manipulation, there's no time wasted in learning Perl anyway. >2) If so, does MacPerl hide the Mac Toolbox enough that I don't have to >be a C/C++ programmer to use it? It's still not obvious. It's a bit easier than in C/C++, but not much. >3) What resource is their for understanding the OO portion of MacPerl. Ah. Maybe Tom Christiansen's stuff, like PERLTOOT (included with Perl?), or his articles available on www.perl.com (Is there a "Far more than you ever wanted to know... about objects"?). Learning by example, i.e. checking out how standard Perl modules use OO, could help a lot. Also, check out reference.perl.com (there is a link and a search engine on the homepage of www.perl.com) which may contain links to online tutorials. >I don't want to buy books and programming tools for MacPerl unless it >will meet my needs. Currently I work with 4th Dimension and Oracle. I >would like to have an alternative to 4D for developing front ends. Hmm... "front ends" is one thing I don't use Perl for. I'm not saying it can't be done, but it definitely isn't amongst MacPerl's stronger points. Yet. :-) Wel, just one guy's opinion. Bart. ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org ------------------------------ End of MacPerl-Digest V1 #36 **************************** ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to ==== macperl-digest-request@macperl.org