From adms1 at cts.com Wed Feb 2 12:47:27 2000 From: adms1 at cts.com (adms1) Date: Thu Aug 5 00:19:55 2004 Subject: IMPORTANT: Feb Perl Mongers Meeting Message-ID: <200002021047270380.25FF2031@smtp.cts.com> ~sdpm~ Howdy fellow Perl Monger! As you know, our monthly meetings were being held in Mira Mesa. During the last few months, the Mira Mesa location has shrunk in size by one half and is no longer suitable for our meetings. Fortunately, Alex and his gang at Binary Evolution have offered to let us use a great conference room in Miramar. Last month's meeting was held at the BE location and it worked out great (pizza was even on-site!). By my counts, there are currently 36 people signed up for the SDPM mailing list. Normally, we are looking at between 8-10 people (not always the same people) showing up to the meetings every month. Now that we have a permanent location, and a few more people getting involved with the group, it is time for the San Diego Perl Mongers to get organized. Here is the plan: 1. A few of us will be tracking down as many Perl programmers as we can and invite them to February's meeting. This includes calling companies in San Diego where potential Perl Mongers may work. 2. February's meeting is push to the third Wednesday of February. OUR NEXT MEETING WILL BE ON FEBRUARY 16, 2000 AT 7:00PM. 8380 Miramar Rd., Suite 105 San Diego, CA 92121 Take 805 to Miramar rd. East. Second traffic light: Miramar Mall, left. Go two blocks until you see sharp right turn, turn left into parking lot. You'll see large sign on left side: 8380 Miramar Mall. Suite 105 3. At the meeting we will formalize the structure of our group. This means electing officers and deciding how future meetings will take place. This meeting will basically be the "founding" meeting for the New San Diego Perl Mongers. Topics of discussion at the big meeting will include: 1. Start using the SDPM mailing list! 2. Future seminar topics. 3. Product demonstrations. 4. Profiling companies and cool projects in San Diego that use Perl. 5. Book reviews. 6. Beginner to advanced tutorials. 7. The Perl community. 8. Building a SDPM script repository. 9. Anything else that comes to mind. There are hundreds if not thousands of Perl programmers in San Diego. I am hoping that we make our chapter of the Perl Mongers something special. With a cooperative effort we can create a network of Perl users that will support the individual programmer's needs. I sincerely hope you will attend February's meeting. I believe we will have a great showing, and as such, I need you to RSVP. Simply send an email to adms1@cts.com to let me know you will attend. Also, if you work with other Perl programmers, please encourage them to attend! -Garrett Casey Email adms1@cts.com to RSVP. http://SanDiego.pm.org ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From khumpherys at hotmail.com Fri Feb 4 11:54:39 2000 From: khumpherys at hotmail.com (Ken Humpherys) Date: Thu Aug 5 00:19:56 2004 Subject: Employment Message-ID: <20000204175439.37864.qmail@hotmail.com> ~sdpm~ Hey Guys, I got a job!! It is with a company called Star up in Vista. I am working on automating their billing system, and I have looked at some scripts on CPAN, but I have not found one I like. Does anybody know of a good module to use for monthly and quarterly billing? Thanks in advance, Ken Humpherys ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Fri Feb 4 22:02:00 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:56 2004 Subject: Two Questions Please Message-ID: <3.0.4.32.20000204200200.007af290@cts.com> ~sdpm~ If I have a statement like: $Adr[1] = 3. And later another statement in a different function like: print @Adr; It prints it correctly but I get a message: "Use of uninitialized value......" So, at the start of the program I have tried: use vars qw(@Adr); local @Adr; my @Adr; The message stays. What does it want? ============================= Second question: I am running my programs on a laptop with Windoz using Apache server on IE-5. The program starts with an HTM file. When the submit button is pressed (and all is ok) it runs my CGI program. When all is not ok, I get a file download box. "You have chosen to download a file from this location...." What kind of problem should I go looking for inside the CGI program? -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 5 22:31:22 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: Two Questions Please In-Reply-To: <3.0.4.32.20000204200200.007af290@cts.com> Message-ID: ~sdpm~ On Fri, 4 Feb 2000, Joel Fentin wrote: > The message stays. What does it want? It wants a $Adr[0], maybe? CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From sander at mp3.com Fri Feb 4 22:41:33 2000 From: sander at mp3.com (Sander van Zoest) Date: Thu Aug 5 00:19:56 2004 Subject: Two Questions Please In-Reply-To: <3.0.4.32.20000204200200.007af290@cts.com> Message-ID: ~sdpm~ On Fri, 4 Feb 2000, Joel Fentin wrote: > If I have a statement like: > $Adr[1] = 3. > And later another statement in a different function like: > print @Adr; > It prints it correctly but I get a message: > "Use of uninitialized value......" > > So, at the start of the program I have tried: > use vars qw(@Adr); > local @Adr; > my @Adr; > The message stays. What does it want? This means that the variable your are looking for isn't in scope. I'd need to see more of the code to see what the problem is. > ============================= > Second question: > I am running my programs on a laptop with Windoz using Apache > server on IE-5. The program starts with an HTM file. When the > submit button is pressed (and all is ok) it runs my CGI program. > When all is not ok, I get a file download box. "You have chosen > to download a file from this location...." > > What kind of problem should I go looking for inside the CGI > program? This means that you are not sending the appropriate Content-Type header. Put this before you output anything. (I do not know what language, so I am assuming C) printf("Content-Type: %s\r\n", "text/html"); printf("\r\n"); Hope that helps, - Sander van Zoest sander@mp3.com High Geek (858) 623-7442 MP3.com, Inc. http://www.mp3.com/ Your premiere Music Service Provider (MSP) ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 5 23:29:46 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question In-Reply-To: Message-ID: ~sdpm~ Hey, first time I really addressed this group! Hi! Ok, I'm going to give you a trick question, cause I want to see how many Perl-heads are really in this group. I came upon this the other day, and want to see if anyone can identify the "problem". I came up (all on my very own! I'm growing!) with a handy idiom for handling output of a lot of different filesystem related things, 'tar tvfz' output, long file listings, stuff like that: @flist = map { split '\s+', $_; $_[$#_] } @flist; it does just what I want, but there is a "problem". Can you tell us what it is? Chad, if you are lurking, keep quiet or I'll post those pictures of you and PeeWee Herman! Thanks for your patience, hope to hear from you soon! CA -- AC #1: Now, if they were to force-evolve code using a genetic algorithm, you might get code better than any a human could write. AC #2: Of course, you'd have to put up with the fact that this would not be executable in Kansas. C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From chris at binev.com Fri Feb 4 23:52:22 2000 From: chris at binev.com (Chris Radcliff) Date: Thu Aug 5 00:19:56 2004 Subject: Two Questions Please References: <3.0.4.32.20000204200200.007af290@cts.com> Message-ID: <389BBA96.A69E0C9B@binev.com> ~sdpm~ Hi Joel! The answer to your first question presupposes a little understanding of Perl arrays. In Perl, arrays start with element 0 whether you declare it or not. For instance, if I have: $chris[1] = 'foo'; $chris[2] = 'bar'; $chris[3] = 'baz'; it's just like saying: @chris = (undef, 'foo', 'bar', 'baz'); Perl keeps a element 0 open for me to declare later. Likewise, if I have: $chris[92037] = 'zip'; it's like saying: @chris = (undef, undef, undef ...you get the picture... undef, undef, 'zip'); So, when you print @Adr in your example, you're asking it to print @Adr[0] first, which hasn't been declared. Since you have -w turned on (good!) you get a warning. If you start counting with 0 or declare an empty string into @Adr[0], the warning will go away. To answer your second question, if IE5 asks you to download a file when you're expecting a Web page, download it as something like errors.txt and look at it in a text editor. You'll probably find an error that caused the script to die before it printed the CGI headers. Hope that helps! ~chris Joel Fentin wrote: > > ~sdpm~ > If I have a statement like: > $Adr[1] = 3. > And later another statement in a different function like: > print @Adr; > It prints it correctly but I get a message: > "Use of uninitialized value......" > > So, at the start of the program I have tried: > use vars qw(@Adr); > local @Adr; > my @Adr; > > The message stays. What does it want? > > ============================= > > Second question: > > I am running my programs on a laptop with Windoz using Apache > server on IE-5. The program starts with an HTM file. When the > submit button is pressed (and all is ok) it runs my CGI program. > When all is not ok, I get a file download box. "You have chosen > to download a file from this location...." > > What kind of problem should I go looking for inside the CGI > program? > -- > Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 > > email: joel@cts.com web: http://efm.simplenet.com > ~sdpm~ ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 5 23:58:35 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question In-Reply-To: Message-ID: ~sdpm~ Hi again, I have another, somewhat related one. It's relate in two ways: it does the same thing as the other, and there is a "problem". This problem is much more annoying because of its nature, but I'm not sure if it is related to the other one or not (maybe a perl-porter could say, I don't know). Here's the code: @flist =~ map { s/^.*\s([\S]+)$/$1/ } @flist; -CA -- All your qualifications for kookiness seem to be aimed at eliminating yourself simply because you advocate a mainstream product. That is sort of just being a kook who is a conformist. A bit of a contradiction in terms, but a valid description. -- Bob O C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Sat Feb 5 11:58:32 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question Message-ID: ~sdpm~ your first "solution" can be rewritten as @flist = map +(split)[-1], @flist; your second solution can be rewritten as (notice no tilda after the equal sign) @flist = map /(\S+$)/, @flist; cheers. MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Sat Feb 5 13:05:28 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: Fwd: Perl's alleged tempfile vulnerabilities Message-ID: ~sdpm~ FYI. -- --------- Forwarded Message --------- DATE: Fri, 4 Feb 2000 06:48:37 From: Tom Christiansen To: BUGTRAQ@SECURITYFOCUS.COM [Message CC'd to bugtraq per Theo's request] theo>Check this out. >> Date: Wed, 2 Feb 2000 12:50:14 +0200 >> Sender: Bugtraq List >> From: Neil Blakey-Milner >> To: BUGTRAQ@SECURITYFOCUS.COM >> Organization: Rhodes University Computer Users' Society >> Subject: Re: Tempfile vulnerabilities >> X-To: Grant Taylor >> In-Reply-To: <200002010455.XAA20677@pace.picante.com> >> >> On Mon 2000-01-31 (23:55), Grant Taylor wrote: >> > >> > sub get_tmpfile { >> > my $file; >> > do { >> > open RAN, "/dev/random" || die; >> > read(RAN,$foo,16); >> > close RAN; >> > $file = '/tmp/autobuse' . unpack('H16',$foo); >> > } while (-e $file || -l $file); >> > >> > return $file; >> > } >> > >> > This method is Linux-specific, but that's all I need. The fixed >> > autobuse is available at http://www.picante.com/~gtaylor/autobuse/ >> > >> > Note that Autobuse has, as far as I know, zero users (including me). >> > If I am wrong about this, please let me know! >> >> I was about to suggest using mkstemp() from File::MkTemp, available >> on CPAN, until I noticed that this mkstemp doesn't seem to use >> O_CREAT and O_EXCL from Fcntl nor does it chmod 600 or similar. >> >> It uses: >> >> $template = mktemp(@_); >> >> $openup = File::Spec->catfile($_[1], $template); >> >> $fh = new FileHandle ">$openup"; #and say ahhh. >> >> croak("Could not open file: $openup") >> unless(defined $fh); >> >> return($fh); >> >> Which seems to be just as bad as using mktemp, and then opening a >> file, with the usual race conditions. Considering the general >> feeling about the "mkstemp" concept, this implementation isn't >> quite there. >> >> Neil >> -- >> Neil Blakey-Milner >> nbm@rucus.ru.ac.za >Is there a correct mkstemp(3) in perl? >THERE REALLY SHOULD BE. Can you give me details? I have always advocated one of two approaches. These are published. I can't help it if people do stupid things. :-( 1) use POSIX; do { $name = tmpnam(); } until sysopen(FH, $name, O_RDWR|O_CREAT|O_EXCL, 0666); 2) use IO::File; $handle = IO::File->new_tmpfile(); # this is POSIX's tmpfile(3) The second case is what you're told to use if if you ask for POSIX::tmpfile, which has always struck me as a bit as awkward at best. I think one should just do it instead of blowing up as POSIX::tmpfile current does. This may be an issue of FDs versus FPs; Perl I/O operators/functions expect to deal with (FILE *)FPs, not (int)FDs. So you'd have to fdopen the FD you got back anyway to do much with it. Anyway, here's the IO::File description: new_tmpfile Creates an IO::File opened for read/write on a newly created temporary file. On systems where this is possible, the temporary file is anonymous (ie. it is unlinked after creation, but held open). If the temporary file cannot be created or opened, the IO::File object is destroyed. Otherwise, it is returned to the caller. In the XS code[see footnote #0], we have the following: MODULE = IO PACKAGE = IO::File PREFIX = f SV * new_tmpfile(packname = "IO::File") char * packname PREINIT: OutputStream fp; GV *gv; CODE: #ifdef PerlIO fp = PerlIO_tmpfile(); #else fp = tmpfile(); #endif gv = (GV*)SvREFCNT_inc(newGVgen(packname)); hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); if (do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) { ST(0) = sv_2mortal(newRV((SV*)gv)); sv_bless(ST(0), gv_stashpv(packname, TRUE)); SvREFCNT_dec(gv); /* undo increment in newRV() */ } else { ST(0) = &PL_sv_undef; SvREFCNT_dec(gv); } Which is just calling the standard POSIX tmpfile() function. Well, sometimes. If you use the Perl I/O abstraction, then you get either the real tmpfile(), or under sfio, some sftmp(0) thingie that I know nothing about. The only hole I see is in my ignorance of the possible sfio-related sftmp(0) call. Enlightenment in this area is welcome. I also don't know what sub-Unix systems do about the unlink issue, since their primitive or alien filesystems are notoriously too paltry to support that approach, since they can't bring themselves to talk about a file as something distinct from a filename. In that case, I don't know what happens to the file created by IO::File::new_tmpfile. Perhaps it has a destructor to unlink it eventually, but this isn't in any code I could find. There's been some discussion of having Perl automatically call tmpfile() in the event that its filename were undefined. For example: # get an anon filehandle (ie. stdio/sfio stream object) open(TMPFH, undef) || die "can't get tmpfilehandle: $!"; # or using monadic open on an undefined variable undef $tmpfh; # initial state of all variables, actually open($tmpfh) || die "can't get tmpfilehandle: $!"; In fact, Perl hero Nick Ing-Simmons once offered up the code to make open(F, undef) automatically call tmpfile(). Perhaps in retrospect lamentably, this proposal was shot down due to its ugly interface. It may well be that we want to resurrect that notion, perhaps amending it to produce a form more acceptable to the interface lawyers. I do not dispute that there's a great deal of code out there that for a temporary file, blindly does an open(TMPOUT, "> /tmp/foo.$$") in order to get its temporary file. I do feel that Perl has facilities to create safe temporary files, but that, for various reasons, people are largely unaware of them. So they end up doing the /tmp/foo.$$ thing, and thus open themselves up to a large host of maladies. That "strategy", to use the term generously, is vulnerable to pid prediction, which, while reasonably stymied by OpenBSD's randomized pid assignment, is of no help to people on systems that don't do that. Worse, it is subject to someone else pre-creating that file in a world-writable directory. Consider what hitting a named pipe instead of a regular file could do to your program. Now, accessing open(2) instead of fopen(3) and then using O_EXCL|O_CREAT would help, but does not suffice for all possible cases. Someone could have created a symbolic link from that file to elsewhere--or to nowhere. If the file did exist, then without the O_EXCL|O_CREAT check it would blindly overwrite it, as we so often saw in the execve() symlink/suid-script bug targetting important files like /etc/passwd with the link. But because a symlink can point to nowhere, the O_EXCL|O_CREAT test does not suffice: you might still end up making a "new" file, even one that you own, that's somewhere else than you think it is. Who knows what nastiness the nefarious crackers could possibly make of that? It isn't clear how best to address the issues raised in the original bug report. We *have* the technology now to take care of most if not all the problems, but inadequate user education remains the bottleneck. Quite bluntly, people make poor decisions, and I don't see how to stop this from happening: "The poor we shall have with us always." :-( [Back to Theo, from private mail] theo>In the last 6 months, I think that about 25 /tmp races in perl theo>programs have hit it. That number is going to go way up. theo> theo>A proactive approach to education could squish that now, instead theo>of reacting 3 years from now when everyone has done it wrong. Perl has two things you can do, neither of which is "automatic" in the sense that it's part of the normal Perl open() function. 1) You *can* use POSIX::tmpnam(), and this seems to behave reasonably well on most systems. However, you still have to know to do the right thing (the sysopen loop previous demonstrated), and you have no control over *where* the file is placed, which means it can very well land in a directory that's mode 0777 not 01777 (or be run on a system that doesn't honor sticky directories as owner-delete-only), just to mention one potential problem. 2) On the other hand, IO::File::new_tmpfile (which IM!HO should really be merely POSIX::tmpfile per expectations) dodges at least one bullet by making the proper open call for you. However, it gives you no access to the filename created; in fact, there often isn't one, due to unlink magic. This is less error prone, but still imperfect. We could adopt some of the "automatic tmpfile" strategies involving an undefined filename, but that's not the whole of the issue. To answer your original question, no, Perl does *not* currently support the mk*temp*(3) family of functions (meaning mktemp(3), mkstemp(3), mkstemps(3), and mkdtemp(3)). Apparently, there's something on CPAN called File::Temp, but it looks like it's not doing the right thing and just calling the real functions[FN#1]. These would allow you to supply a full template and thus place your temporary files in the directory that you want them in. We could add those trivially enough. But this still can do nothing to make people use them. In fact, nothing can. :-( I think that the easiest but perhaps not the most effective "solution" I can offer you is to add a notice in the Perl documentation on the open and sysopen functions, and also in the security section, that mentions the use of POSIX::tmpnam() and IO::File::new_tmpfile(). This might have more effect than adding the mk*temp*(3) family. But we could do that, too. There *is* one more thing we might be able to do, one that's a bit more proactive. We might augment Perl's open function so that it would emit a warning when run with warnings[FN#2] and/or that it would raise an exception when run in taint mode[FN#3]. This would mean checking for using the perilously simplistic open(FH, ">filename") style of open (which, being fopen(path, "w"), is really O_TRUNC|O_CREAT not O_EXCL|O_CREAT) on a file whose name looks like a tempfile. Now, just how could you ever tell that? Well, one could watch for "$$" at the end of the filename. Maybe this would be only in conjunction with a "/tmp/" component, but not necessarily rooted at slash, so that /usr/tmp and /var/tmp would show up, too. Perl could, upon finding this situation (however we define it), emit a warning or raise an exception to the effect that this operation is insecure because it's subject to a race condition, and suggest using one of POSIX::tmpnam() and IO::File::new_tmpfile() instead. I will forward this message to p5p, Perl's release and development team for further discussion. Interested and creative parties should feel free to *constructively* kibitz there. :-) --tom Footnotes: [0] XS is C-like glue code that gets massaged by Perl's xsubpp (the external subroutine preprocessor) into legit C, somewhat akin to Sun RPC xdr .x files. [1] The "real" mk*temp*(3) functions are described at http://www.openbsd.org/cgi-bin/man.cgi?query=mktemp&apropos=0&sektion=3&m [2] Warnings are enabled via the -w/-W command line switches, or else under the "use warnings" pragma. [3] "taintperl" security checks are enabled either optionally through the -T command line switch, or else automatically when running with differing real vs. effective user and/or group IDs. -- Tom Christiansen Perl Documentation Pumpking tchrist@perl.com --------- End Forwarded Message --------- MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 5 15:21:09 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question In-Reply-To: Message-ID: ~sdpm~ On Sat, 5 Feb 2000, Eugene Tsyrklevich wrote: > your first "solution" can be rewritten as > > @flist = map +(split)[-1], @flist; > > your second solution can be rewritten as (notice no tilda after the equal sign) > > @flist = map /(\S+$)/, @flist; These are both great! Wow you fixed my code and eliminated my problems at the same time. I've been poking around in the less traveled sections of Perl thinking I would be rewarded: (3)[1259]$ tar tvfz ~/downloads/pbs/pbs_v2.2p7.tar.gz | ./bm-tarout.plx Benchmark: timing 1000 iterations of COD1, CODE, LOOP, REG1, REGX... COD1: 24 wallclock secs (24.00 usr + 0.01 sys = 24.01 CPU) CODE: 27 wallclock secs (27.39 usr + 0.00 sys = 27.39 CPU) LOOP: 19 wallclock secs (18.66 usr + 0.00 sys = 18.66 CPU) REG1: 17 wallclock secs (17.22 usr + 0.00 sys = 17.22 CPU) REGX: 28 wallclock secs (27.82 usr + 0.00 sys = 27.82 CPU) Now I know how badly my code sucks, but less why I should be poking around in the less traveled sections of perl! I applied Eugene's match to a standard loop and it is virtually as fast as 'map'. Well, now my problems don't exist in Eugene's code, but I'm still curious about the second one: turn warnings on and Perl will bitch about applying a regex substitution to the /scalar/ context of the array. This is just not true (I think) and I was hoping someone could explain whether this is really a bug or if my code is just really brain-damaged but Perl is doing a pretty good job of covering for me. Thanks again for the input and I hope someone else got as much out of this as me ==================================================================== #! /usr/bin/perl use Benchmark; my ( @a, @b, @c, @d, @e, @f ); @fl = <>; timethese( 500, { CODE => sub { @a = @fl; @a = map { split /\s+/; $_[$#_] } @a }, COD1 => sub { @b = @fl; @b = map +(split)[-1], @b }, REGX => sub { @c = @fl; @c =~ map { s/^.*\s([\S]+)$/$1/ } @c }, REG1 => sub { @d = @fl; @d = map /(\S+$)/, @d }, LOOP => sub { @f = @fl; for ($i=0;$i<@f;$i++) {$f[$i]=~ /(\S+$)/;} } }); ==================================================================== CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Sat Feb 5 15:33:57 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:56 2004 Subject: Two Questions Please Message-ID: <3.0.4.32.20000205133357.007a8990@cts.com> ~sdpm~ C. Abney, Sander van Zoest, & Chris Radcliff Thank you. Those were the answers I needed. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Sat Feb 5 16:07:01 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question Message-ID: ~sdpm~ that is indeed a bug in your code http://www.perl.com/CPAN-local/doc/manual/html/pod/perlop.html#Binding_Operators btw, your last benchmark item is broken. you say $f[$i]=~ /(\S+$)/; that applies the regular expression to $f[$i] and then it throws away the result. to fix that you can say $f[$i] = $1 if $f[$i] =~ /(\S+$)/; or you can do it the perl way :) push @f, /(\S+$)/ for @fl; ^ that should be a bit faster than your original loop since for (@fl) is faster than for ($i=0; $i<@fl;$i++) which is generally faster than using map cheers. -- On Sat, 5 Feb 2000 13:21:09 C. Abney wrote: >On Sat, 5 Feb 2000, Eugene Tsyrklevich wrote: > >> your first "solution" can be rewritten as >> >> @flist = map +(split)[-1], @flist; >> >> your second solution can be rewritten as (notice no tilda after the equal sign) >> >> @flist = map /(\S+$)/, @flist; > >These are both great! Wow you fixed my code and eliminated my problems >at the same time. I've been poking around in the less traveled sections >of Perl thinking I would be rewarded: > >(3)[1259]$ tar tvfz ~/downloads/pbs/pbs_v2.2p7.tar.gz | ./bm-tarout.plx >Benchmark: timing 1000 iterations of COD1, CODE, LOOP, REG1, REGX... > COD1: 24 wallclock secs (24.00 usr + 0.01 sys = 24.01 CPU) > CODE: 27 wallclock secs (27.39 usr + 0.00 sys = 27.39 CPU) > LOOP: 19 wallclock secs (18.66 usr + 0.00 sys = 18.66 CPU) > REG1: 17 wallclock secs (17.22 usr + 0.00 sys = 17.22 CPU) > REGX: 28 wallclock secs (27.82 usr + 0.00 sys = 27.82 CPU) > >Now I know how badly my code sucks, but less why I should be poking around >in the less traveled sections of perl! I applied Eugene's match to a >standard loop and it is virtually as fast as 'map'. > >Well, now my problems don't exist in Eugene's code, but I'm still curious >about the second one: turn warnings on and Perl will bitch about applying >a regex substitution to the /scalar/ context of the array. This is just >not true (I think) and I was hoping someone could explain whether this is >really a bug or if my code is just really brain-damaged but Perl is doing >a pretty good job of covering for me. > >Thanks again for the input and I hope someone else got as much out of this >as me > >==================================================================== >#! /usr/bin/perl >use Benchmark; >my ( @a, @b, @c, @d, @e, @f ); >@fl = <>; >timethese( 500, { > CODE => sub { @a = @fl; @a = map { split /\s+/; $_[$#_] } @a }, > COD1 => sub { @b = @fl; @b = map +(split)[-1], @b }, > REGX => sub { @c = @fl; @c =~ map { s/^.*\s([\S]+)$/$1/ } @c }, > REG1 => sub { @d = @fl; @d = map /(\S+$)/, @d }, > LOOP => sub { @f = @fl; for ($i=0;$i<@f;$i++) {$f[$i]=~ /(\S+$)/;} } >}); >==================================================================== > >CA >-- >Einstein himself said that God doesn't roll dice. But he was wrong. And >in fact, anyone who has played role-playing games knows that God >probably had to roll quite a few dice to come up with a character like >Einstein. -- Larry Wall C. Abney > > MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sun Feb 6 23:10:06 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: super geek question In-Reply-To: Message-ID: ~sdpm~ On Sat, 5 Feb 2000, Eugene Tsyrklevich wrote: > btw, your last benchmark item is broken. you say $f[$i]=~ /(\S+$)/; > that applies the regular expression to $f[$i] and then it throws away > the result. to fix that you can say > $f[$i] = $1 if $f[$i] =~ /(\S+$)/; > > or you can do it the perl way :) > > push @f, /(\S+$)/ for @fl; > > ^ that should be a bit faster than your original loop since for (@fl) is > faster than for ($i=0; $i<@fl;$i++) which is generally faster than using map But doesn't that only work if you are populating a new array? I liked the parsimony of overwriting the existing values with the result. I thought it was appropriate for a one-time use of the array, and thought the extra memory usage incurred pushing into a new array was... inelegant for a one-time use like this. I would gladly exchange a little memory for performance, however. Thanks for the tips... I'm going to sit down and read this copy of Mastering Regular Expressions, and other things. I've been thinking how well I've been doing, but see now it is mostly an illusion brought on by reading the code I'm assigned to maintain/rewrite. CA -- You are responsible for the predictable consequences of your actions. -- Noam Chomsky C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From adms1 at cts.com Wed Feb 16 14:40:02 2000 From: adms1 at cts.com (adms1) Date: Thu Aug 5 00:19:56 2004 Subject: Tonight's Perl Mongers Meeting Message-ID: <200002161240020782.6E820321@smtp.cts.com> ~sdpm~ This is just a reminder to everyone that TONIGHT is our big Feb. meeting. As it stands, there will be 30-35 people attending. Thanx to everyone that shot me over a RSVP, it helps with planning meeting. If you did not RSVP and would still like to attend the meeting, by all mean, show up. The meeting will be held at 7:00pm at Binary Evolution 8380 Miramar Rd., Suite 105 San Diego, CA 92121 Take 805 to Miramar rd. East. Second traffic light: Miramar mall, left. Go two blocks until you see sharp right turn, turn left into parking lot. You'll see large sign on left side: 8380 Miramar mall. -Garrett ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From adms1 at cts.com Wed Feb 16 16:23:14 2000 From: adms1 at cts.com (adms1) Date: Thu Aug 5 00:19:56 2004 Subject: Perl Mongers Meeting Location ERROR Message-ID: <200002161423140475.6EE07D6E@smtp.cts.com> ~sdpm~ The directions to Binary Evolution are correct but the address listed is not. The location for the meeting is 8380 MIRAMAR MALL SUITE 105 not 8380 Miramar Road. The directions are the same... Take 805 to Miramar rd. East. Second traffic light: Miramar Mall, left. Go two blocks until you see sharp right turn, turn left into parking lot. You'll see large sign on left side: 8380 Miramar mall. I will see you soon! -Garrett ps. thanx Rick! ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cyrus at binevolve.com Wed Feb 16 16:50:39 2000 From: cyrus at binevolve.com (Cyrus Fassihi) Date: Thu Aug 5 00:19:56 2004 Subject: Perl Mongers Meeting Location ERROR References: <200002161423140475.6EE07D6E@smtp.cts.com> Message-ID: <38AB29BE.5DF0D410@binevolve.com> Hey Folks, Just to note, we will be meeting in the Main Lobby Conference Room: * Enter main lobby * Go Upstairs * Go left We'll be in the first room on your left. See you all there! -Cyrus adms1 wrote: > ~sdpm~ > The directions to Binary Evolution are correct but the address listed is not. > The location for the meeting is 8380 MIRAMAR MALL SUITE 105 not 8380 Miramar Road. > > The directions are the same... > Take 805 to Miramar rd. East. Second traffic light: Miramar Mall, left. > Go two blocks until you see sharp right turn, turn left into parking lot. > You'll see large sign on left side: 8380 Miramar mall. > > I will see you soon! > > -Garrett > > ps. thanx Rick! > > ~sdpm~ > > The posting address is: san-diego-pm-list@hfb.pm.org > > List requests should be sent to: majordomo@hfb.pm.org > > If you ever want to remove yourself from this mailing list, > you can send mail to with the following > command in the body of your email message: > > unsubscribe san-diego-pm-list > > If you ever need to get in contact with the owner of the list, > (if you have trouble unsubscribing, or have questions about the > list itself) send email to . > This is the general rule for most mailing lists when you need > to contact a human. -- Cyrus Fassihi cyrus@binaryevolution.com 858.622.1164 Perl Server Pages 858.622.0303 fax Load Testing & Performance Tuning http://www.velocigen.com XML Server Pages -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/san-diego-pm/attachments/20000216/f6cd4c27/attachment.htm From chris at binev.com Thu Feb 17 09:32:57 2000 From: chris at binev.com (Chris Radcliff) Date: Thu Aug 5 00:19:56 2004 Subject: Perl Mongers and mentor wanted References: <00b701bf7913$6d138ac0$3504f83f@fashcom.com> Message-ID: <38AC14A9.47C5CE96@binev.com> ~sdpm~ Hi Cash, Your message came through a little strangely. Did you send your letter mail to san-diego-pm-list@happyfunball.pm.org? Oh, and a tip: some (if not most) Mongers will be using text-only mail systems, so you'll probably want to send future messages in plain text. I'm not sure how to set that in Outlook, but I can investigate it if you don't know how. Let me know if you have any questions. ~chris ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rkleeman at neta.com Thu Feb 17 12:08:26 2000 From: rkleeman at neta.com (Bobby Kleemann) Date: Thu Aug 5 00:19:56 2004 Subject: Code review idea Message-ID: ~sdpm~ Fellows, I thought of a neat idea if we wanted to do online code review. We could try using the current slashdot.org code to do code review. Use the description and the code as the "article" and use the comments as comments on the code. The relevant sites/info http://slashdot.org/ http://slashdot.org/code.shtml http://slashcode.com/ _ _ _ Bobby Kleemann http://www.neta.com/~rkleeman/ ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From chris at binev.com Thu Feb 17 13:17:44 2000 From: chris at binev.com (Chris Radcliff) Date: Thu Aug 5 00:19:56 2004 Subject: Code review idea References: Message-ID: <38AC4958.76E02287@binev.com> ~sdpm~ I like this idea. I haven't looked at the Slash code yet (so I'm not sure if it's nightmarish) but we could certainly get it up and running in some form. Of course, the first code review would probably be the site itself, or would that be too recursive? :) ~chris Bobby Kleemann wrote: > I thought of a neat idea if we wanted to do online code review. > We could try using the current slashdot.org code to do code review. Use > the description and the code as the "article" and use the comments as > comments on the code. The relevant sites/info > > http://slashdot.org/ > http://slashdot.org/code.shtml > http://slashcode.com/ > ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From deborah at heritagemedia.com Mon Feb 21 11:34:06 2000 From: deborah at heritagemedia.com (Deborah Sherwood) Date: Thu Aug 5 00:19:56 2004 Subject: Xtra Dough Message-ID: <38B17700.4CC7177D@heritagemedia.com> ~sdpm~ Hello All, I have a small project that I need help with. Its easy dough for an expert (such as yourselves). I need to configure a shopping cart and database scenario quickly. I have the scripts (thanks to matt wright) but need some help with the installations and coordinating with my ISP. Weekend, evening hours, whenever but soon. (Be aware, I am a Mac user.) Also, I have a really cool Mac X Server that I have no idea how to use. Any help there would be appreciated as well. Reply with estimated time and consultation fees. Thanks in advance, Deborah ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joe at artlung.com Tue Feb 22 10:53:47 2000 From: joe at artlung.com (Joe Crawford) Date: Thu Aug 5 00:19:56 2004 Subject: WebSanDiego Happy Hour #5 - this Thursday! Message-ID: <38B2BF18.FD22BCDF@artlung.com> ~sdpm~ (Begging the list's indulgence) You are cordially invited to the 5th Happy Hour of WebSanDiego! Check it out at: http://www.websandiego.org/happyhour/hr_005/ FAQ about this event: http://www.websandiego.org/happyhour/hr_005_faq.shtml RSVP to this event (recommended): http://www.websandiego.org/happyhour/rsvp/ - Joe -- Joe Crawford...........electronic mail -> mailto:joe@artlung.com member......international mailing list -> http://evolt.org/ founder..San Diego/CA/USA mailing list -> http://www.websandiego.org/ Web Designer/etc.............about(me) -> http://www.artlung.com/ ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From sander at vanZoest.com Tue Feb 22 14:19:11 2000 From: sander at vanZoest.com (Sander van Zoest) Date: Thu Aug 5 00:19:56 2004 Subject: WTF Meeting Today Message-ID: ~sdpm~ Hi, I remember most of you having interest in template systems for dynamic content that we developed for MP3.com. I will be giving a talk for the Web Technologies Forum at SDSC. If this interests you, you might want to come out tonight. Cheers, -- Sander van Zoest sander@vanzoest.com High Geek, MP3.com, Inc. http://www.vanZoest.com/ ---------- Forwarded message ---------- From: Mary Thomas Date: Tue, 22 Feb 2000 10:59:28 -0800 (PST) Subject: REMINDER: WTF Meeting Today Cc: websandiego@onelist.com To: wtf@SDSC.EDU WTF Meeting Announcement: February, 2000 TOPIC: Developing High-Performance Dynamic Web Pages SPEAKER: Sander van Zoest MP3.coM DATE: February 22nd TIME: Mixer @ 6:30 p.m., Speaker @ 7:00 p.m. PLACE: San Diego Supercomputer Center Auditorium SEE: http://www.sdsc.edu/WTF for abstract and details Topic Outline: Developing High-Performance Dynamic Web Pages - with Templates, XML, and mod_PERL Templates and CSS dynamic layouts of your content can be created by your creative team and/or the end user. Learn why dynamic usage of XML using mod_PERL and Apache template modules is a good method to provide dynamic content. Learn to manage content and style independently. Bio Sander van Zoest is High Geek and part of the Founders group at MP3.com, Inc. He helped design and implement the process flow and custom server infrastructure used to provide a new way for artists to get their music to the masses, while still having constant control over their music. He is an Apache and FreeBSD advocate that enjoys working on scalable web architectures using XML and PERL. See the Web page at http://www.sdsc.edu/WTF/ for information about upcoming WTF meetings. Refreshements will be served Off-campus visitors: see http://www.sdsc.edu/Visitors/directions.html for directions and a map, or call 619-534-5000 for information. |>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<|>=<| Mary P. Thomas Email: mthomas@sdsc.edu Scientific Computing Group Voice: (858) 534-5061 San Diego Supercomputer Center Fax: (858) 534-5117 9500 Gilman Dr. San Diego, CA 92093-0505 URL: www.sdsc.edu/~mthomas ---------------------------------------------------- To unsubscribe from this e-mail list, send mail to majordomo@sdsc.edu with the words unsubscribe wtf in the body of the message. Do not send unsubscribe messages to the entire list ----------------------------------------------------- ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Thu Feb 24 14:23:01 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash Message-ID: ~sdpm~ I'm wondering if anyone can come up with a nicer way to get this key. Or even dump the hash altogether. I'm using: $top = each (%foo_h); By nicer I guess I mean more direct. I find this misleading. It's a part of the same script, in which I'm checking the manifest of a tarball for what are (to my mind) unexpected features. Obviously I'm automating an install (shhh!) of some software, and want to make sure nothing tooo out of the ordinary is happening while I'm not looking. It's a part of this code sequence: ... @flist = map +(split)[-1], @tarout; log_n_die ( "Unpack from rootdir, Huh?" ) if ( $flist[0] =~ /^\// ); # this grabs the topmost directory/file name(s) from the tar manifest for (@flist) { $foo_h{$1}++ if /([^\/]+)/; }; log_n_die ( "No top-level directory!!!" ) if ( keys (%foo_h) != 1); $top = each (%foo_h); ... # more checks, unpacking stuff log_n_die ( "Couldn't find PBS source dir, $top" ) unless ( -d $top ); ... # and so on... I'd also appreciate a lecture on regular expressions... One of the biggest gripes I hear about Perl is its obscure syntax and resulting poor maintainability. I KNOW that's wrong! I don't want to contribute to that perception and therefore welcome any hints (but I'm off topic now, and it's my own post, so... ) Perhaps you've noticed this is very closely related to what I posted last time! I'm really not a slow coder, honest. Really. Weell, I have a lot of other things that get in the way. Or something. Oh, this is the next revision! Yeah, that's it. Anyway, anyone have a better way to do this? p.s. Sorry I missed the meeting. How'd it go? CA -- Mighty Mouse is a cartoon. Superman is a real guy. No way a cartoon could beat up a real guy! -- Teddy C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Thu Feb 24 15:36:36 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: proxy Q, not a perl Q (what the hell...) Message-ID: ~sdpm~ I get a: proxy-authenticate: Basic realm ="enter username and passwd" header ( 407 ) from a proxy the network guy says isn't using authentication. What's my response? ( how 'bout I tell him he's full of beans! ) Sorry, I'm having trouble with rfc261[6|7] (or whatever they are.) CA -- [C++ is] like having a shopping cart with a souped-up V8 installed. Sounds kind of cool, but it'll rip your arms off if you try to actually use it to shop, and its handling on the road is less than spectacular... -- AC C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rforgey at grumpydogconsulting.com Thu Feb 24 17:16:12 2000 From: rforgey at grumpydogconsulting.com (Bob Forgey) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash In-Reply-To: References: Message-ID: <14517.44345.618748.176208@red> ~sdpm~ Hi, I think the hash is fine. You're putting together a set (of the top-level directories), and then counting the number of elements. In perl, a set is implemented as a hash in which you only care about the keys. I would probably use keys(%foo_h)[0] instead of the `each %foo_h', just to be explicit. Also, I would change the regexp /([^\/]+)/ to /^([^\/]+)/ so when I look at it, instead of wondering which string of non-/ it matches, it's clear that the first one is what's wanted. I presume you're using `tar tvf ...', which is the reason for the map function, instead of a chomp? Thanks Bob >>>>> "CA" == C Abney writes: CA> ~sdpm~ CA> I'm wondering if anyone can come up with a nicer way to get this key. CA> Or even dump the hash altogether. I'm using: CA> $top = each (%foo_h); CA> By nicer I guess I mean more direct. I find this misleading. CA> It's a part of the same script, in which I'm checking the manifest of CA> a tarball for what are (to my mind) unexpected features. Obviously I'm CA> automating an install (shhh!) of some software, and want to make sure CA> nothing tooo out of the ordinary is happening while I'm not looking. CA> It's a part of this code sequence: CA> ... CA> @flist = map +(split)[-1], @tarout; CA> log_n_die ( "Unpack from rootdir, Huh?" ) if ( $flist[0] =~ /^\// ); CA> # this grabs the topmost directory/file name(s) from the tar manifest CA> for (@flist) { $foo_h{$1}++ if /([^\/]+)/; }; CA> log_n_die ( "No top-level directory!!!" ) if ( keys (%foo_h) != 1); CA> $top = each (%foo_h); CA> ... # more checks, unpacking stuff CA> log_n_die ( "Couldn't find PBS source dir, $top" ) unless ( -d $top ); CA> ... # and so on... CA> I'd also appreciate a lecture on regular expressions... One of the CA> biggest gripes I hear about Perl is its obscure syntax and resulting CA> poor maintainability. I KNOW that's wrong! I don't want to contribute CA> to that perception and therefore welcome any hints (but I'm off topic CA> now, and it's my own post, so... ) CA> Perhaps you've noticed this is very closely related to what I posted CA> last time! I'm really not a slow coder, honest. Really. Weell, I have CA> a lot of other things that get in the way. Or something. Oh, this is CA> the next revision! Yeah, that's it. CA> Anyway, anyone have a better way to do this? CA> p.s. Sorry I missed the meeting. How'd it go? CA> CA CA> -- CA> Mighty Mouse is a cartoon. Superman is a real guy. No way a cartoon CA> could beat up a real guy! -- Teddy C. Abney CA> ~sdpm~ ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Fri Feb 25 14:14:22 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash In-Reply-To: <14517.44345.618748.176208@red> Message-ID: ~sdpm~ On Thu, 24 Feb 2000, Bob Forgey wrote: > ... I would probably use > keys(%foo_h)[0] > instead of the `each %foo_h', just to be explicit. I tried that and couldn't get it to work. Made sense to me too, otherwise. It's a bit wordier than mine, but tells you exactly what you want to do. I even tried it with a symref... :( > I presume you're using `tar tvf ...', which is the reason for the map > function, instead of a chomp? Yes, and that it'll also work with (for example) long file listings, or ftp->ls(), or... my root dir test was really messed up, though. Here's a mod on the script (and in usable form!) ============================================================ #! /usr/bin/perl # Takes output from a tarball manifest listing and checks that only one # toplevel directory/file exists. # just do a 'tar tvfz bar.tar.gz | onekeyhash.pl' @flist = map +(split)[-1], <>; # Danger: tar Pczf bar.tar.gz meme proxy /vmlinuz # this grabs the topmost directory/file name(s) from the tar manifest for (@flist) { $foo_h{$1}++ if m|([^/]+)|; $augh++ if m|^/|; }; die "someone's out to get you\n" if ( $augh ); die "more than one topmost directory or file\n" if ( keys (%foo_h) != 1 ); $top = each (%foo_h); print "topmost directory: $top\n"; ============================================================ Thanks for the tips... CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Fri Feb 25 00:35:54 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash Message-ID: ~sdpm~ see http://www.perl.com/CPAN-local/doc/manual/html/pod/perldata.html#Scalar_values and http://www.perl.com/CPAN-local/doc/manual/html/pod/perlre.html or man perlre or perldoc perlre for regular expressions discussion. check out 'mastering regular expression' book for even more info.. it's kinda outdated but still covers a lot of ground you might also wanna bookmark http://www.perl.com/CPAN-local/doc/manual/html/pod/ cheers. On Fri, 25 Feb 2000 12:14:22 C. Abney wrote: >~sdpm~ >On Thu, 24 Feb 2000, Bob Forgey wrote: > >> ... I would probably use >> keys(%foo_h)[0] >> instead of the `each %foo_h', just to be explicit. > >I tried that and couldn't get it to work. Made sense to me too, otherwise. >It's a bit wordier than mine, but tells you exactly what you want to do. >I even tried it with a symref... :( > >> I presume you're using `tar tvf ...', which is the reason for the map >> function, instead of a chomp? > >Yes, and that it'll also work with (for example) long file listings, or >ftp->ls(), or... > >my root dir test was really messed up, though. Here's a mod on the >script (and in usable form!) > >============================================================ >#! /usr/bin/perl ># Takes output from a tarball manifest listing and checks that only one ># toplevel directory/file exists. ># just do a 'tar tvfz bar.tar.gz | onekeyhash.pl' > >@flist = map +(split)[-1], <>; > ># Danger: tar Pczf bar.tar.gz meme proxy /vmlinuz ># this grabs the topmost directory/file name(s) from the tar manifest >for (@flist) { $foo_h{$1}++ if m|([^/]+)|; $augh++ if m|^/|; }; > >die "someone's out to get you\n" if ( $augh ); > >die "more than one topmost directory or file\n" if ( keys (%foo_h) != 1 ); > >$top = each (%foo_h); > >print "topmost directory: $top\n"; >============================================================ > >Thanks for the tips... > >CA MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Thu Feb 24 16:54:26 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash In-Reply-To: Message-ID: ~sdpm~ On Fri, 25 Feb 2000, C. Abney wrote: > On Thu, 24 Feb 2000, Bob Forgey wrote: > > > ... I would probably use > > keys(%foo_h)[0] > > instead of the `each %foo_h', just to be explicit. > > I tried that and couldn't get it to work. Made sense to me too, otherwise. > It's a bit wordier than mine, but tells you exactly what you want to do. > I even tried it with a symref... :( dang, spoke too soon. Of course '$top = +(keys (%foo_h))[0];' will work. CA -- AC #1: Now, if they were to force-evolve code using a genetic algorithm, you might get code better than any a human could write. AC #2: Of course, you'd have to put up with the fact that this would not be executable in Kansas. C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Thu Feb 24 17:13:13 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash In-Reply-To: Message-ID: ~sdpm~ On Thu, 24 Feb 2000, Eugene Tsyrklevich wrote: ok, make things hard for me you're hinting at an anonymous hash, maybe? CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Thu Feb 24 19:07:28 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: one key hash In-Reply-To: Message-ID: ~sdpm~ On Thu, 24 Feb 2000, C. Abney wrote: > you're hinting at an anonymous hash, maybe? omigod, better goto bed: tar tvfz bar.tar.gz | perl -wle '$foo = sub { while (<>) {$f{$1}++ if /([^\s\/]+)[\S]*$/};keys %f}; print &$foo' CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Fri Feb 25 12:32:58 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:56 2004 Subject: email Message-ID: <3.0.4.32.20000225103258.0079c290@cts.com> ~sdpm~ The following is a simplified version of the program in the cookbook (Pg. 651). It isn't working and I don't have a clue. Than you for any ideas. apache: [Wed Feb 23 21:03:16 2000] [error] [client 204.94.75.117] script not found or unable to stat: /u/web/theede/cgi-local/mailtest.pl apache: [Wed Feb 23 21:03:46 2000] [error] [client 204.94.75.117] Premature end of script headers: /u/web/theede/cgi-local/MailTest.pl ============================== =========== #!/usr/local/bin/perl use CGI qw(:cgi-lib :standard); open (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg"); print SENDMAIL <<"EOF"; From: joel@cts.com To: joel@cts.com Subject: Mail Test This is the message body. EOF close (SENDMAIL); -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From chris at binev.com Fri Feb 25 13:01:52 2000 From: chris at binev.com (Chris Radcliff) Date: Thu Aug 5 00:19:56 2004 Subject: email References: <3.0.4.32.20000225103258.0079c290@cts.com> Message-ID: <38B6D1A0.BBAA2375@binev.com> ~sdpm~ Hi Joel, What happens when you run the script from the command line or in -w mode? Just off the top of my head, you need to escape the @ in joel@cts.com so Perl doesn't think you're referencing an array, and you should check if your open statement actually works, like thus: open (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg") or die "yipes!"; It looks like the path might be invalid (what OS is this under?) so check if /USER/LIB/sendmail actually exists. I'm not even looking at the sendmail parameters. Check those if all else fails. ~chris Joel Fentin wrote: > > ~sdpm~ > The following is a simplified version of the program in the > cookbook (Pg. 651). It isn't working and I don't have a clue. > > Than you for any ideas. > > apache: [Wed Feb 23 21:03:16 2000] [error] [client 204.94.75.117] > script not found or unable to stat: > /u/web/theede/cgi-local/mailtest.pl > apache: [Wed Feb 23 21:03:46 > 2000] [error] [client 204.94.75.117] Premature end of script > headers: > /u/web/theede/cgi-local/MailTest.pl > ============================== > =========== > #!/usr/local/bin/perl > use CGI qw(:cgi-lib :standard); > > open > (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg"); > print SENDMAIL > <<"EOF"; > From: joel@cts.com > To: joel@cts.com > Subject: Mail > Test > > This is the message body. > > EOF > close (SENDMAIL); > ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rlssdpm at schnapp.org Fri Feb 25 13:10:02 2000 From: rlssdpm at schnapp.org (Russ Schnapp) Date: Thu Aug 5 00:19:56 2004 Subject: email Message-ID: <200002251905.OAA26696@happyfunball.pm.org> ~sdpm~ I would think this script would work, so long as: 1. You are running on a UNIX machine (unless sendmail is available on other machines); and 2. Your UNIX machine is configured to use sendmail, and that you have permissions to execute it, and that it does indeed reside at /USER/LIB/sendmail That pathname looks suspicious to me, though. I prefer to use Net::SMTP to send emails from my scripts. ...Russ ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From tdarugar at binev.com Fri Feb 25 13:14:01 2000 From: tdarugar at binev.com (Parand T. Darugar) Date: Thu Aug 5 00:19:56 2004 Subject: email References: <3.0.4.32.20000225103258.0079c290@cts.com> <38B6D1A0.BBAA2375@binev.com> Message-ID: <38B6D479.211C93EE@binev.com> ~sdpm~ Hi gang, I just put together an automated mailing script using the "Mail-Sender-Demo.pl" examples found at: http://savage.net.au/Perl-tutorials.html The Mail::Sendmail package automates a lot dealing with sendmail, and worked real well for me. Best, Parand Tony Darugar tdarugar@binevolve.com 858-622-1164 High Performance Perl Server Pages 858-481-7438 fax Load Testing and Performance Tuning http://www.velocigen.com/ XML Server Pages > > The following is a simplified version of the program in the > > cookbook (Pg. 651). It isn't working and I don't have a clue. ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Fri Feb 25 14:11:35 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: email Message-ID: ~sdpm~ >open (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg") or die "yipes!"; this is supposed to be open(blah) || die; or open blah or die; due to operator precedence. cheers. MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From brucet at onebox.com Fri Feb 25 15:07:24 2000 From: brucet at onebox.com (Bruce Timberlake) Date: Thu Aug 5 00:19:56 2004 Subject: email Message-ID: <20000225210724.ZIUB28348.mta04.onebox.com@onebox.com> ~sdpm~ ---- Joel Fentin wrote: > (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg"); Are you sure this shouldn't be "|/usr/lib/sendmail..."? Especially as your shebang at the top of the script says that perl is in /usr/local/bin? Bruce __________________________________________________ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Fri Feb 25 15:57:20 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:56 2004 Subject: email In-Reply-To: <38B6D1A0.BBAA2375@binev.com> References: <3.0.4.32.20000225103258.0079c290@cts.com> Message-ID: <3.0.4.32.20000225135720.007a4b50@cts.com> ~sdpm~ CHRIS: >What happens when you run the script from the command line or in -w >mode? I am not sure what you are asking. By command line do you mean telnet? If so, they (Verio) will not let me telnet. If you mean something else, please spell it out. =================== >Just off the top of my head, you need to escape the @ in joel@cts.com so >Perl doesn't think you're referencing an array, Do you mean joel\@cts.com ? =================== >and you should check if >your open statement actually works, like thus: > >open (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg") or die "yipes!"; I added or die "yipes!" to the program and ran it again. The window in netscape said: internal server error. Here is the error log: /u/web/theede/cgi-local/MailTest.pl apache: [Fri Feb 25 14:03:00 2000] [error] [client 204.94.75.117] File does not exist: /u/web/theede/stats/statistics/ apache: [Fri Feb 25 14:45:50 2000] [error] [client 204.94.75.117] Premature end of script headers: /u/web/theede/cgi-local/MailTest.pl ===================== > >It looks like the path might be invalid (what OS is this under?) so >check if /USER/LIB/sendmail actually exists. This is from a page called cgi_scripts.cfm: If a script calls another file within your account, but the script does NOT require a URL, you need to use the system path. Instead of using the absolute path to your home directory ("/www26/web/someid"), you should instead use the DOCUMENT_ROOT environment variable ($ENV{DOCUMENT_ROOT} in Perl) to determine the path of your files or programs within a script. Change this: /www23/web/yourid/data/fact.html To this: $ENV{DOCUMENT_ROOT}/data/fact.html The system path to the sendmail program on our UNIX server is /usr/lib/sendmail The system path to the date command on our UNIX server is /sbin/date ======================== RUSS: >I would think this script would work, so long as: > >1. You are running on a UNIX machine (unless sendmail is >available on other machines); I think the above indicates it is a unix machine. I don't understand what you mean by other machines. >and > >2. Your UNIX machine is configured to use sendmail, and that you >have permissions to execute it, and that it does indeed reside at >/USER/LIB/sendmail The above seems to indicate that's where it is. Verio seems hostile to perl. I had to ask the Verio support twice if email works with a perl script. They admitted that it does, but there is no support for perl. There are oodles of help pages for HTML and not a word about perl. ====================== PARLAND > I just put together an automated mailing script..... Thank you but I need to learn to do this in perl. My current application involves a special purpose mail merge program. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Fri Feb 25 16:50:07 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:56 2004 Subject: email In-Reply-To: Message-ID: <3.0.4.32.20000225145007.00794b50@cts.com> ~sdpm~ Eugene & Bruce Per your suggestions the program line now reads: open (SENDMAIL,"|/user/lib/sendmail -oi -t -odg") || die "yipes!"; The error message now reads: /u/web/theede/cgi-local/MailTest.pl apache: [Fri Feb 25 17:41:56 2000] [error] [client 204.94.75.117] Premature end of script headers: /u/web/theede/cgi-local/MailTest.pl Thank you for your efforts. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Fri Feb 25 17:14:26 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:56 2004 Subject: email Message-ID: ~sdpm~ as Bruce have pointed out your sendmail's path is probably incorrect; it is supposed to be smth like /usr/lib instead of /user/lib... it's /usr/sbin on my system. and your script dies because you are trying to execute it as a cgi script which requires special handling.. ie you have to print the http headers... try adding the following piece of code to your script print "Content-type: text/plain\n\n"; you might wanna invest in a cgi book... i know that O'Reilly has one.. good luck. p.s. since verio doesn't give you a shell access i would recommend installing a unix variant on one of your computers. -- On Fri, 25 Feb 2000 14:50:07 Joel Fentin wrote: >~sdpm~ >Eugene & Bruce > >Per your suggestions the program line now reads: > >open (SENDMAIL,"|/user/lib/sendmail -oi -t -odg") || die "yipes!"; > >The error message now reads: > >/u/web/theede/cgi-local/MailTest.pl >apache: [Fri Feb 25 17:41:56 >2000] [error] [client 204.94.75.117] Premature end of script >headers: /u/web/theede/cgi-local/MailTest.pl > >Thank you for your efforts. >-- >Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 > >email: joel@cts.com web: http://efm.simplenet.com MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From brucet at onebox.com Fri Feb 25 18:44:25 2000 From: brucet at onebox.com (Bruce Timberlake) Date: Thu Aug 5 00:19:56 2004 Subject: CGI email (was Re: email) Message-ID: <20000226004425.CMBX28925.mta02.onebox.com@onebox.com> ~sdpm~ ---- Joel Fentin wrote: > Per your suggestions the program line now reads: > > open (SENDMAIL,"|/user/lib/sendmail -oi -t -odg") || die "yipes!"; It's still wrong. Should be /usr/lib/sendmail -- no "e" in /usr Also, I think you need to do something special with your output since you're doing it from CGI (as opposed to straight Perl) -- I am not a CGI whiz, so I'm not sure, but I think you have to put some type of "Content: text/plain" in there before you start any other output, even though you're not outputting to a web page... Hope this helps! Bruce __________________________________________________ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rlssdpm at schnapp.org Fri Feb 25 19:42:01 2000 From: rlssdpm at schnapp.org (Russ Schnapp) Date: Thu Aug 5 00:19:56 2004 Subject: CGI email Message-ID: <200002260136.UAA28581@happyfunball.pm.org> ~sdpm~ > > open (SENDMAIL,"|/user/lib/sendmail -oi -t -odg") || die "yipes!"; > > It's still wrong. Should be /usr/lib/sendmail -- no "e" in /usr > > Also, I think you need to do something special with your output > since you're doing it from CGI... Presumably, you are talking more about the "die" statement's output. Yes, the "yipes!" output would NOT make a browser very happy. Bruce is right. At the very beginning of your script, you probably ought to start with: print < Diagnostic output from $0
END

...and then close with

print <


END

Really, trying to do all of this in the blind has got to be molto 
frustrating.  Doesn't verio offer you any pre-debugged CGI scripts 
that you could crib from?

...Russ
~sdpm~

The posting address is: san-diego-pm-list@hfb.pm.org

List requests should be sent to: majordomo@hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to  with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to  .
This is the general rule for most mailing lists when you need
to contact a human.


From brucet at onebox.com  Fri Feb 25 19:46:17 2000
From: brucet at onebox.com (Bruce Timberlake)
Date: Thu Aug  5 00:19:56 2004
Subject: CGI email (was Re: email)
Message-ID: <20000226014617.CTJC28925.mta02.onebox.com@onebox.com>

~sdpm~
Still more ideas... (found this on RedHat's Apache Tips page while searching
for something else)

Topic: What does it mean when my CGIs fail with "Premature end of script
headers" or "Internal Server Error"?

First idea (possibly relevant to you): 

Well the most common reason is that the script does not have the proper
permissions. What's probably happening is that when run on the command
line, the script has the same permissions you do, but when run on the
server, its permissions are equal to the permissions that the server
has. 

Second idea (which I suspect may be a problem for you if you are tinkering
with this on a box you don't have control over):

One other issue which may arise is that the file you want to execute
must be owned by the same user who owns the directory.

Hope this helps!



__________________________________________________
FREE voicemail, email, and fax...all in one place.
Sign Up Now! http://www.onebox.com

~sdpm~

The posting address is: san-diego-pm-list@hfb.pm.org

List requests should be sent to: majordomo@hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to  with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to  .
This is the general rule for most mailing lists when you need
to contact a human.


From astewart at spawar.navy.mil  Fri Feb 25 20:17:11 2000
From: astewart at spawar.navy.mil (Alan Stewart)
Date: Thu Aug  5 00:19:56 2004
Subject: email
In-Reply-To: <3.0.4.32.20000225135720.007a4b50@cts.com>
References: <38B6D1A0.BBAA2375@binev.com>
Message-ID: <20000226021711.GCPV22732.mail.rdc1.sdca.home.com@cx465707-a>

~sdpm~
Your ISP's reply does in fact indicate that they have sendmail and that it is located at 
"usr/lib/sendmail", however, even if you get it to work, you might want to follow Russ' suggestion 
to use the Perl Net::SMTP module. It will give you more control on building email and avoid 
using the external sendmail program altogether (which means it will work somewhere sendmail 
doesn't exist). It's relatively simple and it's the "all-Perl" solution.

On 25 Feb 00, at 13:57, Joel Fentin wrote:

Date sent:      	Fri, 25 Feb 2000 13:57:20 -0800
To:             	san-diego-pm-list@happyfunball.pm.org
From:           	Joel Fentin 
Subject:        	Re: email

> ~sdpm~
> CHRIS:
> >What happens when you run the script from the command line or in -w
> >mode?
> 
> I am not sure what you are asking. By command line do you mean
> telnet? If so, they (Verio) will not let me telnet. If you mean
> something else, please spell it out. 
> ===================
> >Just off the top of my head, you need to escape the @ in
> joel@cts.com so
> >Perl doesn't think you're referencing an array, 
> 
> Do you mean joel\@cts.com ?
> ===================
> >and you should check if
> >your open statement actually works, like thus:
> > 
> >open (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg") or die "yipes!";
> 
> I added  or die "yipes!" to the program and ran it again. The
> window in netscape said: internal server error. Here is the error
> log:
> 
> /u/web/theede/cgi-local/MailTest.pl
> apache: [Fri Feb 25 14:03:00
> 2000] [error] [client 204.94.75.117] File does not exist:
> /u/web/theede/stats/statistics/
> apache: [Fri Feb 25 14:45:50
> 2000] [error] [client 204.94.75.117] Premature end of script
> headers: /u/web/theede/cgi-local/MailTest.pl
> =====================
> >
> >It looks like the path might be invalid (what OS is this under?) so
> >check if /USER/LIB/sendmail actually exists.
> 
> This is from a page called cgi_scripts.cfm:
> 
> If a script calls another file within your account, but the
> script does NOT require a
>                     URL, you need to use the system path. Instead
> of using the absolute path to
>                     your home directory ("/www26/web/someid"),
> you should instead use the
>                     DOCUMENT_ROOT environment variable
> ($ENV{DOCUMENT_ROOT} in Perl) to
>                     determine the path of your files or programs
> within a script.
> 
>                          Change this:
> /www23/web/yourid/data/fact.html
>                          To this:
> $ENV{DOCUMENT_ROOT}/data/fact.html
> 
>                          The system path to the sendmail program
> on our UNIX server is
>                          /usr/lib/sendmail 
>                          The system path to the date command on
> our UNIX server is /sbin/date 
> ========================
> RUSS:
> 
> >I would think this script would work, so long as:
> >
> >1. You are running on a UNIX machine (unless sendmail is 
> >available on other machines);
> 
> I think the above indicates it is a unix machine. I don't
> understand what you mean by other machines.
> 
> >and
> >
> >2. Your UNIX machine is configured to use sendmail, and that you 
> >have permissions to execute it, and that it does indeed reside at 
> >/USER/LIB/sendmail
> 
> The above seems to indicate that's where it is. Verio seems
> hostile to perl. I had to ask the Verio support twice if email
> works with a perl script. They admitted that it does, but there
> is no support for perl. There are oodles of help pages for HTML
> and not a word about perl.
> ======================
> PARLAND
> 
> >  I just put together an automated mailing script.....
> 
> Thank you but I need to learn to do this in perl. My current
> application involves a special purpose mail merge program.
> --
> Joel Fentin    tel: 760-749-8863    FAX: 760-749-8864
>  
> email: joel@cts.com     web: http://efm.simplenet.com
> ~sdpm~
> 
> The posting address is: san-diego-pm-list@hfb.pm.org
> 
> List requests should be sent to: majordomo@hfb.pm.org
> 
> If you ever want to remove yourself from this mailing list,
> you can send mail to  with the following
> command in the body of your email message:
> 
>     unsubscribe san-diego-pm-list
> 
> If you ever need to get in contact with the owner of the list,
> (if you have trouble unsubscribing, or have questions about the
> list itself) send email to  .
> This is the general rule for most mailing lists when you need
> to contact a human.


---------------------------------------------------------------
Alan Stewart          )-[]-(           Electronics Engineer
Code D621           ~        ~         Network Operations
SPAWARSYSCEN       ~          ~  \     Satellite Communications
53560 Hull St   ( ~            ~  )    tel (619)524-3625
San Diego,CA  __|___             /|    fax (619)524-2607
92152-5001   ^\____/^^^^^^\    __| |_  astewart@spawar.navy.mil
------------^^^^^^^^^^^^^^^\__|______|_------------------------
~sdpm~

The posting address is: san-diego-pm-list@hfb.pm.org

List requests should be sent to: majordomo@hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to  with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to  .
This is the general rule for most mailing lists when you need
to contact a human.


From astewart at spawar.navy.mil  Fri Feb 25 20:22:35 2000
From: astewart at spawar.navy.mil (Alan Stewart)
Date: Thu Aug  5 00:19:56 2004
Subject: CGI email (was Re: email)
In-Reply-To: <20000226004425.CMBX28925.mta02.onebox.com@onebox.com>
Message-ID: <20000226022235.GFOI22732.mail.rdc1.sdca.home.com@cx465707-a>

~sdpm~
A CGI script doesn't have to return any HTTP doc, which means no content headers needed. 
The email is going out a different protocol than the web stuff. However, in a real script, 
something ought to be returned or the user will not know if anything happened. The mail may (or 
may not) be sent and the web page would not change after the button was clicked. Usually a 
"Confirmed" page is returned.

On 25 Feb 00, at 16:44, Bruce Timberlake wrote:

Date sent:      	Fri, 25 Feb 2000 16:44:25 -0800
Subject:        	CGI email (was Re: email)
From:           	"Bruce Timberlake" 
To:             	san-diego-pm-list@happyfunball.pm.org

> ~sdpm~
> ---- Joel Fentin  wrote:
> > Per your suggestions the program line now reads:
> > 
> > open (SENDMAIL,"|/user/lib/sendmail -oi -t -odg") || die "yipes!";
> 
> It's still wrong.  Should be /usr/lib/sendmail -- no "e" in /usr
> 
> Also, I think you need to do something special with your output
> since you're doing it from CGI (as opposed to straight Perl) -- I am
> not a CGI whiz, so I'm not sure, but I think you have to put some type
> of "Content: text/plain" in there before you start any other output,
> even though you're not outputting to a web page...
> 
> Hope this helps!
> 
> Bruce
> 
> __________________________________________________
> FREE voicemail, email, and fax...all in one place.
> Sign Up Now! http://www.onebox.com
> 
> ~sdpm~
> 
> The posting address is: san-diego-pm-list@hfb.pm.org
> 
> List requests should be sent to: majordomo@hfb.pm.org
> 
> If you ever want to remove yourself from this mailing list,
> you can send mail to  with the following
> command in the body of your email message:
> 
>     unsubscribe san-diego-pm-list
> 
> If you ever need to get in contact with the owner of the list,
> (if you have trouble unsubscribing, or have questions about the
> list itself) send email to  .
> This is the general rule for most mailing lists when you need
> to contact a human.


---------------------------------------------------------------
Alan Stewart          )-[]-(           Electronics Engineer
Code D621           ~        ~         Network Operations
SPAWARSYSCEN       ~          ~  \     Satellite Communications
53560 Hull St   ( ~            ~  )    tel (619)524-3625
San Diego,CA  __|___             /|    fax (619)524-2607
92152-5001   ^\____/^^^^^^\    __| |_  astewart@spawar.navy.mil
------------^^^^^^^^^^^^^^^\__|______|_------------------------
~sdpm~

The posting address is: san-diego-pm-list@hfb.pm.org

List requests should be sent to: majordomo@hfb.pm.org

If you ever want to remove yourself from this mailing list,
you can send mail to  with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to  .
This is the general rule for most mailing lists when you need
to contact a human.


From cabney at cyberpass.net  Fri Feb 25 12:46:28 2000
From: cabney at cyberpass.net (C. Abney)
Date: Thu Aug  5 00:19:56 2004
Subject: email
In-Reply-To: <3.0.4.32.20000225103258.0079c290@cts.com>
Message-ID: 

~sdpm~
On Fri, 25 Feb 2000, Joel Fentin wrote:

> apache: [Wed Feb 23 21:03:16 2000] [error] [client 204.94.75.117]
> script not found or unable to stat:
> /u/web/theede/cgi-local/mailtest.pl

> apache: [Wed Feb 23 21:03:46
> 2000] [error] [client 204.94.75.117] Premature end of script
> headers:
> /u/web/theede/cgi-local/MailTest.pl

Hi,

Ok, the others have done most of the work, but I just want to add a 
couple of my own comments.  If you'll notice how I separated the
above text, you provided us with two error messages from your apache
error log (you have access to the error log of the web-server. That's
Good!!!)  In the first entry it looks like you tried to access the
wrong file.  Remember, Unix is Case-Sensitive and you should always
be watching for errors like that.  The second message may or may not
have been a successful execution of your perl script (I'm not too 
sure about this it's been awhile) but because you used the cut down
version of the script maybe(?) there is NO text provided to the web-
server to return to the browser.  You might want to send a happy
message to your surfer-user (and yourself ) indicating the status
of the attempted email.

I've indicated a few additions (minus the changes everyone else suggests,
you should of course abide by their word as well.) This is just bare
bones, someone else might suggest a better way to catch your errors,
but this'll at least keep you focused on the content of your pages.
I'd suggest putting the contents of '$!' into your page but you wouldn't
want to do that for something you planned on putting up on the web .

================================================================
> #!/usr/local/bin/perl
> use CGI qw(:cgi-lib :standard);
> 

print	"Content-type: text/html\n\n",
	"Mail Results\n
\n"; > open > (SENDMAIL,"|/USER/LIB/sendmail -oi -t -odg") # I removed the above trailing semicolon for this: or print "

Problems, contact your administrator.

\n"; > print SENDMAIL > <<"EOF"; > From: joel@cts.com > To: joel@cts.com > Subject: Mail > Test > > This is the message body. > > EOF > close (SENDMAIL) # trailing semicolon also trimmed above... or print "

Wierd error, contact your administrator.

\n"; print "

Transaction Complete

\n
\n\n"; ================================================================ CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Fri Feb 25 14:50:29 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: die, was (Re: CGI email) In-Reply-To: <200002260136.UAA28581@happyfunball.pm.org> Message-ID: ~sdpm~ On Fri, 25 Feb 2000, Russ Schnapp wrote: > Presumably, you are talking more about the "die" statement's > output. Yes, the "yipes!" output would NOT make a browser very > happy. wtf??? Where the heck is die printing, anyway? And why doesn't this work like (I think) it should?: ============================================================ #! /usr/bin/perl -w open STDOUT, "> foo.out.txt" or die "Couldn't open outfile!!!: $!\n"; # not sure where this goes open STDERR, "> foo.err.txt" or die "Couldn't open errfile!!!: $!\n"; # not sure where this goes open SENDMAIL, "| /usr/LIB/sendmail -t" or die "AAAUUUUUGGGGHHHHH!!!: $!\n"; # respects to Sparky Schulz print SENDMAIL "I have a dream!\n" # Respects to the Reverend or die "It turned out to be a nightmare...: $!\n"; close SENDMAIL; ============================================================ CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rlssdpm at schnapp.org Fri Feb 25 23:52:36 2000 From: rlssdpm at schnapp.org (Russ Schnapp) Date: Thu Aug 5 00:19:56 2004 Subject: die Message-ID: <200002260547.AAA29466@happyfunball.pm.org> ~sdpm~ > wtf??? Where the heck is die printing, anyway? And why doesn't this > work like (I think) it should?: Actually, I'm not sure where STDERR is redirected to when invoked by an httpd under CGI. STDOUT will end up going back to the client's browser, which is why you need to emit the "content:" header, or whatever, before you print anything else to STDOUT. Reviewing die(), I see that "yipes!" will end up going to STDERR. Perhaps that goes to the web server's error log. It sure would be nice if you could get the the server to redirect it to STDOUT. Then again, I guess there's nothing preventing you from redirecting STDERR yourself, *before* doing anything hinky. Hmmmm... Okay, I know how to do that in C. How do you do that in PERL? ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From sander at mp3.com Sat Feb 26 00:17:35 2000 From: sander at mp3.com (Sander van Zoest) Date: Thu Aug 5 00:19:56 2004 Subject: die, was (Re: CGI email) In-Reply-To: Message-ID: ~sdpm~ On Fri, 25 Feb 2000, C. Abney wrote: > > Presumably, you are talking more about the "die" statement's > > output. Yes, the "yipes!" output would NOT make a browser very > > happy. > wtf??? Where the heck is die printing, anyway? And why doesn't this > work like (I think) it should?: any Carp() will be output to STDERR which in the case of a cgi script the error log. Any STDOUT by default would go to the web client, although this might not always be the case (mod_perl might not, unless you are using Apache::Registry () ) You might want to look into CGI::Carp qw(fatalsToBrower) which is great on a dev server where you want to see these messages. Alternatively you can look into the Apache ScriptLog directive to debug your CGI scripts. CGI::Carp will provide the appropriate Content-Type header to make browers happy. Usually the server prints a "500 Internal Server Error" status and doesn't print your broken script output to the user for security reasons. For modperl info see http://perl.apache.org/guide/porting.html#die_and_mod_perl Cheers, - Sander van Zoest sander@mp3.com High Geek (858) 623-7442 MP3.com, Inc. http://www.mp3.com/ Your premiere Music Service Provider (MSP) ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 26 04:10:20 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:56 2004 Subject: die, was (Re: CGI email) In-Reply-To: Message-ID: ~sdpm~ On Fri, 25 Feb 2000, Sander van Zoest wrote: > On Fri, 25 Feb 2000, C. Abney wrote: > > wtf??? Where the heck is die printing, anyway? And why doesn't this > > work like (I think) it should?: > > any Carp() will be output to STDERR which in the case of a cgi script the > error log. Any STDOUT by default would go to the web client, although > this might not always be the case (mod_perl might not, unless you > are using Apache::Registry () ) Well, I was trying to capture the error output and bend it to my will, as it were. But I don't get my 'die' text in the foo.err.txt of that little code snippet I provided: # this makes it into the (STDERR redirect) error file die "AAAEEEUUUUUGGGGHHHHH!!!: $!\n" unless ( -x "/usr/LIB/sendmail" ); # this doesn't. I get the bog standard error # but only with warnings on. open SENDMAIL, "| /usr/LIB/sendmail -t" or die "AAAUUUUUGGGGHHHHH!!!: $!\n"; I assumed die would send it's argument (string) to STDERR. This doesn't seem to happen when making a system call. Do I need to trap something? CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From mike at heckman.net Sat Feb 26 13:36:56 2000 From: mike at heckman.net (mike@heckman.net) Date: Thu Aug 5 00:19:56 2004 Subject: die, was (Re: CGI email) In-Reply-To: References: Message-ID: ~sdpm~ On Sat, 26 Feb 2000 02:10:20 -0800 (PST), C. Abney wrote: >~sdpm~ >On Fri, 25 Feb 2000, Sander van Zoest wrote: >> On Fri, 25 Feb 2000, C. Abney wrote: > >> > wtf??? Where the heck is die printing, anyway? And why doesn't this >> > work like (I think) it should?: >> >> any Carp() will be output to STDERR which in the case of a cgi script the >> error log. Any STDOUT by default would go to the web client, although >> this might not always be the case (mod_perl might not, unless you >> are using Apache::Registry () ) > >Well, I was trying to capture the error output and bend it to my will, >as it were. But I don't get my 'die' text in the foo.err.txt of that >little code snippet I provided: > > # this makes it into the (STDERR redirect) error file > die "AAAEEEUUUUUGGGGHHHHH!!!: $!\n" > unless ( -x "/usr/LIB/sendmail" ); > > # this doesn't. I get the bog standard error > # but only with warnings on. > open SENDMAIL, "| /usr/LIB/sendmail -t" > or die "AAAUUUUUGGGGHHHHH!!!: $!\n"; > >I assumed die would send it's argument (string) to STDERR. This doesn't >seem to happen when making a system call. Do I need to trap something? The problem is that on opens that contain a pipe, the return value is the process id of the spawned shell. Therefore, testing the value of the open directly will always return true. What you need to do is check the status of the child return value after you've closed the piped open. The code should look something like: open (SENDMAIL, "|/usr/LIB/sendmail -t"); print SENDMAIL "To: test\@testing.tst\nSubject: Hi!\n\nText Body"; close SENDMAIL; if ($?) { die "Error sending mail"; } Hope this helps, -Mike --- perl -e 'print map{chr($x+=$_)}(74,43,-2,1,-84,33,45,1,5,-12,-3,13,-82,48,21,13\ ,-6,-76,40,25,2,8,-6,13,-104)' ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 26 07:05:03 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:57 2004 Subject: die, was (Re: CGI email) In-Reply-To: Message-ID: ~sdpm~ On Sat, 26 Feb 2000 mike@heckman.net wrote: > The problem is that on opens that contain a pipe, the return value is > the process id of the spawned shell. Therefore, testing the value of > the open directly will always return true. What you need to do is > check the status of the child return value after you've closed the > piped open. The code should look something like: Wasn't thinking I guess, (I new a fork() occurs for any system() call with the redirection symbols.) I should have looked a little more carefully, first. I found 'perldoc perlopentut', which explains it all. Thanks... CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From joel at cts.com Sat Feb 26 22:30:14 2000 From: joel at cts.com (Joel Fentin) Date: Thu Aug 5 00:19:57 2004 Subject: email (at last) Message-ID: <3.0.4.32.20000226203014.007ded80@cts.com> ~sdpm~ #!/usr/local/bin/perl use CGI qw(:cgi-lib :standard); print "Content-type: text/plain\n\n"; open (SENDMAIL,"|/usr/lib/sendmail -oi -t -odq") || die "yipes!"; print SENDMAIL <<"EOF"; From: joel\@cts.com To: joel\@cts.com Subject: Mail Test This is the message body. EOF close (SENDMAIL); ============================================ I finally got it working. Main changes since last time are: -odq instead of -odg joel\@cts.com instead of joel@cts.com Thank you all. Current anomalies are: A message box that says "Document contains no data." An attempted data transfer until I click the message box. I will continue to experiment with your ideas. I am impressed by the volume of mail my request generated. -- Joel Fentin tel: 760-749-8863 FAX: 760-749-8864 email: joel@cts.com web: http://efm.simplenet.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From rschnapp at ACM.org Sat Feb 26 23:38:51 2000 From: rschnapp at ACM.org (Russ Schnapp) Date: Thu Aug 5 00:19:57 2004 Subject: email (at last Message-ID: <200002270533.AAA04259@happyfunball.pm.org> ~sdpm~ Congrats! The reason you are getting back a message about an empty document is quite simple. All you are returning is the content header. You aren't returning anything to actually display! Decide on what html you want to be returned when this CGI script is invoked, and emit that. The easiest way is through a "here" doc, e.g., by adding the following to the end of your script: print < Thank you!

Thank you!

Your form has been successfully submitted.

END ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From cabney at cyberpass.net Sat Feb 26 16:40:38 2000 From: cabney at cyberpass.net (C. Abney) Date: Thu Aug 5 00:19:57 2004 Subject: email (at last) In-Reply-To: <3.0.4.32.20000226203014.007ded80@cts.com> Message-ID: ~sdpm~ On Sat, 26 Feb 2000, Joel Fentin wrote: > I finally got it working. Main changes since last time are: > -odq instead of -odg The really lame thing about that is the -o options aren't in (my) sendmail man page... ( that and I was too lazy to chase down the document referred to in the man page.) CA -- Einstein himself said that God doesn't roll dice. But he was wrong. And in fact, anyone who has played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein. -- Larry Wall C. Abney ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human. From eugenet at mailcity.com Sun Feb 27 02:51:49 2000 From: eugenet at mailcity.com (Eugene Tsyrklevich) Date: Thu Aug 5 00:19:57 2004 Subject: "here" docs Message-ID: ~sdpm~ here docs are very easy to break and are very hard to debug.. qq() and friends should be used instead (http://www.perl.com/CPAN-local/doc/manual/html/pod/perlop.html#Quote_and_Quote_like_Operators) print qq{blah blah blah}; cheers. -- On Sat, 26 Feb 2000 21:38:51 Russ Schnapp wrote: >~sdpm~ > >Congrats! > >The reason you are getting back a message about an empty >document is quite simple. All you are returning is the content >header. You aren't returning anything to actually display! > >Decide on what html you want to be returned when this CGI script >is invoked, and emit that. The easiest way is through a "here" doc, >e.g., by adding the following to the end of your script: > >print < > >Thank you! > > >

Thank you!

>

Your form has been successfully submitted.

> > >END MailCity. Secure Email Anywhere, Anytime! http://www.mailcity.com ~sdpm~ The posting address is: san-diego-pm-list@hfb.pm.org List requests should be sent to: majordomo@hfb.pm.org If you ever want to remove yourself from this mailing list, you can send mail to with the following command in the body of your email message: unsubscribe san-diego-pm-list If you ever need to get in contact with the owner of the list, (if you have trouble unsubscribing, or have questions about the list itself) send email to . This is the general rule for most mailing lists when you need to contact a human.