From oneiros at dcr.net Mon Jan 1 13:25:46 2001 From: oneiros at dcr.net (Joe Hourcle) Date: Thu Aug 5 00:05:58 2004 Subject: [UKLUG] Re: LPM: unless ($line =~ /^#/) In-Reply-To: <3A4D52C8.92384279@rcbowen.com> Message-ID: On Fri, 29 Dec 2000, Rich Bowen wrote: > Ronald Edward Petty wrote: > > > > so can u do > > unless() > > { > > } > > else > > { > > } > > > > and else be the say the opposite? kinda like if. > > Well, yes, you can do unless, else, but it seems rather backwards. It's > good style to program as you would speak or think. unless ... else is > potentially confusing, and I would think that it would be a good idea to > avoid it. Unless may be great for throw-away programs, where you're trying to code quick, but as you can always negate the test in your condition, it's normally easier to maintain when you always use 'if'. Besides, it's fewer keystrokes to type: if ($line !~ /^#/) vs. unless ($line =~ /^#/) ----- Joe Hourcle From rbowen at rcbowen.com Mon Jan 1 15:05:29 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Monday Message-ID: <3A50F119.CFB3053B@rcbowen.com> Monday, Jan 8, 2001. Getting a Date with Perl. UK, Whitehall Classroom Building, room 208. Be there. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From wsheldahl at qx.net Tue Jan 2 08:09:52 2001 From: wsheldahl at qx.net (Wesley) Date: Thu Aug 5 00:05:58 2004 Subject: [UKLUG] Re: LPM: unless ($line =~ /^#/) References: Message-ID: <3A51E130.4BC4D5C@qx.net> > > Well, yes, you can do unless, else, but it seems rather backwards. It's > > good style to program as you would speak or think. unless ... else is > > potentially confusing, and I would think that it would be a good idea to > > avoid it. I would agree here. If you're going to have an else clause, you could probably just as well put the else clause first under an "if." > Unless may be great for throw-away programs, where you're trying to code > quick, but as you can always negate the test in your condition, it's > normally easier to maintain when you always use 'if'. > > Besides, it's fewer keystrokes to type: > > if ($line !~ /^#/) > > vs. > unless ($line =~ /^#/) > > ----- > Joe Hourcle If the boolean expression is that simple, you're probably right. If the if clause is more complex, then I think the unless is often more readable: if (not($hairy_compound_boolean_expression)) { vs. unless ($hairy_compound_boolean_expression) { That removes a set of parentheses and should still be readable. Assuming there's no else at the end of it though, because the else would give a better opportunity to clarify. I can think of a more confusing structure: unless (...) { ... } elsif (...) { ... elsif (...) { ... } else { ... } :-) -- Wes Sheldahl wsheldahl@qx.net From llang at baywestpaper.com Tue Jan 2 08:11:00 2001 From: llang at baywestpaper.com (llang@baywestpaper.com) Date: Thu Aug 5 00:05:58 2004 Subject: [UKLUG] Re: LPM: unless ($line =~ /^#/) Message-ID: > I can think of a more confusing structure: > > unless (...) { > ... > } > elsif (...) { > ... > elsif (...) { > ... > } > else { > ... > } > > :-) > You need a nap! :-) Loren From rbowen at rcbowen.com Tue Jan 2 08:26:12 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: [UKLUG] Re: LPM: unless ($line =~ /^#/) References: <3A51E130.4BC4D5C@qx.net> Message-ID: <3A51E504.99ACA4CB@rcbowen.com> > > Unless may be great for throw-away programs, where you're trying to code > > quick, but as you can always negate the test in your condition, it's > > normally easier to maintain when you always use 'if'. > > > > Besides, it's fewer keystrokes to type: > > > > if ($line !~ /^#/) > > > > vs. > > unless ($line =~ /^#/) > > > > ----- > > Joe Hourcle > > If the boolean expression is that simple, you're probably right. If the > if clause is more complex, then I think the unless is often more > readable: > > if (not($hairy_compound_boolean_expression)) { > > vs. > > unless ($hairy_compound_boolean_expression) { > > That removes a set of parentheses and should still be readable. > Assuming there's no else at the end of it though, because the else would > give a better opportunity to clarify. Particularly when you are doing statement modifiers, unless leads to very consise and readable code. next unless $line; Which would be cumbersome using if. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From janine at emazing.com Tue Jan 2 10:24:10 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: RE: Monday In-Reply-To: <3A50F119.CFB3053B@rcbowen.com> Message-ID: I'm taking a class this semester. It meets on Monday evenings at 5:30 pm, so I won't be able to make it to any meetings until after finals. See ya in June, everyone. :-) Janine > -----Original Message----- > From: owner-lexington-pm-list@pm.org > [mailto:owner-lexington-pm-list@pm.org]On Behalf Of Rich Bowen > Sent: Monday, January 01, 2001 4:05 PM > To: Lexington Perl Mongers > Subject: LPM: Monday > > > Monday, Jan 8, 2001. Getting a Date with Perl. UK, Whitehall Classroom > Building, room 208. Be there. > > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.idforgetmyhead.com/ > > From rbowen at rcbowen.com Tue Jan 2 10:50:46 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: RE: Monday References: Message-ID: <3A5206E6.A3F560AA@rcbowen.com> Janine wrote: > > I'm taking a class this semester. It meets on Monday evenings at 5:30 pm, so I won't be able to make it to any meetings until after > finals. > > See ya in June, everyone. :-) Bah. There's another reason to come up with a better time to meet. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From rbowen at rcbowen.com Sun Jan 7 20:40:37 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Web site sucks Message-ID: <3A5928A5.EF7D6355@rcbowen.com> Our web site (lexington.pm.org) is really crummy. If any of you folks are at all talented in the area of design, and have any interest in sprucing up the site, please let me know. I'd be delighted to let someone else have a shot at it. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From dpitts at mk.net Sun Jan 7 21:40:18 2001 From: dpitts at mk.net (David Pitts) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Re: Web site sucks References: <3A5928A5.EF7D6355@rcbowen.com> Message-ID: <003e01c07924$b988aea0$7801a8c0@adverb.com> Current URL?? Thanks, David David Pitts President and CEO PTRI www.AboveAndBeyondProgramming.com dpitts@AboveAndBeyondProgramming.com ----- Original Message ----- From: "Rich Bowen" To: "Lexington Perl Mongers" Sent: Sunday, January 07, 2001 9:40 PM Subject: LPM: Web site sucks > Our web site (lexington.pm.org) is really crummy. If any of you folks > are at all talented in the area of design, and have any interest in > sprucing up the site, please let me know. I'd be delighted to let > someone else have a shot at it. > > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.idforgetmyhead.com/ From rbowen at rcbowen.com Sun Jan 7 21:47:24 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Re: Web site sucks References: <3A5928A5.EF7D6355@rcbowen.com> <003e01c07924$b988aea0$7801a8c0@adverb.com> Message-ID: <3A59384C.A1CADA12@rcbowen.com> David Pitts wrote: > > Current URL?? ... > ----- Original Message ----- > From: "Rich Bowen" > > Our web site (lexington.pm.org) is really crummy. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From arm3 at lex.infi.net Mon Jan 8 06:21:30 2001 From: arm3 at lex.infi.net (AlMarzian) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Web site sucks References: <3A5928A5.EF7D6355@rcbowen.com> Message-ID: <3A59B0B7.CF3672D8@lex.infi.net> Here's a few changes. Any other changes will take adding gifs, tables and such. You don't have much content, so there isn't much need for a fancy site. The linen background will look nearly white IE. I might play around some more with it. Al Rich Bowen wrote: > Our web site (lexington.pm.org) is really crummy. If any of you folks > are at all talented in the area of design, and have any interest in > sprucing up the site, please let me know. I'd be delighted to let > someone else have a shot at it. > > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.idforgetmyhead.com/ From rbowen at rcbowen.com Mon Jan 8 12:14:36 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Web site sucks References: <3A5928A5.EF7D6355@rcbowen.com> <3A59B0B7.CF3672D8@lex.infi.net> Message-ID: <3A5A038C.3B7DCD7F@rcbowen.com> AlMarzian wrote: > > Here's a few changes. Here where? -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From repett0 at sweb.uky.edu Mon Jan 8 12:21:40 2001 From: repett0 at sweb.uky.edu (Ronald Edward Petty) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: room? Message-ID: Have u been ok with the room so far in whitehall. Im getting lug and acm to get off their collective ass and get in gear, starting by getting a new room with a nice projector hookups etc... I will inform u of how this goes. Ron From janine at emazing.com Mon Jan 8 12:29:16 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:58 2004 Subject: LPM: Web site sucks In-Reply-To: <3A5A038C.3B7DCD7F@rcbowen.com> Message-ID: Hee hee, I was wondering that too. Perhaps a missing attachment? I do that all the time. :-) Janine > -----Original Message----- > From: owner-lexington-pm-list@pm.org > [mailto:owner-lexington-pm-list@pm.org]On Behalf Of Rich Bowen > Sent: Monday, January 08, 2001 1:15 PM > To: lexington-pm-list@happyfunball.pm.org > Subject: Re: LPM: Web site sucks > > > AlMarzian wrote: > > > > Here's a few changes. > Here where? > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.idforgetmyhead.com/ > > From rbowen at rcbowen.com Mon Jan 8 12:27:24 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: room? References: Message-ID: <3A5A068C.6CBE82A6@rcbowen.com> Ronald Edward Petty wrote: > > Have u been ok with the room so far in whitehall. Im getting lug and acm > to get off their collective ass and get in gear, starting by getting a new > room with a nice projector hookups etc... I will inform u of how this > goes. It's nice, albeit a little cold and large. Something more cozy, personal, and food-friendly will be a nice move, as time goes on. However, I'd very much like to reopen the discussion of time of meeting, so that Janine (and anyone else that is not coming due to scheduling problems) can start coming again. By the way, I'd like to get an idea of who's coming this evening. I don't want a repeat performance of last month. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From repett0 at sweb.uky.edu Mon Jan 8 12:31:51 2001 From: repett0 at sweb.uky.edu (Ronald Edward Petty) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: room? In-Reply-To: <3A5A068C.6CBE82A6@rcbowen.com> Message-ID: 1) can't make it tonight, dont get off work till late 2) tolly ho is cozy and has food jk Im going to go talk to Prof. Douglas about using the meeting room on the top floor of mcvey hall. Internet 2 connections, projectors, not the most modern room but it will be nicer, lot smaller etc.. Ron On Mon, 8 Jan 2001, Rich Bowen wrote: > Ronald Edward Petty wrote: > > > > Have u been ok with the room so far in whitehall. Im getting lug and acm > > to get off their collective ass and get in gear, starting by getting a new > > room with a nice projector hookups etc... I will inform u of how this > > goes. > > It's nice, albeit a little cold and large. Something more cozy, > personal, and food-friendly will be a nice move, as time goes on. > > However, I'd very much like to reopen the discussion of time of meeting, > so that Janine (and anyone else that is not coming due to scheduling > problems) can start coming again. > > By the way, I'd like to get an idea of who's coming this evening. I > don't want a repeat performance of last month. > > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.idforgetmyhead.com/ > From gcasillo at ket.org Mon Jan 8 14:00:47 2001 From: gcasillo at ket.org (Gregg Casillo) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: room? References: <3A5A068C.6CBE82A6@rcbowen.com> Message-ID: <3A5A1C6F.4030005@ket.org> I'll be in attendance a few minutes past six. Gregg Casillo Web Programmer, KET Rich Bowen wrote: > Ronald Edward Petty wrote: > >> Have u been ok with the room so far in whitehall. Im getting lug and acm >> to get off their collective ass and get in gear, starting by getting a new >> room with a nice projector hookups etc... I will inform u of how this >> goes. > > > It's nice, albeit a little cold and large. Something more cozy, > personal, and food-friendly will be a nice move, as time goes on. > > However, I'd very much like to reopen the discussion of time of meeting, > so that Janine (and anyone else that is not coming due to scheduling > problems) can start coming again. > > By the way, I'd like to get an idea of who's coming this evening. I > don't want a repeat performance of last month. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/lexington-pm/attachments/20010108/5d681abb/attachment.htm From hempy at ket.org Mon Jan 8 14:38:34 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Monday In-Reply-To: <3A50F119.CFB3053B@rcbowen.com> Message-ID: <5.0.0.25.0.20010108153739.03c03e98@mail.ket.org> At 04:05 PM 1/1/2001 -0500, you wrote: >Monday, Jan 8, 2001. Getting a Date with Perl. UK, Whitehall Classroom >Building, room 208. Be there. > >-- >Rich Bowen -- Director of Web Application Development >http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com >Have trouble remembering things? http://www.idforgetmyhead.com/ I will be there. What time is it, and should I come hungry? -dave -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764 From rbowen at rcbowen.com Mon Jan 8 15:22:36 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Monday References: <5.0.0.25.0.20010108153739.03c03e98@mail.ket.org> Message-ID: <3A5A2F9C.4872E5EB@rcbowen.com> David Hempy wrote: > > At 04:05 PM 1/1/2001 -0500, you wrote: > >Monday, Jan 8, 2001. Getting a Date with Perl. UK, Whitehall Classroom > >Building, room 208. Be there. > I will be there. > > What time is it, and should I come hungry? 6pm. And, well, the room is not very condusive to ordering food. The last few times we've just finished earlier than usual, and not had a meal with the meeting. Which is one of the reasons that I'd like to move to some other room. And, again, many thanks to Ron for the room, but we're aware that it has its problems. Which is to say, you probably don't want to come hungry. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From hempy at ket.org Mon Jan 8 15:33:54 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Monday In-Reply-To: <3A5A2F9C.4872E5EB@rcbowen.com> References: <5.0.0.25.0.20010108153739.03c03e98@mail.ket.org> Message-ID: <5.0.0.25.0.20010108163213.03839e80@mail.ket.org> At 04:22 PM 1/8/2001 -0500, you wrote: >David Hempy wrote: > >6pm. >And, well, the room is not very condusive to ordering food. The last few >times we've just finished earlier than usual, and not had a meal with >the meeting. Which is one of the reasons that I'd like to move to some >other room. And, again, many thanks to Ron for the room, but we're aware >that it has its problems. >Which is to say, you probably don't want to come hungry. Might be fun to stroll over to Tolly-Ho afterward. Any recommendations on parking? I'm assuming it's not bad, since UK is still out, right? -dave -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764 From rbowen at rcbowen.com Mon Jan 8 15:46:22 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Monday References: <5.0.0.25.0.20010108153739.03c03e98@mail.ket.org> <5.0.0.25.0.20010108163213.03839e80@mail.ket.org> Message-ID: <3A5A352E.644DEB2F@rcbowen.com> David Hempy wrote: > > At 04:22 PM 1/8/2001 -0500, you wrote: > >David Hempy wrote: > > > >6pm. > >And, well, the room is not very condusive to ordering food. The last few > >times we've just finished earlier than usual, and not had a meal with > >the meeting. Which is one of the reasons that I'd like to move to some > >other room. And, again, many thanks to Ron for the room, but we're aware > >that it has its problems. > >Which is to say, you probably don't want to come hungry. > > Might be fun to stroll over to Tolly-Ho afterward. > > Any recommendations on parking? I'm assuming it's not bad, since UK is > still out, right? Right. You can probably get parking on the circle. Tell the guy at the gate that you are there for a technical meeting in Whitehall, and he'll give you a pass for your car. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.idforgetmyhead.com/ From arm3 at lex.infi.net Mon Jan 8 17:15:35 2001 From: arm3 at lex.infi.net (AlMarzian) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Web site sucks References: <3A5928A5.EF7D6355@rcbowen.com> <3A59B0B7.CF3672D8@lex.infi.net> <3A5A038C.3B7DCD7F@rcbowen.com> Message-ID: <3A5A4A14.C863F41F@lex.infi.net> Skipped content of type multipart/alternative-------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/lexington-pm/attachments/20010108/f227fbaf/lexington.pm.html From rbowen at rcbowen.com Tue Jan 9 06:37:15 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: [Fwd: An Evening With Larry Wall] Message-ID: <3A5B05FB.E68184D1@rcbowen.com> I'm not sure if this went through, since I got a "non-member submission" bounce for it. -------- Original Message -------- Subject: An Evening With Larry Wall Date: Tue, 9 Jan 2001 01:48:29 -0500 From: "Bradley M. Kuhn" To: dayton-pm-list@happyfunball.pm.org, louisville-pm-list@happyfunball.pm.org,lexington-pm-list@happyfunball.pm.org,columbus-pm-list@happyfunball.pm.org CC: conmara@oaktree.net [Please redistribute this announcement widely wherever appropriate.] An Evening With Larry Wall Designer of the Perl Programming Language Monday, January 22, 2001, 8:00 pm at the University of Cincinnati Engineering Research Building (ERC) Auditorium (Room 427) This Event Is Open To The Public presented by the Cincinnati GNU/Linux Users Group and the University of Cincinnati For More Information Contact: Bradley M. Kuhn at larry-visit@cglug.org or Jeff Gilton (513)899-2030 or see our Web Site: http://www.cglug.org From gcasillo at ket.org Tue Jan 9 12:16:48 2001 From: gcasillo at ket.org (Gregg Casillo) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: [Fwd: An Evening With Larry Wall] References: <3A5B05FB.E68184D1@rcbowen.com> Message-ID: <3A5B5590.7010306@ket.org> I'll definitely make the trip up for this. I'd offer a ride to other interested folks, but I'll probably drop by my parents' home there in Cincy before the meeting. A word of warning: give yourselves time to get there and seek out parking. I don't know if UC will be holding classes by that date, but it can be difficult finding your way around Clifton if you haven't been there before. The 8:00pm start should help though. Gregg Rich Bowen wrote: > I'm not sure if this went through, since I got a "non-member submission" > bounce for it. > > -------- Original Message -------- > Subject: An Evening With Larry Wall > Date: Tue, 9 Jan 2001 01:48:29 -0500 > From: "Bradley M. Kuhn" > To: dayton-pm-list@happyfunball.pm.org, > louisville-pm-list@happyfunball.pm.org,lexington-pm-list@happyfunball.pm.org,columbus-pm-list@happyfunball.pm.org > CC: conmara@oaktree.net > > [Please redistribute this announcement widely wherever appropriate.] > > An Evening With > Larry Wall > Designer of the Perl Programming Language > > Monday, January 22, 2001, 8:00 pm > > at the > University of Cincinnati > Engineering Research Building (ERC) > Auditorium (Room 427) > > This Event Is Open To The Public > > presented by the > Cincinnati GNU/Linux Users Group > and the > University of Cincinnati > > For More Information Contact: > Bradley M. Kuhn at larry-visit@cglug.org > or Jeff Gilton (513)899-2030 > or see our Web Site: http://www.cglug.org > > From janine at emazing.com Thu Jan 11 15:18:00 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: CGI question In-Reply-To: <3A5A2F9C.4872E5EB@rcbowen.com> Message-ID: I'm trying to figure out the best way of telling whether a script was invoked through a browser or from the command line. Right now I'm checking if ENV{"HTTP_HOST"} exists (yes = browser; no = command line). Does anyone know of a better way to do this? Thanks! Janine From hempy at ket.org Thu Jan 11 15:27:55 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: CGI question In-Reply-To: References: <3A5A2F9C.4872E5EB@rcbowen.com> Message-ID: <5.0.0.25.0.20010111162449.020f17a0@mail.ket.org> At 04:18 PM 1/11/2001 -0500, you wrote: >I'm trying to figure out the best way of telling whether a script was >invoked through a browser or from the command line. Right now >I'm checking if ENV{"HTTP_HOST"} exists (yes = browser; no = command >line). Does anyone know of a better way to do this? > >Thanks! >Janine That is precisely how I do it. -dave ps. Not quite related, but FWIW: On occasion, I will forego using CGI for quick-and-dirty cgi scripts that need minimal parameter support: if ($ENV{SERVER_URL} =~ /preview/) { ## do different stuff } Probably doesn't save any trees in practice, but what the heck. -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764 From oneiros at dcr.net Thu Jan 11 16:04:58 2001 From: oneiros at dcr.net (Joe Hourcle) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: CGI question In-Reply-To: Message-ID: On Thu, 11 Jan 2001, Janine wrote: > I'm trying to figure out the best way of telling whether a script was > invoked through a browser or from the command line. Right now I'm > checking if ENV{"HTTP_HOST"} exists (yes = browser; no = command > line). Does anyone know of a better way to do this? Technically, HTTP_HOST is set only by browsers which support software virtual hosts. [As first generation browsers don't send a Host: header] Unless you know your server will set HTTP_HOST to null if they don't send the header [mine won't -- an old Netscape Enterprise 3.0 server], you'd be better off checking something that's more likely to be there: REMOTE_ADDR REQUEST_METHOD SERVER_NAME SERVER_PROTOCOL Personally, I go with REMOTE_ADDR, as it's needed for the web server to reply back to the browser. ----- Joe Hourcle From janine at emazing.com Tue Jan 16 15:29:26 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: CGI question In-Reply-To: Message-ID: Thanks, Joe. That helped a lot. :-) Janine > -----Original Message----- > From: owner-lexington-pm-list@pm.org > [mailto:owner-lexington-pm-list@pm.org]On Behalf Of Joe Hourcle > Sent: Thursday, January 11, 2001 5:05 PM > To: lexington-pm-list@happyfunball.pm.org > Subject: Re: LPM: CGI question > > > > > On Thu, 11 Jan 2001, Janine wrote: > > > I'm trying to figure out the best way of telling whether a script was > > invoked through a browser or from the command line. Right now I'm > > checking if ENV{"HTTP_HOST"} exists (yes = browser; no = command > > line). Does anyone know of a better way to do this? > > Technically, HTTP_HOST is set only by browsers which support software > virtual hosts. [As first generation browsers don't send a Host: header] > > Unless you know your server will set HTTP_HOST to null if they don't send > the header [mine won't -- an old Netscape Enterprise 3.0 server], you'd be > better off checking something that's more likely to be there: > > REMOTE_ADDR > REQUEST_METHOD > SERVER_NAME > SERVER_PROTOCOL > > Personally, I go with REMOTE_ADDR, as it's needed for the web server to > reply back to the browser. > > ----- > Joe Hourcle > > From rbowen at rcbowen.com Sun Jan 21 14:56:40 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Tomorrow night Message-ID: <3A6B4D08.EB1856B3@rcbowen.com> Is anyone else going up to Cincinatti for Larry's talk tomorrow? There's a contingent going from Wilmore, and we'd be pleased to carpool or caravan with anyone else that's going. We're doing a dinner thing before the event, and hope to convince Larry to have coffee, or desserts, or something, after the event with us. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.mymissinghead.com/ From cbearse at iglou.com Mon Jan 22 14:29:15 2001 From: cbearse at iglou.com (COURTNEY V BEARSE) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Tomorrow night In-Reply-To: <3A6B4D08.EB1856B3@rcbowen.com> Message-ID: A couple of us from UKLUG are going up. Where are you guys having dinner? courtneyb On Sun, 21 Jan 2001, Rich Bowen wrote: > Is anyone else going up to Cincinatti for Larry's talk tomorrow? There's > a contingent going from Wilmore, and we'd be pleased to carpool or > caravan with anyone else that's going. We're doing a dinner thing before > the event, and hope to convince Larry to have coffee, or desserts, or > something, after the event with us. > > -- > Rich Bowen -- Director of Web Application Development > http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com > Have trouble remembering things? http://www.mymissinghead.com/ > > From hempy at ket.org Mon Jan 22 21:30:50 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: "on break" processing in perl? Message-ID: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> I keep running into the situation where I am reading rows from a database, presenting the rows in groups and subgroups. For example: select coursenumber, sectionnumber, ssnum from studentview This might return: CS101, 1, 000-00-1111 CS101, 1, 000-00-2222 CS101, 1, 000-00-3333 CS101, 2, 000-00-4444 CS101, 2, 000-00-5555 CS117, 1, 000-00-1111 CS117, 1, 000-00-9999 I would like to display something like: CS101: 7 students Section 1: 3 students 000-00-1111 000-00-2222 000-00-3333 Section 2: 2 students 000-00-4444 000-00-5555 CS117: 2 students Section 1: 2 students 000-00-1111 000-00-9999 (Actually, I am usually plugging these into HTML tables, but the idea is the same.) I would like to do something like: while fetch { on break in $coursenumber print count($coursenumber); on break in $sectionnumber print "\t" . count($sectionnumber); print "\t\t $ssnum"; } It's not so hard to generate the breaks by setting $last_sectionnumber each time after comparing the current $sectionnumber to the $last_sectionnumber. That would suffice if I just wanted a
or similar between each group. It becomes more problematic when I want to telepathically print the subtotals before I've stepped through the data. I've gotten around this in the past by building up little chunks of the output in different scalars, then outputting all the little pieces in the right order when the group changes. I then have to repeat this break processing again after the loop exits, assuming that any were found at all. Ugh. Double that for two-level grouping. Double ugh. I have in some programs saved the break lines with "~SUBTOTAL~" in it, then do a s/~SUBTOTAL~/$subtotal/ later. Effective, but embarassing. Anyone have any tips or methods to share? I have a suspicion I should separate analysis and presentation into two passes, with some combination of arrays/hashes between the two. I think I'll cipher on that for a while... -dave -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764 From janine at emazing.com Mon Jan 22 21:48:51 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: RE: "on break" processing in perl? In-Reply-To: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> Message-ID: Sounds like you're trying to emulate the features of reporting software. I do this all the time - and you should know, Dave, because I talk to you about work all the time. (Anyone know the emoticon for pouting?) I use multidimensional hashes. Then you just nest a few for loops and do what you will with the data inside the innermost loop. Makes it easy to do subtotals, tallies, etc, too. I can send code snippets if anyone's interested. Janine > -----Original Message----- > From: owner-lexington-pm-list@pm.org > [mailto:owner-lexington-pm-list@pm.org]On Behalf Of David Hempy > Sent: Monday, January 22, 2001 10:31 PM > To: Perl Geeks > Subject: LPM: "on break" processing in perl? > > > > I keep running into the situation where I am reading rows from a > database, > presenting the rows in groups and subgroups. For example: > > select coursenumber, sectionnumber, ssnum > from studentview > > This might return: > > CS101, 1, 000-00-1111 > CS101, 1, 000-00-2222 > CS101, 1, 000-00-3333 > CS101, 2, 000-00-4444 > CS101, 2, 000-00-5555 > CS117, 1, 000-00-1111 > CS117, 1, 000-00-9999 > > > I would like to display something like: > > CS101: 7 students > Section 1: 3 students > 000-00-1111 > 000-00-2222 > 000-00-3333 > Section 2: 2 students > 000-00-4444 > 000-00-5555 > CS117: 2 students > Section 1: 2 students > 000-00-1111 > 000-00-9999 > > > (Actually, I am usually plugging these into HTML tables, but the idea is > the same.) > > I would like to do something like: > > while fetch { > on break in $coursenumber > print count($coursenumber); > on break in $sectionnumber > print "\t" . count($sectionnumber); > > print "\t\t $ssnum"; > } > > > It's not so hard to generate the breaks by setting > $last_sectionnumber each > time after comparing the current $sectionnumber to the > $last_sectionnumber. That would suffice if I just wanted a
> or similar > between each group. It becomes more problematic when I want to > telepathically print the subtotals before I've stepped through the data. > > I've gotten around this in the past by building up little chunks of the > output in different scalars, then outputting all the little pieces in the > right order when the group changes. I then have to repeat this break > processing again after the loop exits, assuming that any were found at > all. Ugh. Double that for two-level grouping. Double ugh. > > I have in some programs saved the break lines with "~SUBTOTAL~" > in it, then > do a s/~SUBTOTAL~/$subtotal/ later. Effective, but embarassing. > > > Anyone have any tips or methods to share? I have a suspicion I should > separate analysis and presentation into two passes, with some combination > of arrays/hashes between the two. I think I'll cipher on that > for a while... > > > -dave > > -- > David Hempy > Internet Database Administrator > Kentucky Educational Television > -- (859)258-7164 -- (800)333-9764 > > > From hempy at ket.org Mon Jan 22 22:31:28 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: RE: "on break" processing in perl? In-Reply-To: References: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> Message-ID: <5.0.0.25.0.20010122232909.05464860@mail.ket.org> At 10:48 PM 1/22/2001 -0500, you wrote: >Sounds like you're trying to emulate the features of reporting software. I >do this all the time - and you should know, Dave, because I talk to you >about work all the time. (Anyone know the emoticon for pouting?) How about: :~( >I use multidimensional hashes. Then you just nest a few for loops and do >what you will with the data inside the innermost loop. Makes it easy to do >subtotals, tallies, etc, too. > >I can send code snippets if anyone's interested. I don't know about anyone else, but I'd sure like to see them. I am currently on p.270 of Learning Perl: References and Nested Data Structures. Sound about right? :-) -dave -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764 From rbowen at rcbowen.com Tue Jan 23 08:36:07 2001 From: rbowen at rcbowen.com (Rich Bowen) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Tomorrow night References: Message-ID: <3A6D96D7.F8C421CC@rcbowen.com> COURTNEY V BEARSE wrote: > > A couple of us from UKLUG are going up. Where are you guys having dinner? > courtneyb Um, were you there? I got this message when we were already on the way up. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.mymissinghead.com/ From cbearse at iglou.com Tue Jan 23 08:36:20 2001 From: cbearse at iglou.com (Courtney V. Bearse) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: Tomorrow night In-Reply-To: <3A6D96D7.F8C421CC@rcbowen.com> Message-ID: sure was... -----Original Message----- From: owner-lexington-pm-list@pm.org [mailto:owner-lexington-pm-list@pm.org]On Behalf Of Rich Bowen Sent: Tuesday, January 23, 2001 9:36 AM To: lexington-pm-list@happyfunball.pm.org Subject: Re: LPM: Tomorrow night COURTNEY V BEARSE wrote: > > A couple of us from UKLUG are going up. Where are you guys having dinner? > courtneyb Um, were you there? I got this message when we were already on the way up. -- Rich Bowen -- Director of Web Application Development http://www.cre8tivegroup.com/ -- rich@cre8tivegroup.com Have trouble remembering things? http://www.mymissinghead.com/ From sml at zfx.com Tue Jan 23 09:26:05 2001 From: sml at zfx.com (Steve Lane) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: "on break" processing in perl? References: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> Message-ID: <3A6DA28D.41C6@zfx.com> a hash of hashes of lists is what you want here, with one step for stuffing the hash with data and another step to print the data. the HoHoL will be: hash (with coursenumber as key) of hashes (with sectionnumber as key) of lists (of ssnums) my code (tested) is below. note that the syntax of deferencing multidim data structures looks hairy to almost everyone until they get used to it. but getting used to it is a vital thing to do if you want to use Perl. #!/usr/bin/perl # data structure: # hash (coursenumber as key) # of hashes (sectionnumber as key) # of lists (of ssnums) my %data; # overall data structure. another name would be better. # stuff data into %data while () { chomp; my($course, $section, $ss) = split /,\s+/; push @{ $data{$course}{$section} }, $ss; } # print data for my $course (sort keys %data) { my %sections = %{ $data{$course} }; # save typing my $num_students = sum( map scalar @{ $sections{$_} }, keys %sections ); print "$course: $num_students students\n"; for my $section (sort { $a <=> $b } keys %sections) { my @ss = @{ $sections{$section} }; my $num_students = @ss; print "\tSection $section: $num_students students\n"; for my $ss (sort @ss) { print "\t\t$ss\n"; } } } sub sum { my $sum; $sum += $_ for @_; $sum } __DATA__ CS101, 1, 000-00-1111 CS101, 1, 000-00-2222 CS101, 1, 000-00-3333 CS101, 2, 000-00-4444 CS101, 2, 000-00-5555 CS117, 1, 000-00-1111 CS117, 1, 000-00-9999 __END__ David Hempy wrote: > > I keep running into the situation where I am reading rows from a database, > presenting the rows in groups and subgroups. For example: > > select coursenumber, sectionnumber, ssnum > from studentview > > This might return: > > CS101, 1, 000-00-1111 > CS101, 1, 000-00-2222 > CS101, 1, 000-00-3333 > CS101, 2, 000-00-4444 > CS101, 2, 000-00-5555 > CS117, 1, 000-00-1111 > CS117, 1, 000-00-9999 > > I would like to display something like: > > CS101: 7 students > Section 1: 3 students > 000-00-1111 > 000-00-2222 > 000-00-3333 > Section 2: 2 students > 000-00-4444 > 000-00-5555 > CS117: 2 students > Section 1: 2 students > 000-00-1111 > 000-00-9999 > > (Actually, I am usually plugging these into HTML tables, but the idea is > the same.) > > I would like to do something like: > > while fetch { > on break in $coursenumber > print count($coursenumber); > on break in $sectionnumber > print "\t" . count($sectionnumber); > > print "\t\t $ssnum"; > } > > It's not so hard to generate the breaks by setting $last_sectionnumber each > time after comparing the current $sectionnumber to the > $last_sectionnumber. That would suffice if I just wanted a
or similar > between each group. It becomes more problematic when I want to > telepathically print the subtotals before I've stepped through the data. > > I've gotten around this in the past by building up little chunks of the > output in different scalars, then outputting all the little pieces in the > right order when the group changes. I then have to repeat this break > processing again after the loop exits, assuming that any were found at > all. Ugh. Double that for two-level grouping. Double ugh. > > I have in some programs saved the break lines with "~SUBTOTAL~" in it, then > do a s/~SUBTOTAL~/$subtotal/ later. Effective, but embarassing. > > Anyone have any tips or methods to share? I have a suspicion I should > separate analysis and presentation into two passes, with some combination > of arrays/hashes between the two. I think I'll cipher on that for a while... > > -dave > > -- > David Hempy > Internet Database Administrator > Kentucky Educational Television > -- (859)258-7164 -- (800)333-9764 -- Steve Lane From wsheldahl at qx.net Tue Jan 23 10:33:29 2001 From: wsheldahl at qx.net (Wesley) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: RE: "on break" processing in perl? References: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> <5.0.0.25.0.20010122232909.05464860@mail.ket.org> Message-ID: <3A6DB259.BA0F8E99@qx.net> David Hempy wrote: > > At 10:48 PM 1/22/2001 -0500, you wrote: > >Sounds like you're trying to emulate the features of reporting software. I > >do this all the time - and you should know, Dave, because I talk to you > >about work all the time. (Anyone know the emoticon for pouting?) > > How about: > > :~( > > Janine wrote: > >I use multidimensional hashes. Then you just nest a few for loops and do > >what you will with the data inside the innermost loop. Makes it easy to do > >subtotals, tallies, etc, too. > > > >I can send code snippets if anyone's interested. > > I don't know about anyone else, but I'd sure like to see them. > > -dave Multidimensional hashes sounds like a good approach. I'd also be interested in the code snippets if you care to share. Thanks! -- Wes Sheldahl wsheldahl@qx.net From janine at emazing.com Tue Jan 23 14:23:15 2001 From: janine at emazing.com (Janine) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: RE: "on break" processing in perl? In-Reply-To: <5.0.0.25.0.20010122232909.05464860@mail.ket.org> Message-ID: Regarding Dave's reporting woes, here's my solution. (In the real world I'd use fetchrow_array to populate %mdh, of course.) Steve, your program was much more Perlish than mine. Thanks for posting it. Janine ---------------------------------------- #!/usr/bin/perl -w use strict; ## the brussel sprouts of Perl programming my %mdh = (); ## mdh = MultiDimensional Hash $mdh{'CS101'}{'1'}{'000-00-1111'} = 1; $mdh{'CS101'}{'1'}{'000-00-2222'} = 1; $mdh{'CS101'}{'1'}{'000-00-3333'} = 1; $mdh{'CS101'}{'2'}{'000-00-4444'} = 1; $mdh{'CS101'}{'2'}{'000-00-5555'} = 1; $mdh{'CS117'}{'1'}{'000-00-1111'} = 1; $mdh{'CS117'}{'1'}{'000-00-9999'} = 1; my $course; my $section; my $ssn; my $buf_ssn; ## temporary buffer for printing my $buf_sec; ## another print buffer - need one for each level of grouping except the outmost my $section_tot = 0; my $course_tot = 0; foreach $course (sort keys %mdh) { print "Course $course: "; $course_tot = 0; $buf_sec = ""; foreach $section (sort keys %{$mdh{$course}}) { $buf_sec .= "\tSection $section: "; $section_tot = 0; $buf_ssn = ""; foreach $ssn (sort keys %{$mdh{$course}{$section}}) { $buf_ssn .= "\t\t$ssn\n"; $section_tot++; } $buf_sec .= "$section_tot students\n"; $buf_sec .= $buf_ssn; $course_tot += $section_tot; } print "$course_tot students\n"; print $buf_sec; } From oneiros at dcr.net Thu Jan 25 08:53:45 2001 From: oneiros at dcr.net (Joe Hourcle) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: "on break" processing in perl? In-Reply-To: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> Message-ID: On Mon, 22 Jan 2001, David Hempy wrote: > > I keep running into the situation where I am reading rows from a database, > presenting the rows in groups and subgroups. For example: > > select coursenumber, sectionnumber, ssnum > from studentview > > This might return: > > CS101, 1, 000-00-1111 > CS101, 1, 000-00-2222 > CS101, 1, 000-00-3333 > CS101, 2, 000-00-4444 > CS101, 2, 000-00-5555 > CS117, 1, 000-00-1111 > CS117, 1, 000-00-9999 > > > I would like to display something like: > > CS101: 7 students > Section 1: 3 students > 000-00-1111 > 000-00-2222 > 000-00-3333 > Section 2: 2 students > 000-00-4444 > 000-00-5555 > CS117: 2 students > Section 1: 2 students > 000-00-1111 > 000-00-9999 > > > (Actually, I am usually plugging these into HTML tables, but the idea is > the same.) This is just the sort of thing that PHP and ColdFusion are for. [Although it could be done in Perl, it never hurts to learn a few new tricks]. I'm not familiar with all of the PHP syntax myself, but I know in coldfusion you'd want: SELECT coursenumber,sectionnumber,ssnum FROM studentview ORDER BY coursenumber,sectionnumber,ssnum (coursenumber heading goes here) (sectionnumber heading goes here) (each record to display) (sectionnumber footing) (coursenumber footing) I'm guessing it'd be something rather similar in PHP. ----- Joe Hourcle From hempy at ket.org Thu Jan 25 13:01:03 2001 From: hempy at ket.org (David Hempy) Date: Thu Aug 5 00:05:59 2004 Subject: LPM: "on break" processing in perl? In-Reply-To: References: <5.0.0.25.0.20010122214439.020dc9b0@mail.ket.org> Message-ID: <5.0.0.25.0.20010125140011.01e53b58@mail.ket.org> At 09:53 AM 1/25/2001 -0500, you wrote: >This is just the sort of thing that PHP and ColdFusion are for. >[Although it could be done in Perl, it never hurts to learn a few new >tricks]. > >I'm not familiar with all of the PHP syntax myself, but I know in >coldfusion you'd want: > Pretty slick! Cold Fusion has been on my "To Learn" list for about two years now...maybe I should get around to it. -dave > > SELECT coursenumber,sectionnumber,ssnum > FROM studentview > ORDER BY coursenumber,sectionnumber,ssnum > > >(coursenumber heading goes here) > >(sectionnumber heading goes here) > >(each record to display) > >(sectionnumber footing) > >(coursenumber footing) > > > > > >I'm guessing it'd be something rather similar in PHP. > >----- >Joe Hourcle -- David Hempy Internet Database Administrator Kentucky Educational Television -- (859)258-7164 -- (800)333-9764