From humbaba9 at yahoo.com Fri Feb 1 14:14:05 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <20020109162921.80908.qmail@web21002.mail.yahoo.com> Message-ID: <20020201201405.89880.qmail@web12801.mail.yahoo.com> 2/1/02 Hi CK, I just wanted to thank you for speaking up. I spent at least 1 hour each week trying to recontact this recruiter (leaving multiple messages, waiting on hold). Over 2.5 months I figure it was collectively about 15 hours. Here's the quote from your email: > Anyway, if anybody has dealt with this recruiter and > has had success, please let me know, maybe I'm wrong > about him. He called me after the postings went out about him (someone must have informed him). He said he called me because I listed SPUG on my resume. I read some comments out of the emails without naming names - he tried to get me to name names, even mentioned one to me. He also tried to get me to repost to the SPUG list saying that he jobs are real. I told him all he had to do was get me an interview or one of us a job and everyone would know. Haven't heard from him since. I notice that no one else has posted to SPUG that they've ever gotten so much as an interview from him, either. Anyway, I'm grateful to you because now I'm putting the time I used to use trying to contact him to better use. thanks, Meryll --- c k wrote: > Has anybody had success with this recruiter? > > Cazy Green > Greythorn Inc. > 40 Lake Bellevue > Suite 100 > Bellevue, WA 98005 > cazy.green@... > > He's always looking for somebody with Perl skills on > a > particular job board, in fact in one of his ads he > recently states, "I need 12 Perl GURU's". Yet, when > I > call him up, he use stalling tactics or doesn't even > take your number to return your call, you have to > call > him. After calling him several times, I said f#$k > this, he ain't looking for nobody. > > Someday, I'm thinking of just sending him a real > hyped > up resume, that has no value. > > Anyway, if anybody has dealt with this recruiter and > has had success, please let me know, maybe I'm wrong > about him. > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Fri Feb 1 16:00:33 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Guaranteed Return On Your Investment In-Reply-To: <1012575281.0515628072@mail.alta-comm.ca> Message-ID: Hooray!!!! The mail list software at pm.org has been modified to pass through the incoming SMTP Received headers. This means, for those crafting procmail recipes, we (each individually) can have a little more control over how much junk mail reaches the SPUG folder. If you don't know what any of this means, it might not be helpful information to you. On Fri, 1 Feb 2002, Conferencing@alta-comm.ca wrote: > WEALTH WITHOUT RISK! -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Fri Feb 1 16:15:05 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Guaranteed Return On Your Investment In-Reply-To: ; from Andrew Sweger on Fri, Feb 01, 2002 at 02:00:33PM -0800 References: <1012575281.0515628072@mail.alta-comm.ca> Message-ID: <20020201141505.B4951@timji.consultix.wa.com> On Fri, Feb 01, 2002 at 02:00:33PM -0800, Andrew Sweger wrote: > Hooray!!!! > > The mail list software at pm.org has been modified to pass through the > incoming SMTP Received headers. This means, for those crafting procmail > recipes, we (each individually) can have a little more control over how > much junk mail reaches the SPUG folder. Yes, and I'll take the credit for that, thank you very much 8-} I'm also currently working on inserting 8,333 regexes, contributed by SpamBuster extraordinaire Bob Campbell, into majordomo's "taboo header and taboo body" in an attempt to catch *much* more SPAM. Of course, we'll also filter more legitimate messages by accident 8-}, so please be patient while the fine-tuning process is going on. -Tim ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Fri Feb 1 16:21:44 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Guaranteed Return On Your Investment In-Reply-To: <20020201141505.B4951@timji.consultix.wa.com> Message-ID: On Fri, 1 Feb 2002, Tim Maher wrote: > On Fri, Feb 01, 2002 at 02:00:33PM -0800, Andrew Sweger wrote: > > The mail list software at pm.org has been modified to pass through the > > incoming SMTP Received headers. This means, for those crafting procmail > > recipes, we (each individually) can have a little more control over how > > much junk mail reaches the SPUG folder. > > Yes, and I'll take the credit for that, thank you very much 8-} You're welcome. :> -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From douglas at slugstone.net Fri Feb 1 16:39:07 2002 From: douglas at slugstone.net (Douglas Kirkland) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: finding the permissions Message-ID: <0202011439070M.20059@mooky.kennel> I am trying to find the permission on a file. For some reason 'File::Copy' does not keep the same permission on the file that I am trying to copy. So I would like to get the permission of the file so I can set the file permission. Maybe I missed something with File::Copy. Douglas - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From douglas at slugstone.net Fri Feb 1 16:46:34 2002 From: douglas at slugstone.net (Douglas Kirkland) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Guaranteed Return On Your Investment In-Reply-To: <20020201141505.B4951@timji.consultix.wa.com> References: <1012575281.0515628072@mail.alta-comm.ca> <20020201141505.B4951@timji.consultix.wa.com> Message-ID: <0202011446340N.20059@mooky.kennel> On Friday 01 February 2002 02:15 pm, you wrote: > On Fri, Feb 01, 2002 at 02:00:33PM -0800, Andrew Sweger wrote: > > Hooray!!!! > > > > The mail list software at pm.org has been modified to pass through the > > incoming SMTP Received headers. This means, for those crafting procmail > > recipes, we (each individually) can have a little more control over how > > much junk mail reaches the SPUG folder. > > Yes, and I'll take the credit for that, thank you very much 8-} > > I'm also currently working on inserting 8,333 regexes, contributed by > SpamBuster extraordinaire Bob Campbell, into majordomo's "taboo header > and taboo body" in an attempt to catch *much* more SPAM. Of course, > we'll also filter more legitimate messages by accident 8-}, so please > be patient while the fine-tuning process is going on. > > -Tim Something else that you could do is filter out all email that is send to 'spug-list@pm.org' via Cc or Bcc. Most spam that I know of is 'cc' or 'bcc'. Douglas - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From kjk122 at dreamwiz.com Fri Feb 1 16:45:51 2002 From: kjk122 at dreamwiz.com (=?ks_c_5601-1987?B?wvy1yMH2tbXA2rimw6O0wrjwwNM=?=) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: =?ks_c_5601-1987?B?W8irurhdwfa1tcDaIMPfw7UnIML8v6nHz7HiIC0gMsW6?= Message-ID: <3c5b19bd3ca4ba98@relay4.kornet.net> (added by relay4.kornet.net) '??? ??' ???? ???? ???? ?? ?? ?? ?? ?? ????. spug-list?? ????(spug-list@pm.org)? ? ????(http://www.perl.com/CPAN-local/modules/by-authors/00whois.html)?? ?? ??? ??? ????. ????? ???? ??? ???? ? ??? ?? ???? ? site?? ???? ????? ??????, ??? ????? ??????. ???? --> ???? ??? ???, ??????! '?? ???? ?? ??' ??? ?? 1? 19??? ????? '??? ?? ????' ???? ?? ??? ? ????????. ???? ??? ??? ??? ?? ????, ???? ??? ???? ??, ? ????? ??? ? ?? '?? ???' 'CEO ???'? ??? ???? ?????. ??? ???? ? ?? ? ???, ??? ???? ?? ?? ?? TV ??? ???? ???, ?? ??? ??? ???/?? ???/???? ???/?? ??? ? ????? ????? ???. '?? ???? ?? ??' ??(http://cafe.daum.net.TrueLeader)? '???'? ???, ??? ???(??)??? ?? 3? ??? ??? ?? ??? ???, '????'?? ?? ??? ??????. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020202/cd335818/attachment.htm From cjcollier at pobox.com Fri Feb 1 17:11:47 2002 From: cjcollier at pobox.com (C.J. Collier) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: finding the permissions In-Reply-To: <0202011439070M.20059@mooky.kennel> Message-ID: see 'perldoc -f stat' excerpt: stat FILEHANDLE stat EXPR stat Returns a 13-element list giving the status info for a file, either the file opened via FILEHANDLE, or named by EXPR. If EXPR is omitted, it stats $_. Returns a null list if the stat fails. Typi- cally used as follows: ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($filename); (stat(FH))[2] will have the information about the mode (type & permissions) of the file. @info = stat("foo.txt"); printf("%04o\n", $info[2] & 0777); This will print the mode (for instance 0664) Hope this helps, C.J. On Fri, 1 Feb 2002, Douglas Kirkland wrote: > I am trying to find the permission on a file. For some reason 'File::Copy' > does not keep the same permission on the file that I am trying to copy. So I > would like to get the permission of the file so I can set the file permission. > > Maybe I missed something with File::Copy. > > Douglas > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Fri Feb 1 17:02:02 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: finding the permissions Message-ID: <200202012302.PAA00396@carios2.ca.boeing.com> > I am trying to find the permission on a file. > For some reason 'File::Copy' does not keep the same permission > on the file that I am trying to copy. So I would like to get > the permission of the file so I can set the file permission. > Maybe I missed something with File::Copy. Here's a hint from the docs (perldoc -f stat) : $mode = (stat($filename))[2]; printf "Permissions are %04o\n", $mode & 07777; You can reset the umask if that's the culprit in permissions transfer problem (perldoc -f umask). rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Fri Feb 1 21:05:19 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Re: finding the permissions References: <0202011439070M.20059@mooky.kennel> Message-ID: <003a01c1ab96$74abba20$3b88ddd1@aciwin> What you are seeing is expected behavior. On Unix and most other operating systems every process (running program) has a set of permissions associated with it that are assigned to any new file the process creates. (Copying a file means you are creating a new file with the same contents as the source file.) As Charles points out, you can control this set of permissions by resetting the process umask before creating any new files. If you are on a Unix system you can play with this feature from the command line: umask touch newfile ls -l newfile umask 072 touch newfile2 ls -l newfile* umask 022 # or whatever the first umask command showed Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Douglas Kirkland" To: "Seattle Perl Users Group" Sent: Friday, February 01, 2002 2:39 PM Subject: SPUG: finding the permissions > I am trying to find the permission on a file. For some reason 'File::Copy' > does not keep the same permission on the file that I am trying to copy. So I > would like to get the permission of the file so I can set the file permission. > > Maybe I missed something with File::Copy. > > Douglas > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From douglas at slugstone.net Fri Feb 1 22:45:35 2002 From: douglas at slugstone.net (Douglas Kirkland) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: finding the permissions In-Reply-To: References: Message-ID: <0202012045350R.20059@mooky.kennel> Thank for the information. When I normally copy a file the permissiom of the file get copied also. I did not think it would be any different in perl. I was wrong. I was able to get the information I needed from below. I just not see that the mode contain the file permissions. When I converted the mode to octal then I saw the permission. I happening to be writting a script that copies many file to another location with different permission. The permissions need to match with the orginal file. I was not seeing how in the world to get the file permissioms from a file. Here is what I needed. ($file_mode) = ( 07777 & (stat($file))[2]); copy($file,$file2); chmod( $file_mode, $file2); Thanks everyone, Douglas > > (stat(FH))[2] will have the information about the mode (type & > permissions) of the file. > > @info = stat("foo.txt"); > printf("%04o\n", $info[2] & 0777); > > This will print the mode (for instance 0664) > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ksontag at riverdeep.net Mon Feb 4 15:10:04 2002 From: ksontag at riverdeep.net (Kris Sontag) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: A new Perl magazine Message-ID: <67E0C02C5097884AA0F25B5AC7C3CB560120EC53@damocles> Hi all, Sorry if this has been mentioned already but I just stumbled across this. It looks like the Perl Mongers are trying to get a new Perl magazine going to fill the void left by The Perl Journal. Check out the premiere, on-line only issue here: http://www.perl.org/ThePerlReview/ Thanks, Kris Sontag [ksontag@riverdeep.net] Web Systems Administrator Riverdeep, home of the Edmark brand -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020204/317c5c1f/attachment.htm From asimjalis at yahoo.com Mon Feb 4 16:27:55 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Perl2Exe Alternative Message-ID: <20020204222755.21068.qmail@web14206.mail.yahoo.com> Is there a free alternative to perl2exe? Basically I want to bundle up a perl program with the interpreter into one executable, containing all the modules I need, containing the interpreter and also my code. This is so I can give my program to people who don't have perl installed on their machines without forcing them to do a separate 5MB download of the perl environment. Assuming that a free perl2exe does not exist, does anyone have suggestions on how to do this? Asim __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jay at Scherrer.com Tue Feb 5 10:51:02 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Perl2Exe Alternative In-Reply-To: <20020204222755.21068.qmail@web14206.mail.yahoo.com> References: <20020204222755.21068.qmail@web14206.mail.yahoo.com> Message-ID: <200202051651.g15Gp4W02493@localhost.localdomain> Try perlcc, I found that perlcc is bundled with Perl it self. What it does is run your perl code through a c compiler to make an executable. I did have a hard time with Tk scripts though. check the perldocs on perlcc. Jay Quod erat demonstrandum (``That which was to be shown''). On Monday 04 February 2002 02:27 pm, Asim Jalis wrote: > Is there a free alternative to perl2exe? > > Basically I want to bundle up a perl program with > the interpreter into one executable, containing > all the modules I need, containing the interpreter > and also my code. This is so I can give my program > to people who don't have perl installed on their > machines without forcing them to do a separate 5MB > download of the perl environment. > > Assuming that a free perl2exe does not exist, does > anyone have suggestions on how to do this? > > > Asim > > __________________________________________________ > Do You Yahoo!? > Great stuff seeking new owners in Yahoo! Auctions! > http://auctions.yahoo.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From BBrockha at starbucks.com Tue Feb 5 10:51:31 2002 From: BBrockha at starbucks.com (Bob Brockhausen) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print Message-ID: Does anyone know which $var to set to print out more than one line when matching?? I can't remember nor find it in Camel book... I tried to "if (/being_pat/ .. /end_pat/) { print "$_\n"} but this print each line seperatly, I want to handle them as one single scalar not seperate scalars (as in above example) --- Hailing frequencies closed ---------------------------------------------------------------------------- Bob Brockhausen Phone: 206-318-6413 PO Box 34067 S-IT2 Pager: 206-810-3707 Seattle Wash 98124-1067 Fax: 206-318-2371 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Tue Feb 5 12:56:23 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print In-Reply-To: ; from Bob Brockhausen on Tue, Feb 05, 2002 at 08:51:31AM -0800 References: Message-ID: <20020205105623.B3119@timji.consultix.wa.com> On Tue, Feb 05, 2002 at 08:51:31AM -0800, Bob Brockhausen wrote: > Does anyone know which $var to set to print > out more than one line when matching?? I can't There ain't no such thing! 8-} > remember nor find it in Camel book... > I tried to if (/being_pat/ .. /end_pat/) { print "$_\n"} I think you want: $context=""; if (/begin_pat/ .. /end_pat/) { $context .= "$_\n" } print $context; The only variable that I can think of that's relevant is the one allowing you to read/match/print entire paragraphs at a time: $/="". But that's appropriate for printing entire paragraphs that contain a match, not for printing all lines within a range of matching patterns, as you've shown above. > but this print each line seperatly, I want to handle > them as one single scalar not seperate scalars > (as in above example) > > --- Hailing frequencies closed > ---------------------------------------------------------------------------- > Bob Brockhausen Phone: 206-318-6413 > PO Box 34067 S-IT2 Pager: 206-810-3707 > Seattle Wash 98124-1067 Fax: 206-318-2371 -- *==============================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | tim@consultix-inc.com www.consultix-inc.com www.softwareprofessor.com | | FEB: Perl; APR: Shell; Int. & OO Perl; Perl DataBase; JUNE: Basic UNIX, Perl | *------------------------------------------------------------------------------* | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle, 7/15-18 | | Adv. OOP * Adv. Module Implementation Techniques * Programming in Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Tue Feb 5 12:57:39 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: A new Perl magazine Message-ID: <20020205105739.A3225@timji.consultix.wa.com> On Mon, Feb 04, 2002 at 01:10:04PM -0800, Kris Sontag wrote: > Hi all, > > Sorry if this has been mentioned already but I just stumbled across this. It > looks like the Perl Mongers are trying to get a new Perl magazine going to > fill the void left by The Perl Journal. Check out the premiere, on-line only > issue here: http://www.perl.org/ThePerlReview/ > > Thanks, > Kris Sontag [ksontag@riverdeep.net] > Web Systems Administrator > Riverdeep, home of the Edmark brand Just a quick note to clarify the situation. The Perl Journal is *still* in existence, although harder to spot these days, now that the dot-bomb-triggered depletion of advertising revenues has relegated it to the status of a quarterly "appendix" to Sys Admin magazine. So the "void" mentioned above is much more apparent than real. While I encourage SPUGsters to enjoy the benefits of all the Perl-oriented publications they can find, I *exhort* them to continue supporting The Perl Journal! This publication has a fantastic track record of providing up to date and authoritative info on the Perl world, and is produced by some of the best minds in our community (not to mention my candidate for the Best Technical Editor of his Generation, Jon O.!) Just look at the masthead from the 12/2001 issue: SENIOR CONTRIBUTING EDITOR: Jon Orwant. CONTRIBUTING EDITORS: Chris Nandor, Damian Conway, Dan Brian, Sean Burke, and Simon Cozens. With our continued support, and an anticipated rebound in advertising revenue as the economy turns around, TPJ should eventually reappear as a magazine in its own right, and grow to its former size. It would be a great shame if the historically strong support of the Perl community for TPJ were to become fragmented in the direction of other Perl publications, some of which might have the attraction of being (temporarily) free, and ultimately cause TPJ to fold. Don't get me wrong, I'm all for competition and alternative sources of information, but let's be careful not to burn our bridges behind us; if TPJ, which is currently in a precarious financial condition, goes bust, it's unlikely we'll ever get it back. So my recommendation is to support TPJ, *and* its alternatives, so that we expand the resources available to the Perl community, without further endangering the best one we've ever had, TPJ. For information about subscribing to TPJ (along with Sys Admin), see www.tpj.com. -Tim *==============================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | tim@consultix-inc.com www.consultix-inc.com www.softwareprofessor.com | | FEB: Perl; APR: Shell; Int. & OO Perl; Perl DataBase; JUNE: Basic UNIX, Perl | *------------------------------------------------------------------------------* | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle, 7/15-18 | | Adv. OOP * Adv. Module Implementation Techniques * Programming in Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Tue Feb 5 14:37:46 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print In-Reply-To: <20020205105623.B3119@timji.consultix.wa.com> References: <20020205105623.B3119@timji.consultix.wa.com> Message-ID: <119140000.1012941463@flashingchance> -- Tim Maher spake thusly: > On Tue, Feb 05, 2002 at 08:51:31AM -0800, Bob Brockhausen wrote: >> Does anyone know which $var to set to print >> out more than one line when matching?? I can't > > There ain't no such thing! 8-} > >> remember nor find it in Camel book... >> I tried to > if (/being_pat/ .. /end_pat/) { print "$_\n"} > > I think you want: > $context=""; > if (/begin_pat/ .. /end_pat/) { $context .= "$_\n" } > print $context; > > The only variable that I can think of that's relevant is the one > allowing you to read/match/print entire paragraphs at a time: $/="". > But that's appropriate for printing entire paragraphs that contain a > match, not for printing all lines within a range of matching patterns, > as you've shown above. Alternately, you might be wanting to do something like: if ( /(begin_pat .. end_pat)/s ) { print $1; } Adding the 's' will cause perl to match across multiple lines, but you've got to make sure you've read in multiple lines as well (perhaps by undef'ing $/ or setting it to ''). -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020205/d1b6c5b7/attachment.bin From cmeyer at helvella.org Tue Feb 5 18:15:09 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print In-Reply-To: <119140000.1012941463@flashingchance> References: <119140000.1012941463@flashingchance> Message-ID: <20020205161509.B1565@hobart.helvella.org> On Tue, Feb 05, 2002 at 12:37:46PM -0800, Matt Tucker wrote: > -- Tim Maher spake thusly: > > > > I think you want: > > $context=""; > > if (/begin_pat/ .. /end_pat/) { $context .= "$_\n" } > > print $context; > > Alternately, you might be wanting to do something like: > > if ( /(begin_pat .. end_pat)/s ) { > print $1; > } Matt's suggestion will do something very different from Tim's. The two characters '..' have very different meanings inside and outside of a regular expression. Outside they are [in scalar context] the 'flip-flop' operator [see perldoc perlop]. Inside they are two separate "wildcard" metacharacters. I really like the flip-flop operator. It reminds me of learning boolean logic by wiring together nand gates. It's also incredibly useful in one liners: # print out the contents of tags: pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Tue Feb 5 18:08:13 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print References: <20020205105623.B3119@timji.consultix.wa.com> <119140000.1012941463@flashingchance> Message-ID: In article <119140000.1012941463@flashingchance>, Matt Tucker wrote: > >if ( /(begin_pat .. end_pat)/s ) { > print $1; >} > >Adding the 's' will cause perl to match across multiple lines, but >you've got to make sure you've read in multiple lines as well (perhaps >by undef'ing $/ or setting it to ''). //s just causes . to match newlines also. Without it, . matches any character other than a newline. Perhaps he wants something like (untested): while (defined ($_ = do { local $/; readline })) { # read in whole file ($match) = /^[^\n]*?begin_pat.*?end_pat[^\n]*\n?/msg; ($match) = /^.*?begin_pat(?:.|\n)*?end_pat.*\n?/mg; # equiv to above, w/o //s print $match; } This should work the same as: while (<>) { print if /begin_pat/ .. /end_pat/ } unless both match the same line with end_pat not following begin_pat or begin_pat and end_pat match in different files. Here $match gets one or more whole lines, starting from a line matching /begin_pat/ and ending (possibly on the same line) with a line matching /end_pat/. As you can see, //s actually can make it harder to match multiple lines (besides, msg is a suspected carcinogen). //m makes ^ (and $) match relative to newlines in the middle of the string, not just at the beginning and ending of the string. If you assume the end of the file is properly newline-terminated, the msg version can be: ($match) = /^[^\n]*?begin_pat.*?end_pat(?>.*?\n)/msg; BTW, Matt, Mulberry seems to split (with "\n ") message-ids in References:. I didn't think that was allowed. The reply from the Mutt-user truncated the split part, and I'd tend to trust Mutt to not mess up given valid data. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Tue Feb 5 19:33:33 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: looking for $variable for multiline print In-Reply-To: <20020205161509.B1565@hobart.helvella.org> References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> Message-ID: <348240000.1012959212@benzene> -- Colin Meyer spake thusly: > On Tue, Feb 05, 2002 at 12:37:46PM -0800, Matt Tucker wrote: >> -- Tim Maher spake thusly: >> > >> > I think you want: >> > $context=""; >> > if (/begin_pat/ .. /end_pat/) { $context .= "$_\n" } >> > print $context; > >> >> Alternately, you might be wanting to do something like: >> >> if ( /(begin_pat .. end_pat)/s ) { >> print $1; >> } > > Matt's suggestion will do something very different from Tim's. The two > characters '..' have very different meanings inside and outside of a > regular expression. Outside they are [in scalar context] the > 'flip-flop' operator [see perldoc perlop]. Inside they are two > separate "wildcard" metacharacters. > > I really like the flip-flop operator. It reminds me of learning > boolean logic by wiring together nand gates. It's also incredibly > useful in one liners: > # print out the contents of tags: > pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw Keep in mind that I wasn't intending to use the '..' construction literally inside the regex. I probably should've said something like '.*?' to make it clearer, though. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020205/17cb59ba/attachment.bin From dancerboy at strangelight.com Tue Feb 5 22:24:30 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops (was: looking for $variable for multiline print) In-Reply-To: <20020205161509.B1565@hobart.helvella.org> References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> Message-ID: At 4:15 pm -0800 2/5/02, Colin Meyer wrote: > >I really like the flip-flop operator. It reminds me of learning boolean >logic by wiring together nand gates. It's also incredibly useful in >one liners: > # print out the contents of tags: > pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw > >Have fun, >-C. > Ugh. Reading that section of the docs made my brain hurt. For code that anyone else is going to have to read, please consider implementing .. with "normal" boolean operators (and, or, not) instead. Some language features are best left unused, IMO. (Remember, TMTOWTDI...) -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 02:00:38 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> Message-ID: <20020206000038.H1565@hobart.helvella.org> Hi Jason, On Tue, Feb 05, 2002 at 08:24:30PM -0800, dancerboy wrote: > At 4:15 pm -0800 2/5/02, Colin Meyer wrote: > > > >I really like the flip-flop operator. It reminds me of learning boolean > >logic by wiring together nand gates. It's also incredibly useful in > >one liners: > > # print out the contents of tags: > > pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw > > > >Have fun, > >-C. > > > > Ugh. Reading that section of the docs made my brain hurt. For code > that anyone else is going to have to read, please consider > implementing .. with "normal" boolean operators (and, or, not) > instead. Some language features are best left unused, IMO. > (Remember, TMTOWTDI...) > > -jason How about suggesting an easy-to-read substitute for scalar .. using "normal" boolean operators? Here's the above perl one liner so rendered: #!perl -n if (not $in_foo and /^\(foo/) { $in_foo=1 } print if $in_foo; if ($in_foo and /^\(foo/) { $in_foo=0 } I find the scalar .. to be far more readable. Having once gone through the learning process (reading the painful docs), it is easier to use than the wordier alternative. I found the learning process for regular expressions to be far more difficult than that for understanding scalar .. . I think that anyone would agree. To avoid that painful learning process, one could loop across a string character by character and use "normal" conditional constructs to test for or extract certain data. Who would recommend that? ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Wed Feb 6 06:15:10 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: <20020206000038.H1565@hobart.helvella.org> References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> Message-ID: At 12:00 am -0800 2/6/02, Colin Meyer wrote: >Hi Jason, > >On Tue, Feb 05, 2002 at 08:24:30PM -0800, dancerboy wrote: >> At 4:15 pm -0800 2/5/02, Colin Meyer wrote: >> > >> >I really like the flip-flop operator. It reminds me of learning boolean >> >logic by wiring together nand gates. It's also incredibly useful in >> >one liners: >> > # print out the contents of tags: >> > pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw >> > >> >Have fun, >> >-C. >> > >> >> Ugh. Reading that section of the docs made my brain hurt. For code >> that anyone else is going to have to read, please consider >> implementing .. with "normal" boolean operators (and, or, not) >> instead. Some language features are best left unused, IMO. >> (Remember, TMTOWTDI...) >> >> -jason > >How about suggesting an easy-to-read substitute for scalar .. using >"normal" boolean operators? > >Here's the above perl one liner so rendered: > > #!perl -n > if (not $in_foo and /^\(foo/) { $in_foo=1 } > print if $in_foo; > if ($in_foo and /^\(foo/) { $in_foo=0 } > >I find the scalar .. to be far more readable. Having once gone through >the learning process (reading the painful docs), it is easier to use >than the wordier alternative. > >I found the learning process for regular expressions to be far more >difficult than that for understanding scalar .. . I think that >anyone would agree. To avoid that painful learning process, one >could loop across a string character by character and use "normal" >conditional constructs to test for or extract certain data. Who >would recommend that? ;-) Perhaps my complaint should more properly be with the docs, rather than with the operator itself. To be perfectly honest, I read and reread that section of the docs, and eventually just gave up; I *still* don't fully understand what .. and ... do in scalar context. And I don't think that I'm particularly dense when it comes to things like this -- if I had difficulty understanding it, I'm pretty sure most other developers will have difficulty with it as well. It's possible that, if the docs contained a more coherent explanation of what these things do, I might change my opinion. But given the current state of the docs, I'd say scalar .. is going to be difficult for the average Perl developer to decipher. OTOH, my complaint may be that, if I understand the docs correctly (and again, I'm not sure that I do), it appears that the .. and ... operators implicitly maintain state information from previous uses of the operator. I consider that to be a Bad Thing: the result of an operator should be completely determined by its *current* operands, regardless of any previous uses of the operator. Any sort of state information should be made explicit (such as storing it in a variable, e.g. $in_foo in your example above, or encapsulating it in an object). By utilizing implicit state changes, you are in effect hiding important parts of the logic of your code, thus making it harder to read. ("Hiding" here should be understood in the bad sense of "obscuring", not in the good sense of "encapsulating". There's a difference, albeit a subtle one.) Again, just because a language has certain features, doesn't mean that you ought to use them. (And again, I'm talking about code that other people may have to read. If scalar .. is clear to you, and you're the only one maintaining the code, hey, more power to you...) -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asa.martin at attws.com Wed Feb 6 10:21:52 2002 From: asa.martin at attws.com (Martin, Asa) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: DNS Lookups Message-ID: <67FC0E2A32D0D31194500008C7CF2E6F05528FDA@wa-msg09.entp.attws.com> Here's something I've been wondering about for a while. Why is gethostbyname not able to resolve many addresses, when my nslookup program (on both my Solaris 2.8 box and Windows 2000) can? For example, I often have to write scripts that convert between IP addresses and DNS names. Currently I just run calls to nslookup and parse the results. I don't like that method because it's not very platform independent. I found this script in the book "Network Programming with Perl": #!/usr/local/bin/perl # file: ip_trans.pl use Socket; my $ADDR_PAT = '^\d+\.\d+\.\d+\.\d+$'; while (<>) { chomp; die "$_: Not a valid address" unless /$ADDR_PAT/o; my $name = gethostbyaddr(inet_aton($_),AF_NET); $name ||= '?'; print "$_ => $name\n"; } However, this script does not resolve many addresses. For example the following list comes back with '?' 205.188.208.137 152.163.188.39 64.12.96.198 205.188.209.75 152.163.189.103 152.163.189.72 152.163.188.8 205.188.208.167 207.172.11.233 205.188.209.13 205.188.208.74 205.188.208.75 152.163.188.168 198.81.23.78 205.188.209.170 205.188.209.171 Do I need to do something on my box to get the perl functions to work? Or is nslookup doing something else that can't be done with perl. Thanks, Asa Martin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Wed Feb 6 11:33:52 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Re: DNS Lookups References: <67FC0E2A32D0D31194500008C7CF2E6F05528FDA@wa-msg09.entp.attws.com> Message-ID: <040f01c1af34$734ef880$3488ddd1@aciwin> Is there a typo in the gethostbyaddr call? The Programming Perl book gives a similar example using AF_INET for the second parameter. Also, I notice that most of the addresses you are having problems with are cache servers. Coincidence? Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Martin, Asa" To: Sent: Wednesday, February 06, 2002 8:21 AM Subject: SPUG: DNS Lookups > Here's something I've been wondering about for a while. Why is gethostbyname not able to resolve many addresses, when my nslookup program (on both my Solaris 2.8 box and Windows 2000) can? For example, I often have to write scripts that convert between IP addresses and DNS names. Currently I just run calls to nslookup and parse the results. I don't like that method because it's not very platform independent. I found this script in the book "Network Programming with Perl": > > #!/usr/local/bin/perl > # file: ip_trans.pl > use Socket; > my $ADDR_PAT = '^\d+\.\d+\.\d+\.\d+$'; > while (<>) { > chomp; > die "$_: Not a valid address" unless /$ADDR_PAT/o; > my $name = gethostbyaddr(inet_aton($_),AF_NET); > $name ||= '?'; > print "$_ => $name\n"; > } > > However, this script does not resolve many addresses. For example the following list comes back with '?' > > 205.188.208.137 > 152.163.188.39 > 64.12.96.198 > 205.188.209.75 > 152.163.189.103 > 152.163.189.72 > 152.163.188.8 > 205.188.208.167 > 207.172.11.233 > 205.188.209.13 > 205.188.208.74 > 205.188.208.75 > 152.163.188.168 > 198.81.23.78 > 205.188.209.170 > 205.188.209.171 > > Do I need to do something on my box to get the perl functions to work? Or is nslookup doing something else that can't be done with perl. > > Thanks, > > Asa Martin > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Wed Feb 6 11:49:39 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: DNS Lookups In-Reply-To: <67FC0E2A32D0D31194500008C7CF2E6F05528FDA@wa-msg09.entp.attws.com> References: <67FC0E2A32D0D31194500008C7CF2E6F05528FDA@wa-msg09.entp.attws.com> Message-ID: <20020206174939.GP9390@titanium.brain.org> On Wed, Feb 06, 2002 at 08:21:52AM -0800, Martin, Asa wrote: > Here's something I've been wondering about for a while. Why is gethostbyname not able to resolve many addresses, when my nslookup program (on both my Solaris 2.8 box and Windows 2000) can? For example, I often have to write scripts that convert between IP addresses and DNS names. Currently I just run calls to nslookup and parse the results. I don't like that method because it's not very platform independent. I found this script in the book "Network Programming with Perl": > > #!/usr/local/bin/perl > # file: ip_trans.pl > use Socket; > my $ADDR_PAT = '^\d+\.\d+\.\d+\.\d+$'; > while (<>) { > chomp; > die "$_: Not a valid address" unless /$ADDR_PAT/o; > my $name = gethostbyaddr(inet_aton($_),AF_NET); > $name ||= '?'; > print "$_ => $name\n"; > } AF_NET should be AF_INET -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asa.martin at attws.com Wed Feb 6 12:03:35 2002 From: asa.martin at attws.com (Martin, Asa) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: RE: DNS Lookups Message-ID: <67FC0E2A32D0D31194500008C7CF2E6F05528FDB@wa-msg09.entp.attws.com> OK, I feel quite stupid now. Yes, there was a typo, sorry about that... and yes I should have said "use strict" because that would have caught it. If you replace the AF_NET with AF_INET it does indeed find the names for most of the IP addresses. However, if using this modified script, my nslookup program finds more names than gethostbyaddr: #!/usr/local/bin/perl -w # file: ip_trans.pl use strict; use Socket; my $ADDR_PAT = '^\d+\.\d+\.\d+\.\d+$'; while (<>) { chomp; die "$_: Not a valid address" unless /$ADDR_PAT/o; my $name = gethostbyaddr(inet_aton($_),AF_INET); my $nname = `nslookup $_ 2>/dev/null | grep Name: | awk '{print \$2}'`; chomp $nname; $name ||= '?'; $nname ||= '?'; print "$_ => $name\n"; print "** $_ => $nname\n"; } And, yes most of the IPs are probably caching servers. For example these IPs resolved with nslookup, but not with gethostbyaddr: 216.144.70.231 64.210.248.135 216.142.233.73 64.210.241.103 65.90.98.9 216.142.233.105 64.0.99.201 Asa -----Original Message----- From: Richard Anderson [mailto:richard@richard-anderson.org] Sent: Wednesday, February 06, 2002 9:34 AM To: Martin, Asa; spug-list@pm.org Subject: Re: DNS Lookups Is there a typo in the gethostbyaddr call? The Programming Perl book gives a similar example using AF_INET for the second parameter. Also, I notice that most of the addresses you are having problems with are cache servers. Coincidence? Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Martin, Asa" To: Sent: Wednesday, February 06, 2002 8:21 AM Subject: SPUG: DNS Lookups > Here's something I've been wondering about for a while. Why is gethostbyname not able to resolve many addresses, when my nslookup program (on both my Solaris 2.8 box and Windows 2000) can? For example, I often have to write scripts that convert between IP addresses and DNS names. Currently I just run calls to nslookup and parse the results. I don't like that method because it's not very platform independent. I found this script in the book "Network Programming with Perl": > > #!/usr/local/bin/perl > # file: ip_trans.pl > use Socket; > my $ADDR_PAT = '^\d+\.\d+\.\d+\.\d+$'; > while (<>) { > chomp; > die "$_: Not a valid address" unless /$ADDR_PAT/o; > my $name = gethostbyaddr(inet_aton($_),AF_NET); > $name ||= '?'; > print "$_ => $name\n"; > } > > However, this script does not resolve many addresses. For example the following list comes back with '?' > > 205.188.208.137 > 152.163.188.39 > 64.12.96.198 > 205.188.209.75 > 152.163.189.103 > 152.163.189.72 > 152.163.188.8 > 205.188.208.167 > 207.172.11.233 > 205.188.209.13 > 205.188.208.74 > 205.188.208.75 > 152.163.188.168 > 198.81.23.78 > 205.188.209.170 > 205.188.209.171 > > Do I need to do something on my box to get the perl functions to work? Or is nslookup doing something else that can't be done with perl. > > Thanks, > > Asa Martin > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From glyph at mac.com Wed Feb 6 12:13:21 2002 From: glyph at mac.com (Geoffrey & Kristin Grosenbach) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: <20020206000038.H1565@hobart.helvella.org> Message-ID: <3467DC9C-1B2D-11D6-BABE-0050E4C54C7E@mac.com> Colin-- I'm glad you mentioned the .. operator as a logic operator. I didn't know it worked that way in scalar context, but it seems really useful. Special operators like that are part of the reason I prefer Perl over other languages. (I did read the docs in Perl in a Nutshell and they made sense to me.) I think that a single operator is almost always easier to understand than a usually greater number of lines of code. One can lookup an operator in a manual, but where do you look for an explanation of a tricky loop? So in that sense, the possibly difficult documentation on an operator is much more than one would otherwise have. Geoff On Wednesday, February 6, 2002, at 12:00 AM, Colin Meyer wrote: > Hi Jason, > > On Tue, Feb 05, 2002 at 08:24:30PM -0800, dancerboy wrote: >> At 4:15 pm -0800 2/5/02, Colin Meyer wrote: >>> >>> I really like the flip-flop operator. It reminds me of learning >>> boolean >>> logic by wiring together nand gates. It's also incredibly useful in >>> one liners: >>> # print out the contents of tags: >>> pyx file.xml |perl -ne'print if /^\(foo/../^\)foo/' |pyxw >>> >>> Have fun, >>> -C. >>> >> >> Ugh. Reading that section of the docs made my brain hurt. For code >> that anyone else is going to have to read, please consider >> implementing .. with "normal" boolean operators (and, or, not) >> instead. Some language features are best left unused, IMO. >> (Remember, TMTOWTDI...) >> >> -jason > > How about suggesting an easy-to-read substitute for scalar .. using > "normal" boolean operators? > > Here's the above perl one liner so rendered: > > #!perl -n > if (not $in_foo and /^\(foo/) { $in_foo=1 } > print if $in_foo; > if ($in_foo and /^\(foo/) { $in_foo=0 } > > I find the scalar .. to be far more readable. Having once gone through > the learning process (reading the painful docs), it is easier to use > than the wordier alternative. > > I found the learning process for regular expressions to be far more > difficult than that for understanding scalar .. . I think that > anyone would agree. To avoid that painful learning process, one > could loop across a string character by character and use "normal" > conditional constructs to test for or extract certain data. Who > would recommend that? ;-) > > Have fun, > -C. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address > For daily traffic, use spug-list for LIST ; for weekly, > spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > http://www.GeoffreyGrosenbach.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Wed Feb 6 12:55:39 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: RE: DNS Lookups In-Reply-To: <67FC0E2A32D0D31194500008C7CF2E6F05528FDB@wa-msg09.entp.attws.com> References: <67FC0E2A32D0D31194500008C7CF2E6F05528FDB@wa-msg09.entp.attws.com> Message-ID: <20020206185539.GS9390@titanium.brain.org> On Wed, Feb 06, 2002 at 10:03:35AM -0800, Martin, Asa wrote: > For example these IPs resolved with nslookup, but not with gethostbyaddr: > 216.144.70.231 > 64.210.248.135 > 216.142.233.73 > 64.210.241.103 > 65.90.98.9 > 216.142.233.105 > 64.0.99.201 I have no idea what your problem is but I doubt it has anything to do with perl. All of these ips resolved for me. (Please note I don't have nslookup installed on this machine so those lines obviously failed). 216.144.70.231 => proxy.ia3.marketscore.com ** 216.144.70.231 => ? 64.210.248.135 => proxy.ia2.marketscore.com ** 64.210.248.135 => ? 216.142.233.73 => proxy.sj3.marketscore.com ** 216.142.233.73 => ? 64.210.241.103 => proxy.ia4.marketscore.com ** 64.210.241.103 => ? 65.90.98.9 => proxy.sj4.marketscore.com ** 65.90.98.9 => ? 216.142.233.105 => proxy.sjc.marketscore.com ** 216.142.233.105 => ? 64.0.99.201 => proxy.or3.marketscore.com ** 64.0.99.201 => ? -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From daryn at marinated.org Wed Feb 6 13:48:58 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: RE: DNS Lookups In-Reply-To: <20020206185539.GS9390@titanium.brain.org> Message-ID: here's a guess: are some of these servers in your hosts file on the box that you're running the gethostbyaddr on? the ones that show up? While both nslookup and gethostbyaddr are resolvers, gethostbyaddr doesn't neccesarily/always use dns, while nslookup does. I don't know the exact file that sets this configuration on solaris, but on linux it's /etc/nsswitch.conf. the line in the file looks like this: hosts: files nisplus dns if dns isn't in there, it won't use it. furthermore, it checks them in the order above, so if you have different values in the hosts file than in dns, you'd see them in your test script as well. -daryn > 216.144.70.231 => proxy.ia3.marketscore.com > ** 216.144.70.231 => ? > 64.210.248.135 => proxy.ia2.marketscore.com > ** 64.210.248.135 => ? > 216.142.233.73 => proxy.sj3.marketscore.com > ** 216.142.233.73 => ? > 64.210.241.103 => proxy.ia4.marketscore.com > ** 64.210.241.103 => ? > 65.90.98.9 => proxy.sj4.marketscore.com > ** 65.90.98.9 => ? > 216.142.233.105 => proxy.sjc.marketscore.com > ** 216.142.233.105 => ? > 64.0.99.201 => proxy.or3.marketscore.com > ** 64.0.99.201 => ? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 14:00:34 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> Message-ID: <20020206120034.I1565@hobart.helvella.org> Hi Jason, On Wed, Feb 06, 2002 at 04:15:10AM -0800, dancerboy wrote: [...] > > OTOH, my complaint may be that, if I understand the docs correctly > (and again, I'm not sure that I do), it appears that the .. and ... > operators implicitly maintain state information from previous uses of > the operator. I consider that to be a Bad Thing: the result of an > operator should be completely determined by its *current* operands, > regardless of any previous uses of the operator. Am I to understand that you'd avoid the /g modifier switch to the matching operators? /g certainly causes the matching operators (actually their operands) to maintain state. Consider: while ($s =~ s/(\w+)/g) { print "Found some word characters: $1\n"; } > Any sort of state information should be made explicit (such as storing > it in a variable, e.g. $in_foo in your example above, or encapsulating > it in an object). By this thought, the above snippet might be rendered: my $still_looking=1; # here's the state information my $s_copy = $s; while ($still_looking) { if ($s_copy =~ s/.*?(\w+)//) { print "Found some word characters: $1\n"; } else { $still_looking=0; } } > By utilizing implicit state changes, you are in effect > hiding important parts of the logic of your code, thus making it > harder to read. ("Hiding" here should be understood in the bad sense > of "obscuring", not in the good sense of "encapsulating". There's a > difference, albeit a subtle one.) By taking advantage of operators that can maintain state, one can clear their code of extra distractions. btw, How do you consider encapsulating state information in an object different than encapsulating state information in an operator? my $matcher = REGEX::withState->new(qr/(\w+)/); while ($match = $matcher->get_next_match($s)) { print "Found some word characters: $match\n"; } To be honest, in the regex case, the state is maintained in the string, rather than the regex operator. See perldoc -f pos. So, the string is an object. ;-) But operators can be objects too. See Ch 5 in Damian's book. > > Again, just because a language has certain features, doesn't mean > that you ought to use them. (And again, I'm talking about code that > other people may have to read. If scalar .. is clear to you, and > you're the only one maintaining the code, hey, more power to you...) I'd certainly agree. You won't see me messing with $[, composing hash keys like $h{good;one}, or any other of a number of nasty leftovers in the language. I even avoid the perfectly reasonable m??. However, I will continue to use handy operators, like scalar .., the hook operator (trinary ?::), and m//g. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Wed Feb 6 15:40:29 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: <20020206120034.I1565@hobart.helvella.org> References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> Message-ID: First, I was not attempting anything even approaching a formal definition of good coding style, only an informal outline of what seem to me to be useful guidelines. So to the more obvious objections to those guidelines, I can only give a sort of hand-wavy "well, of *course* I didn't mean them to apply in *that* situation!" Still, I think it's useful (to me, at least) to examine in slightly more detail what I did and didn't mean by those guidelines: At 12:00 pm -0800 2/6/02, Colin Meyer wrote: >Hi Jason, > >On Wed, Feb 06, 2002 at 04:15:10AM -0800, dancerboy wrote: > >[...] > >> >> OTOH, my complaint may be that, if I understand the docs correctly >> (and again, I'm not sure that I do), it appears that the .. and ... >> operators implicitly maintain state information from previous uses of >> the operator. I consider that to be a Bad Thing: the result of an >> operator should be completely determined by its *current* operands, >> regardless of any previous uses of the operator. > >Am I to understand that you'd avoid the /g modifier switch to the >matching operators? /g certainly causes the matching operators (actually >their operands) to maintain state. /g doesn't maintain state in the sense I mean: the result of m/$foo/g is completely determined by the current value of $foo (and whether it's in a list or scalar context), regardless of what matches may have occurred previously. A better example would be the /c switch, which, yes, I do avoid. It seems to me that part of the implicit contract for an operator (as opposed to an object method, and possibly a function, though that's more of a grey area) is, or should be, that if you know the value of the operands (and, in Perl, whether it's used in a list or scalar context) then you will know the return value of the operator, without having to know anything else about the surrounding logic. [Insert necessary hand-waves and disclaimers about the -X "operators".] I find it somewhat wrong that: for my $i ( 1 .. 4 ) { ++$i; $foo = $bar->a() .. $bar->b(); } has different semantics from: for my $i ( 1 .. 2 ) { ++$i; $foo = $bar->a() .. $bar->b(); ++$i; $foo = $bar->a() .. $bar->b(); } > >Consider: > > while ($s =~ s/(\w+)/g) { > print "Found some word characters: $1\n"; > } > >> Any sort of state information should be made explicit (such as storing >> it in a variable, e.g. $in_foo in your example above, or encapsulating >> it in an object). > >By this thought, the above snippet might be rendered: > > my $still_looking=1; # here's the state information > my $s_copy = $s; > while ($still_looking) { > if ($s_copy =~ s/.*?(\w+)//) { > print "Found some word characters: $1\n"; > } > else { > $still_looking=0; > } > } Again, the first example doesn't violate my proposed guidelines: the state is *explicitly* stored in $s. It's not hidden in the way that the state of scalar .. is hidden. >By taking advantage of operators that can maintain state, one can >clear their code of extra distractions. Perhaps, in some cases. Just remember that brevity is not the same thing as clarity. > >btw, How do you consider encapsulating state information in an object >different than encapsulating state information in an operator? > > my $matcher = REGEX::withState->new(qr/(\w+)/); > while ($match = $matcher->get_next_match($s)) { > print "Found some word characters: $match\n"; > } For one thing, I could, in theory, peek at the state by creating an accessor method. E.g.: my $matcher = REGEX::withState->new(qr/(\w+)/); while ($match = $matcher->get_next_match($s)) { print "Found some word characters: $match\n"; print( "Still have " . $matcher->get_remaining_chars($s) . " characters to search.\n" ); } Whereas with an operator, I can't do anything like: $foo = $bar .. $baz; print( "The current flip-flop state is " . ..->get_state() . "\n" ); Even if ..->method() were legal, it wouldn't do what I want, because it's testing the wrong operator. I'd need some way to refer to the operator in the previous line, but because it's an operator, there's no way to do that. > > But operators can be objects too. Well, IMO they shouldn't be. An operator is an operator. An object is an object. By blurring the distinction between them, you're taking away important semantic cues that would otherwise help a human being understand the code. The purpose of an object is to encapsulate state information. When you see $foo->bar(), it's understood that the return value is dependant on the internal state of $foo. (And if it's not, you're probably misusing the object syntax. Another peeve of mine is how many "OO" interfaces on CPAN don't actually encapsulate anything: they're just namespaces. Yes, objects in Perl are *implemented* as namespaces -- i.e. packages -- but that doesn't mean that that's how they should be used.) The purpose of an operator is to perform a function on a set of operands. When I see $a $b , my natural assumption is that the result is a simple function of $a and $b. If the operator itself has state information, then you're essentially introducing a *completely* hidden operand -- one that you cannot access in any way other than by actually evaluating the expression containing the operator. > >However, I will continue to use handy operators, like scalar .., the >hook operator (trinary ?::), and m//g. Hey, I never said anything against ?: or m//g -- I use them all the time as well :) -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Daniel.Pommert at verizonwireless.com Wed Feb 6 16:12:08 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Perl URLs? Message-ID: <9B30436F511ED5118EDF0002A55C31800119D879@cairvexmb03.la.airtouch.com> I was just wondering what the status of Perl 6 was. So, I decided to look on the Web when I realized that I didn't have the current URLs. Is it perl.com, perl.org, perlmonger.org, etc? Could someone(s) post a current list of URLs (beyond http://www.seattleperl.org , of course!) that are useful references for Perl, along with a brief description of each? Thanks, -- Daniel Pommert Verizon Wireless 425-603-8612 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020206/579d521e/attachment.htm From dancerboy at strangelight.com Wed Feb 6 16:36:45 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> Message-ID: At 1:40 pm -0800 2/6/02, dancerboy wrote: > the result of m/$foo/g is completely determined by the current >value of $foo (and whether it's in a list or scalar context), err... I meant the current values of $foo and of $_, of course... -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 17:50:04 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Perl URLs? In-Reply-To: <9B30436F511ED5118EDF0002A55C31800119D879@cairvexmb03.la.airtouch.com> References: <9B30436F511ED5118EDF0002A55C31800119D879@cairvexmb03.la.airtouch.com> Message-ID: <20020206155004.L1565@hobart.helvella.org> Hi Daniel, On Wed, Feb 06, 2002 at 02:12:08PM -0800, Pommert, Daniel wrote: > I was just wondering what the status of Perl 6 was. So, I decided to look > on the Web when I realized that I didn't have the current URLs. Is it > perl.com, perl.org, perlmonger.org, etc? > > Could someone(s) post a current list of URLs (beyond > http://www.seattleperl.org , of course!) that > are useful references for Perl, along with a brief description of each? For Perl6, a good reference point is: http://dev.perl.org/perl6/ For information on what the language will be like, read the Apocalypses and Exegeses. For info on the bytecode interpreter (and eventually the Perl6 compiler, as well as other parrot bytecode target compilers), check http://parrotcode.org/ Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 18:26:44 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> Message-ID: <20020206162644.M1565@hobart.helvella.org> On Wed, Feb 06, 2002 at 02:36:45PM -0800, dancerboy wrote: > At 1:40 pm -0800 2/6/02, dancerboy wrote: > > the result of m/$foo/g is completely determined by the current > >value of $foo (and whether it's in a list or scalar context), > > err... I meant the current values of $foo and of $_, of course... Don't forget pos($_), which results from the previous outcome of m/$foo/g. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 18:27:54 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> Message-ID: <20020206162754.N1565@hobart.helvella.org> Hi Jason, On Wed, Feb 06, 2002 at 01:40:29PM -0800, dancerboy wrote: [...] > > Whereas with an operator, I can't do anything like: > > $foo = $bar .. $baz; > print( > "The current flip-flop state is " > . ..->get_state() > . "\n" > ); > > Even if ..->method() were legal, it wouldn't do what I want, because > it's testing the wrong operator. I'd need some way to refer to the > operator in the previous line, but because it's an operator, there's > no way to do that. You can test the state of scalar .. . That's what you typically do with it. if ($bar .. $baz) { print "flip-flop's state is true.\n"; print "Next evaluation will check the right hand term.\n"; } else { print "flip-flop's state is false.\n"; print "Next evaluation will check the left hand term.\n"; } Or you could save that state into a variable, as you did in your example. You could have said: print 'The current flip-flop state is: ", $foo?'true':'false', "\n"; You'd rather that there was a FlipFlop class object that provided an accessor to that state? Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From humbaba9 at yahoo.com Wed Feb 6 17:43:27 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl URLs? In-Reply-To: <20020206155004.L1565@hobart.helvella.org> Message-ID: <20020206234327.15917.qmail@web12803.mail.yahoo.com> 2/6/02 You want Perl URLs? I got Perl URLs! warning: some of these are old http://www.perl.com/ http://www.perl.org/ http://www.perl.com/CPAN/ http://www.pm.org/ http://63.249.21.144/ http://www.sysadminmag.com/tpj/ http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html Introduction to Perl http://learn.perl.org learn.perl.org Learn Perl http://www.cpan.org/ CPAN.org Comprehensive Perl Archive Network http://www.mit.edu/perl/perl.html MIT Perl Manual - organized and annotated http://www.perl.com/CPAN-local/" target="_blank">Perl.com CPAN - Comprehensive Perl Archive Network http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html" target="_blank">Perl.com CPAN - Idiot's Guide to Perl Solutions http://www.perl.com/CPAN-local/modules/00modlist.long.html" target="_blank">Perl.com CPAN - Perl 5 Module List http://www.perldoc.com/cpan/CGI.html" target="_blank">Perldoc.com CPAN Object Oriented CGI http://cgi-lib.berkeley.edu/ Berkeley The cgi-lib.pl Home Page http://hoohoo.ncsa.uiuc.edu/cgi/env.html" target="_blank">Hoohoo NCSA CGI Env Variables http://hoohoo.ncsa.uiuc.edu/cgi/index.html" target="_blank">Hoohoo NCSA CGI Documentation http://stein.cshl.org/WWW/software/CGI/cgi_docs.html" target="_blank">Stein CSHL org CGI.pm - a Perl5 CGI Library http://www.awu.id.ethz.ch/~th/session/Session.html" target="_blank">awu.id.ethz.ch Perl Manual Users Guide http://www.htmlhelp.org/faq/cgifaq.html HTML help.org CGI FAQ http://agora.leeds.ac.uk/Perl/start.html Agora Leeds UK Perl Tutorial http://www.modperl.com/perl_conference/handout.html" target="_blank">Modperl.com How Perl interacts with Apache, Excellent Tutorial. http://www.netguide.aust.com/tutorials/buildingweb6/building_web_tut6.html" target="_blank">Netguide.aust.com CGI Tutorial http://www.raingod.com/raingod/resources/Programming/Perl/Notes/CGIDebugging.html" target="_blank">Raingod.com CGI Debugging.html http://www.virtualschool.edu/lang/perl/" target="_blank">Virtual School Course in Perl http://www.activestate.com ActiveState ActiveState Perl Download - Get Perl for Linux, Solaris, and Windows http://www.indigostar.com/perl2exe.htm Perl2exe Indigostar Download - Translate Perl to use with IIS http://168.156.125.36/dcshoe.html Shoemaker's Last (instructor) __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Wed Feb 6 18:36:51 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> <20020206162754.N1565@hobart.helvella.org> Message-ID: In article <20020206162754.N1565@hobart.helvella.org>, Colin Meyer wrote: >You can test the state of scalar .. . That's what you typically do >with it. > > if ($bar .. $baz) { > print "flip-flop's state is true.\n"; > print "Next evaluation will check the right hand term.\n"; > } > else { > print "flip-flop's state is false.\n"; > print "Next evaluation will check the left hand term.\n"; > } That works with ... but not ..; I think you need to say if (($bar .. $baz) =~ /^\d+$/) { to find out what the state is at the time of the print. >Or you could save that state into a variable, as you did in your >example. You could have said: > > print 'The current flip-flop state is: ", $foo?'true':'false', "\n"; Same here. print 'The current flip-flop state is: ", $foo&&$foo!~/E/?'true':'false', "\n"; Still, your point is valid. The state is *not* hidden (as it is with the deprecated m??). It is returned every time you call the operator. The point about the doc being difficult to read is valid too. Can anyone suggest alternate text? Perhaps perl code equivalents for .. and ... if not too lengthy? Here is how it is now: In scalar context, ".." returns a boolean value. The operator is bistable, like a flip-flop, and emulates the line-range (comma) operator of B, B, and various editors. Each ".." operator maintains its own boolean state. It is false as long as its left operand is false. Once the left operand is true, the range operator stays true until the right operand is true, I which the range operator becomes false again. It doesn't become false till the next time the range operator is evaluated. It can test the right operand and become false on the same evaluation it became true (as in B), but it still returns true once. If you don't want it to test the right operand till the next evaluation, as in B, just use three dots ("...") instead of two. In all other regards, "..." behaves just like ".." does. The right operand is not evaluated while the operator is in the "false" state, and the left operand is not evaluated while the operator is in the "true" state. The precedence is a little lower than || and &&. The value returned is either the empty string for false, or a sequence number (beginning with 1) for true. The sequence number is reset for each range encountered. The final sequence number in a range has the string "E0" appended to it, which doesn't affect its numeric value, but gives you something to search for if you want to exclude the endpoint. You can exclude the beginning point by waiting for the sequence number to be greater than 1. If either operand of scalar ".." is a constant expression, that operand is implicitly compared to the C<$.> variable, the current line number. Examples: As a scalar operator: if (101 .. 200) { print; } # print 2nd hundred lines next line if (1 .. /^$/); # skip header lines s/^/> / if (/^$/ .. eof()); # quote body # parse mail messages while (<>) { $in_header = 1 .. /^$/; $in_body = /^$/ .. eof(); # do something based on those } continue { close ARGV if eof; # reset $. each file } =cut - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 6 22:45:56 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: <20020205105623.B3119@timji.consultix.wa.com> <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> <20020206120034.I1565@hobart.helvella.org> <20020206162754.N1565@hobart.helvella.org> Message-ID: <20020206204556.A4901@hobart.helvella.org> Hi Yitzchak, On Wed, Feb 06, 2002 at 04:36:51PM -0800, Yitzchak Scott-Thoennes wrote: > In article <20020206162754.N1565@hobart.helvella.org>, > Colin Meyer wrote: > >You can test the state of scalar .. . That's what you typically do > >with it. > > > > if ($bar .. $baz) { > > print "flip-flop's state is true.\n"; > > print "Next evaluation will check the right hand term.\n"; > > } > > else { > > print "flip-flop's state is false.\n"; > > print "Next evaluation will check the left hand term.\n"; > > > } > > That works with ... but not ..; I think you need to say > if (($bar .. $baz) =~ /^\d+$/) { > to find out what the state is at the time of the print. You are partially correct. My example wouldn't be accurate for ... either! I knew something was wrong with my code. Who put that unmaintainable .. operator in there, anyway? ;-) This example will hopefully shed some light: #!/usr/local/bin/perl print "\n",' 'x22,"..\t\t...\n\n"; for () { chomp; printf '%-22s',$_; $dd = /start/ .. /stop/; $ddd = /start/ ... /stop/; print "[$dd]\t\t[$ddd]\n"; printf '%22s','next term to test: '; # clearly maintainable code follows ;-) print $dd&&$dd!~/E/?'right':'left',"\t\t", $ddd&&$ddd!~/E/?'right':'left',"\n\n"; } __DATA__ 1 outside 2 start 3 inside 4 stop 5 outside 6 start inside stop 7 outside or in? 8 start 9 inside 10 stop Ok, so when you need to test for the edge condition with either .. or ..., then the code isn't quite so intuitive. If I saw something like: if (($bar .. $baz) =~ /^\d+$/) { # watch that precedence print "flip's true and not about to change\n"; } then I'd have to go back and check the docs. Well, at least the first time. ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Thu Feb 7 03:45:26 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: <20020206162754.N1565@hobart.helvella.org> Message-ID: On Wed, 6 Feb 2002, Colin Meyer wrote: > You'd rather that there was a FlipFlop class object that provided an > accessor to that state? Amen. I mean, yes. There is a limit (partly depending on the skill of the person reading the code) to how much functionality can be successfully abstracted within a given symbol or mnemonic. - The first goal of programming is to write code that gets the job done. - The second goal of programming is to write code that the average coder will read and say, "that's some schweet code, /dude|grrl/". - The third goal of programming is to write code that one can quickly navigate to the thing that made one fail the first goal. #!/bin/pseudo Define { symbol = !; abstraction = DWIM; arguments = ANY and ALL; context = ANY and ALL; } !=<>; __END__ Well, that takes care of world hunger and peace. What's next? :) - Is there a zeroth goal of programming? -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Daniel.Pommert at verizonwireless.com Thu Feb 7 10:34:58 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl URLs? Message-ID: <9B30436F511ED5118EDF0002A55C31800119D87A@cairvexmb03.la.airtouch.com> Thanks, these URLs helped with the Perl 6 question. But, actually, I was interested in a list (with descriptions) of URLs so that I could beef up my Perl Favorites/Bookmarks folder with useful and interesting places for Perl in general. Any further suggestions? Thanks, -- Daniel Pommert Verizon Wireless 425-603-8612 -----Original Message----- From: Colin Meyer [mailto:cmeyer@helvella.org] Sent: Wednesday, February 06, 2002 3:50 PM To: Pommert, Daniel Cc: 'spug-list@pm.org' Subject: Re: SPUG: Perl URLs? Hi Daniel, On Wed, Feb 06, 2002 at 02:12:08PM -0800, Pommert, Daniel wrote: > I was just wondering what the status of Perl 6 was. So, I decided to look > on the Web when I realized that I didn't have the current URLs. Is it > perl.com, perl.org, perlmonger.org, etc? > > Could someone(s) post a current list of URLs (beyond > http://www.seattleperl.org , of course!) that > are useful references for Perl, along with a brief description of each? For Perl6, a good reference point is: http://dev.perl.org/perl6/ For information on what the language will be like, read the Apocalypses and Exegeses. For info on the bytecode interpreter (and eventually the Perl6 compiler, as well as other parrot bytecode target compilers), check http://parrotcode.org/ Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Thu Feb 7 11:18:36 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: <20020206162754.N1565@hobart.helvella.org> Message-ID: <20020207091836.B5169@hobart.helvella.org> On Thu, Feb 07, 2002 at 01:45:26AM -0800, Andrew Sweger wrote: > On Wed, 6 Feb 2002, Colin Meyer wrote: > > > You'd rather that there was a FlipFlop class object that provided an > > accessor to that state? > > Amen. I mean, yes. Perhaps you'd be more comfortable with Python then? ;-) Instead of ops like .. or =~ s///g, everything is done with objects. Oh, and there's no TMTOWTDI. "Readability is often enhanced by reducing unnecessary variability. When possible, there's a single, obvious way to code a particular construct. This reduces the number of choices facing the programmer who is writing the code, and increases the chance that will appear familiar to a second programmer reading it. Yet another contribution to Python's readability is the choice to use punctuation mostly in a conservative, conventional manner. Most operator symbols are familiar to anyone with even a vague recollection of high school math, and no new meanings have to be learned for comic strip curse characters like @&$!. " --Guido, from the forward to Programming Python (1st ed.) While there are many interesting things about Python (tuples just to get started), it is Perl's richness of expressability that keeps my attention. Well, that and all those handy modules on the CPAN. ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Thu Feb 7 11:30:17 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl URLs? In-Reply-To: <9B30436F511ED5118EDF0002A55C31800119D87A@cairvexmb03.la.airtouch.com> References: <9B30436F511ED5118EDF0002A55C31800119D87A@cairvexmb03.la.airtouch.com> Message-ID: <20020207093017.C5169@hobart.helvella.org> On Thu, Feb 07, 2002 at 08:34:58AM -0800, Pommert, Daniel wrote: > Thanks, these URLs helped with the Perl 6 question. > > But, actually, I was interested in a list (with descriptions) of URLs so > that I could beef up my Perl Favorites/Bookmarks folder with useful and > interesting places for Perl in general. > > Any further suggestions? Here's a few that I didn't notice on Meryll's list: Good news site (slashcode based): http://use.perl.org/ Question & Answer forum, good for newbies as well as veterans: http://perlmonks.org/ Documentation for all versions of Perl and other stuff: http://perldoc.com/ Mail Lists: http://lists.perl.org/ Maybe someone could gather these up and make a list for our site. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Daniel.Pommert at verizonwireless.com Thu Feb 7 11:41:13 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl URLs? Message-ID: <9B30436F511ED5118EDF0002A55C31800119D87B@cairvexmb03.la.airtouch.com> I also recall http://cpan.org. Are there any other good (university, say) software repositories? -- Daniel Pommert -----Original Message----- From: Colin Meyer [mailto:cmeyer@helvella.org] Sent: Thursday, February 07, 2002 9:30 AM To: Pommert, Daniel Cc: 'spug-list@pm.org' Subject: Re: SPUG: Perl URLs? On Thu, Feb 07, 2002 at 08:34:58AM -0800, Pommert, Daniel wrote: > Thanks, these URLs helped with the Perl 6 question. > > But, actually, I was interested in a list (with descriptions) of URLs so > that I could beef up my Perl Favorites/Bookmarks folder with useful and > interesting places for Perl in general. > > Any further suggestions? Here's a few that I didn't notice on Meryll's list: Good news site (slashcode based): http://use.perl.org/ Question & Answer forum, good for newbies as well as veterans: http://perlmonks.org/ Documentation for all versions of Perl and other stuff: http://perldoc.com/ Mail Lists: http://lists.perl.org/ Maybe someone could gather these up and make a list for our site. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dha at panix.com Thu Feb 7 14:15:02 2002 From: dha at panix.com (David H. Adler) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: <20020207091836.B5169@hobart.helvella.org> References: <20020206162754.N1565@hobart.helvella.org> <20020207091836.B5169@hobart.helvella.org> Message-ID: <20020207201502.GA20829@panix.com> On Thu, Feb 07, 2002 at 09:18:36AM -0800, Colin Meyer wrote: > > Perhaps you'd be more comfortable with Python then? ;-) Instead of ops > like .. or =~ s///g, everything is done with objects. Oh, and there's > no TMTOWTDI. Now, now... Guido came to NY.pm last week, and he showed us *three* ways to do something. :-) Kidding aside, Python *is* an interesting language while at the same time *not* suited to everybody's mindset. And Guido seems like a perfectly nice fellow. We avoided bloodshed. :-) dha -- David H. Adler - - http://www.panix.com/~dha/ Don't you remember High School? I know, for myself, I was a walking hormone. - Alyson Hannigan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Feb 7 21:01:55 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl URLs Message-ID: <20020207190155.A2792@timji.consultix.wa.com> There are some essential links at http://www.raycosoft.com/rayco/support/resources.html#perl Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Pommert, Daniel" To: "'Colin Meyer'" ; "Pommert, Daniel" Cc: Sent: Thursday, February 07, 2002 8:34 AM Subject: RE: SPUG: Perl URLs? > Thanks, these URLs helped with the Perl 6 question. > > But, actually, I was interested in a list (with descriptions) of URLs so > that I could beef up my Perl Favorites/Bookmarks folder with useful and > interesting places for Perl in general. > > Any further suggestions? > > Thanks, > -- Daniel Pommert > Verizon Wireless > 425-603-8612 > > -----Original Message----- > From: Colin Meyer [mailto:cmeyer@helvella.org] > Sent: Wednesday, February 06, 2002 3:50 PM > To: Pommert, Daniel > Cc: 'spug-list@pm.org' > Subject: Re: SPUG: Perl URLs? > > > Hi Daniel, > > On Wed, Feb 06, 2002 at 02:12:08PM -0800, Pommert, Daniel wrote: > > I was just wondering what the status of Perl 6 was. So, I decided to look > > on the Web when I realized that I didn't have the current URLs. Is it > > perl.com, perl.org, perlmonger.org, etc? > > > > Could someone(s) post a current list of URLs (beyond > > http://www.seattleperl.org , of course!) that > > are useful references for Perl, along with a brief description of each? > > For Perl6, a good reference point is: http://dev.perl.org/perl6/ > For information on what the language will be like, read the Apocalypses > and Exegeses. > > For info on the bytecode interpreter (and eventually the Perl6 compiler, > as well as other parrot bytecode target compilers), check > http://parrotcode.org/ > > Have fun, > -C. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Feb 7 23:15:06 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Feb. Meeting: Magazine Talks! Message-ID: <20020207211506.A4054@timji.consultix.wa.com> 2/19/02 SPUG Meeting "Magazine Talks & Lightning Talks" CALL FOR PARTICIPANTS Magazine Talks -------------- The debut issue of The Perl Review arrived on-line earlier this week (www.perl.org/ThePerlReview/), adding another publication to the World of Perl! This event reminds me of something I've been fantasizing about for some time: A "Magazine Night", where we discuss interesting articles from past issues of Perl publications (including those existing in paper, PDF, Ezine (any left?), and HTML form). I've provided a list of some sample articles below, representing many different application areas. I'm asking for volunteers who'll read an article, and make a presentation to the group on it. The presentation should include a summary of the article's contents, representative code samples, a live demo (if relevant), ideas for how we could apply the lessons of the article, etc. Anyone who would prefer to cover an Article I haven't listed, a Chapter from a Book, or even a Discussion Thread, is welcome to do so. The only requirement is that you clear your idea with me in advance (so we can avoid duplication of efforts), and provide a URL (or other reference) so others can have a chance to read it too. The length of the talks will depend on how many we need to accommodate in our allotted time, but I'm figuring on 15 minutes minimum, possibly ranging up to 30 minutes (including a Q/A period). Scheduling preference will be given to those who respond by 2/13. Once the schedule is settled, I'll post the list of articles to the spug-list, so those who wish may read them in advance. Lightning Talks --------------- Anybody who wants to give a brief talk on any Perlish topic, like your latest module, Larry's latest Apocalypse, etc., is also welcome. SAMPLE ARTICLES --------------- Structured Classes in Perl http://www.perl.org/ThePerlReview/ Helping the Disabled with Perl/TK http://www.sysadminmag.com/tpj/, from Issue #22, Winter, 2001 Creating XML-RPC Web Services http://www.sysadminmag.com/tpj/, from Issue #22, Winter, 2001 Building Directory Services with Net::LDAP From TPJ Issue #20, Winter 2000, pp. 53-60 (this and following TPJ articles not online anymore) Finance::Quote, Finance::QuoteHist and HTML::TableExtract From TPJ Issue #19, Fall 2000, pp. 40-50. Filtering Mail with Mail::Audit and News::Gateway From TPJ Issue #18, Summer 2000, pp. 12-16. Tktk:: A Perl/TK Solitaire Game From TPJ Issue #18, Summer 2000, pp. 17-21. http://home.hiwaay.net/~gbacon/perl/tktk.tar.gz ** AND, WE MUSTN'T FORGET THE EVER-POPULAR: "Your_Favorite_Article_Goes_Here!" Please join in and make this a fun event! -Tim P.S. Upcoming speakers: March: Colin Meyer, discussing exotic topics within the realm of Database Programming July: "The Damian", talking about whatever he wants! BRACE YOURSELVES! 8-} ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Fri Feb 8 03:54:14 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: <20020207091836.B5169@hobart.helvella.org> Message-ID: On Thu, 7 Feb 2002, Colin Meyer wrote: > On Thu, Feb 07, 2002 at 01:45:26AM -0800, Andrew Sweger wrote: > > On Wed, 6 Feb 2002, Colin Meyer wrote: > > > > > You'd rather that there was a FlipFlop class object that provided an > > > accessor to that state? > > > > Amen. I mean, yes. > > Perhaps you'd be more comfortable with Python then? ;-) Instead of ops > like .. or =~ s///g, everything is done with objects. Oh, and there's > no TMTOWTDI. Good heavens, no! I only wanted to express that there is a practical limit. Perl did get its "line noise" reputation for a reason after all. I feel that production quality Perl should be readable by other Perl graduates (think of it like a bachelor's degree, it means someone knows enough about Perl to get by without being told what to do). PhD Perl should be (p)reserved as art (I'm excluding abstractions of good quality, of course, as that's the whole point to them). I would encourage an explicit FlipFlop class in any large production. (Reduced to native or builtin structures in response to optimizations where needed, natch.) Give me TMTOWTDI or give me death. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ilove at mailto.co.kr Fri Feb 8 08:35:40 2002 From: ilove at mailto.co.kr (±îÆäÁö±â) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: ¡Ú¾È³çÇϼ¼¿ä. ¼³³¯Æ¯º° ¹«·áº¹±ÇÀÔ´Ï´Ù!!! ( ±¤ °í ) Message-ID: <200202081437.g18EbOk27777@mail.pm.org> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020208/380d6d4f/attachment.htm From wnorth at state.mt.us Fri Feb 8 13:53:03 2002 From: wnorth at state.mt.us (North, Walter) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: printing reports Message-ID: Hi all, hope you can help me. I've got a problem which I can't seem to figure out. I have serveral data files which depending on a certain criteria have to be printed out to different formats. The first report does just fine but when I get to the second report it does not print the top until the 2nd page, even if it uses the same format as the previous report. This behavior continues through out the remaining reports no matter the format used. The data, however, comes out with the right format even on the headerless first page and starting with what should be page 2 I get the header for page 1 and the data for page 2. I use the following to define the format for each data file. Use IO::Handle; open PRTFILE, ">>$PRTFILE" or die "blah blah\n"; If ($TYPE eq "A") { PRTFILE->format_name("APRTFILE"); PRTFILE->format_top_name("APRTFILE_TOP"); while () { < do some stuff > write PRTFILE; } } elsif ($TYPE eq "D") { PRTFILE->format_name("DPRTFILE"); PRTFILE->format_top_name("DPRTFILE_TOP") while () { < do some stuff > write PRTFILE; } } I'm sure its pretty simple, but for some reason I am baffled. TIA ----------------------------------------------------- Walter North 406-444-2914 Operating Systems Programmer wnorth@state.mt.us A prohibitionist is the sort of man one wouldn't care to drink with -- even if he drank. -- H.L. Mencken ----------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Fri Feb 8 14:27:06 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: printing reports In-Reply-To: References: Message-ID: <20020208122705.A9333@hobart.helvella.org> Hi Walter, On Fri, Feb 08, 2002 at 12:53:03PM -0700, North, Walter wrote: > > I use the following to define the format for each data file. > > Use IO::Handle; > open PRTFILE, ">>$PRTFILE" or die "blah blah\n"; > If ($TYPE eq "A") { > PRTFILE->format_name("APRTFILE"); > PRTFILE->format_top_name("APRTFILE_TOP"); ... In order to be able to use the method calls from IO::File, you need to use an IO::File object instead of the traditional Perl FILEHANDLE. Try something like: use IO::Handle; my $prtfile = IO::File->new; # creating the IO::File object $prtfile->open(">>$PRTFILE") or die "..."; $prtfile->format_name("..."); # ... You may want to read the IO::Handle and IO::File perldoc pages for more info. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From spug at w3.zipcon.net Fri Feb 8 17:40:36 2002 From: spug at w3.zipcon.net (spug@w3.zipcon.net) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Please forward to spug-list Message-ID: <20020208154217.D9333@hobart.helvella.org> SPUGsters! The consultix-inc.com domain is currently not working (DNS problem), so anybody trying to send Email to Tim Maher (to volunteer topics for this month's meeting, etc.) please use the following address until further notice: tim@teachmeperl.com Thanks! -Tim P.S. www.teachmeperl.com will also work for my Company's web-page, instead of www.consultix-inc.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Fri Feb 8 11:31:45 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Korean Spam Message-ID: <20020208093145.A7923@timji.consultix.wa.com> Just a quick note to point out the latest SPAM specs: our new filters caught two messages this week (which for that reason you never saw), and let one through - the "Korean" language one that appeared today. I've added two more regexes to the "filter pool" that should trap future messages of its type. -Tim ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jay at Scherrer.com Fri Feb 8 21:24:53 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Korean Spam In-Reply-To: <20020208093145.A7923@timji.consultix.wa.com> References: <20020208093145.A7923@timji.consultix.wa.com> Message-ID: <200202090324.g193Osi04545@localhost.localdomain> Tim, Perhaps you could show this regex at a future meeting. I actually thaught that there were korean Spugsters on the list. Jay On Friday 08 February 2002 09:31 am, Tim Maher wrote: > Just a quick note to point out the latest SPAM specs: our new filters > caught two messages this week (which for that reason you never saw), > and let one through - the "Korean" language one that appeared today. > I've added two more regexes to the "filter pool" that should trap future > messages of its type. > > -Tim > ====================================================== > > | Tim Maher, Ph.D. tim@timmaher.org | > | SPUG Founder & Leader spug@seattleperl.org | > | Seattle Perl Users Group www.seattleperl.org | > > ====================================================== > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Sun Feb 10 13:57:13 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: Message-ID: Andrew Sweger writes: [...] > Give me TMTOWTDI or give me death. > > -- > Andrew B. Sweger -- The great thing about multitasking is that several > things can go wrong at once. The justoposition is too funny to ignore!!! :-) -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Sun Feb 10 13:47:36 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> Message-ID: dancerboy writes: [...] > Perhaps my complaint should more properly be with the > docs, rather than with the operator itself. To be > perfectly honest, I read and reread that section of the > docs, and eventually just gave up; I *still* don't fully > understand what .. and ... do in scalar context. And I > don't think that I'm particularly dense when it comes to > things like this -- if I had difficulty understanding it, > I'm pretty sure most other developers will have difficulty > with it as well. It's possible that, if the docs > contained a more coherent explanation of what these things > do, I might change my opinion. But given the current > state of the docs, I'd say scalar .. is going to be > difficult for the average Perl developer to decipher. I, too, had a hard time with that documentation. It sat on the back burner for a few years before it became *very* useful. Then, as Colin pointed out, the alternative code introduced a stuctural variable and a complex control structure that was better coded with the flip-flop control structure than the equivalent long idiomatic phrase. Again, as you suggest, a good example would overcome bad documentation and prevent even worse code. Here's an example that helped me figure it out. Consider an RFC 822 email. A header is from the first line (1) to the first blank line (/^$/). A body line is from that line until the last line ($). Note that dollar ($) means "end of string" in the RE and "last line" in the flip-flop. $header .= $_ if 1 .. /^$/; $body .= $_ if /^$/ .. $; I've finally figured out the difference between .. and ..., but don't have a good example. The bad (contrived) example I have is below. It shows that the flip-flop could turn off on the same line that turned it on. #! /usr/bin/perl -w while() { next if /^$/; # Skip blank lines. next if m/^\s*/; # Skip shell-style comments. chomp; $data .= $_ if /BEGIN/ ... /END/ } __DATA__ # This is a multi-line data block. BEGIN Long data goes here. It can span multiple lines. The beginning and ending tags are on separate lines. END # This is a single-line data block. BEGIN Short data can start/end on same line. END __END__ -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wnorth at state.mt.us Mon Feb 11 10:19:25 2002 From: wnorth at state.mt.us (North, Walter) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: More printing reports Message-ID: Thanks to Colin for his attempt to aid me but perhaps I did not make myself compeletely clear. I tried a number of variations but still end up the same. No header on 1st page of my reports after the first report. This is a description of what I'm trying to do: I have a series of reports I want to print as I process them thru a perl script. The first one prints out just fine, the next one does not print the header (top) at the top of the 1st page. Instead it prints it at the top of the 2nd page calling it page 1 even tho its page 2. All data comes out perfectly. I am doing this. ( different then my first post, but same result ) use FileHandle; # loop thru a list of files foreach $FILE (@LIST_OF_FILES) { < Do some stuff like create PRTFILE based on FILE etc > open FILE, "<$FILE" or die "blah blah" open APRTFILE, ">>$PRTFILE" or die "blah blah"; APRTFILE->$format_name("A_FORMAT"); APPRTFILE->$format_top_name("A_FORMAT_TOP"); # loop thru the contents of FILE while () { chomp; write APRTFILE; } # end of loop thru a file close APRTFILE; close FILE; } # end of loop thru a list of files First report comes out perfectly, page 1 header on page 1 followed by data, page 2 header on page 2 followed by data, etc. All subsequent start with the data on page one then on page 2 the header claiming to be page one (even tho its page 2) and then the data and so on thru the reports. I obviously have missed something simple because this should be a simple thing to do. TIA ----------------------------------------------------- Walter North 406-444-2914 Operating Systems Programmer wnorth@state.mt.us A prohibitionist is the sort of man one wouldn't care to drink with -- even if he drank. -- H.L. Mencken ----------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dcd at tc.fluke.com Mon Feb 11 10:28:36 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: Message-ID: On 10 Feb 2002 at 14:47 -0500, Michael R. Wolf ...: > Note that dollar ($) means ... > ... "last line" in the flip-flop. > > $body .= $_ if /^$/ .. $; I don't think this does what you want $ perl -wnle 'print "x$_" if 2 .. $;' 1 2 x2 3 4 as you can see. I think it is parsed as the variable "$;", so it is true all the time, an you only get .. to be true once, as it goes false the next time. perldoc perlvar $; The subscript separator for multidimensional array emulation. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Mon Feb 11 11:28:43 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: More printing reports In-Reply-To: References: Message-ID: <20020211092843.A13352@hobart.helvella.org> Hi Walter, On Mon, Feb 11, 2002 at 09:19:25AM -0700, North, Walter wrote: > > Thanks to Colin for his attempt to aid me but perhaps I did not make > myself compeletely clear. I tried a number of variations but still > end up the same. No header on 1st page of my reports after the first > report. ... > > use FileHandle; > # loop thru a list of files > foreach $FILE (@LIST_OF_FILES) { > < Do some stuff like create PRTFILE based on FILE etc > > open FILE, "<$FILE" or die "blah blah" > open APRTFILE, ">>$PRTFILE" or die "blah blah"; > APRTFILE->$format_name("A_FORMAT"); > APPRTFILE->$format_top_name("A_FORMAT_TOP"); > # loop thru the contents of FILE > while () { > chomp; > > write APRTFILE; > } # end of loop thru a file > close APRTFILE; > close FILE; > } # end of loop thru a list of files In order to use the method call syntax (APRTFILE->format_name()) with filehandles, you need to use FileHandle (or IO::File) objects. You cannot use the traditional filehandles. If this doesn't make sense, then a reading of the perlboot manpage might help. I've again tried to rearrange your code excerpt to use FileHandle (which inherit from IO::File) objects. Have fun, -C. Try this [not tested]: use FileHandle; foreach $FILE (@LIST_OF_FILES) { #< Do some stuff like create PRTFILE based on FILE etc > # FILE is a traditional Perl filehandle open FILE, "<$FILE" or die "blah blah" # $aprtfile is a FileHandle object my $aprtfile = FileHandle->new; # instead of saying: #open APRTFILE, ">>$PRTFILE" or die "blah blah"; # we say: $aprtfile->open(">>$PRTFILE") or die "blah blah"; # method call syntax doesn't work with traditional filehandles #APRTFILE->$format_name("A_FORMAT"); # use FileHandle objects instead $aprtfile->format_name("A_FORMAT"); $aprtfile->format_top_name("A_FORMAT_TOP"); # loop thru the contents of FILE while () { chomp; # # this is how we would have done it # with traditional filehandles # write APRTFILE; # it is done with FileHandle objects like so: $aprtfile->write; } # end of loop thru a file # traditional filehandle: # close $aprtfile ; # oo style: $aprtfile->close or die "Problem writing to aprtfile: $!"; # always check for possible errors when closing a filehandle that # was written to. close FILE; } # end of loop thru a list of files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Mon Feb 11 13:29:24 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: Message-ID: David Dyck writes: > On 10 Feb 2002 at 14:47 -0500, Michael R. Wolf ...: > > > Note that dollar ($) means ... > > ... "last line" in the flip-flop. > > > > $body .= $_ if /^$/ .. $; > I don't think this does what you want But I think this does: $body .= $_ if (/^$/ .. $); As somebody's mother said, the supply of parenthesis in the universe is unlimited. Thanks for your "parser eyes"; alas, I'm stuck on a laptop at 95% full and no room for Perl. Thanks, Michael P.S. Would someone pipe this message through thes commands and report out confirmation? perl -n -e '$body .= $_ if (/^$/ .. $);' \ -e '$head .= $_ if (1 .. /^$/);' \ -e 'END{print $head, "\n", "="x40, "\n", $body;}' -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Mon Feb 11 14:18:16 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: <119140000.1012941463@flashingchance> <20020205161509.B1565@hobart.helvella.org> <20020206000038.H1565@hobart.helvella.org> Message-ID: <20020211121816.B13572@hobart.helvella.org> Hi Michael, On Sun, Feb 10, 2002 at 02:47:36PM -0500, Michael R. Wolf wrote: ... > > I've finally figured out the difference between .. and ..., > but don't have a good example. The bad (contrived) example > I have is below. It shows that the flip-flop could turn off > on the same line that turned it on. Or you could say: The difference is that ... will never return '1E0', whereas .. might. Which is to say that ... disallows both edge conditions (switching from one state to the other) from happening within a single evaluation. The example program I posted the other day illustrates this nicely, with similarly contrived data. ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Mon Feb 11 15:04:18 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: References: Message-ID: <116910000.1013461457@benzene.cobaltgroup.com> -- "Michael R. Wolf" spake thusly: > David Dyck writes: > >> On 10 Feb 2002 at 14:47 -0500, Michael R. Wolf >> ...: >> >> > Note that dollar ($) means ... >> > ... "last line" in the flip-flop. >> > >> > $body .= $_ if /^$/ .. $; > >> I don't think this does what you want > > But I think this does: > > perl -n -e '$body .= $_ if (/^$/ .. $);' \ > -e '$head .= $_ if (1 .. /^$/);' \ > -e 'END{print $head, "\n", "="x40, "\n", $body;}' This gives: syntax error at -e line 1, near "$);" Execution of -e aborted due to compilation errors. This code: perl -n -e '$body .= $_ if /^$/ .. $ ;' \ -e '$head .= $_ if (1 .. /^$/);' \ -e 'END{print $head, "\n", "="x40, "\n", $body;}' gives: Scalar found where operator expected at -e line 2, near "$ ; $head" (Missing semicolon on previous line?) syntax error at -e line 2, near "$ ; $head " Execution of -e aborted due to compilation errors. I've never seen just a bare '$' in Perl to indicate "last line". Do you have any documentation to support the existence of it? Regardless, doing the following gives the correct behavior: perl -n -e '$body .= $_ if /^$/ .. 0;' \ -e '$head .= $_ if (1 .. /^$/);' \ -e 'END{print $head, "\n", "="x40, "\n", $body;}' -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020211/d42a0d21/attachment.bin From ced at carios2.ca.boeing.com Mon Feb 11 17:23:29 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops Message-ID: <200202112323.PAA05522@carios2.ca.boeing.com> >$ perl -wnle 'print "x$_" if 2 .. $;' >... >as you can see. I think it is parsed >as the variable "$;", so it is true Deparse confirms it too: perl -MO=Deparse,-p -e 'print "x$_" if 2 .. $;' ((2 .. $;) and print("x$_")); -e syntax OK Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Tue Feb 12 13:23:53 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Perl Journal News Message-ID: <20020212112353.B28195@timji.consultix.wa.com> SPUGsters, I've just been e-chatting with Jon Orwant, senior TPJ editor, and he tells me that he's turning the TPJ issues he edited into three "Best of TPJ" books, to be published by O'Reilly in May, June, and July, with some of the authors donating their stipends to YAS. The books are: * Computer Science & Perl Programming: Best of The Perl Journal * Web, Graphics & Perl/Tk: Best of The Perl Journal * Games, Diversions & Perl Culture: Best of The Perl Journal The first book is nearing completion and will be about 650 pages with 71 articles by 41 contributors. The second and third books will be smaller, perhaps around 400 pages each. And by the way, despite rumours to the contrary, The Perl Journal is still in existence; surf on over to www.tpj.com for details. -Tim ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Tue Feb 12 18:00:03 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: sendmail from Perl (quick newbie question) Message-ID: Okay, this is more of a sendmail question than a Perl question, but I figure there are many on this list who will be able to answer it in 10 seconds flat, whereas it would take me considerable amounts of digging to find the answer in an "appropriate" forums... How do you send to multiple addresses using sendmail? I've got a super-simple form-to-email CGI that accesses sendmail like this: sub send_mail { my $mailprog = '/usr/lib/sendmail'; my ( $to_addy, $from_addy, $from_realname, $subject, $msg_body ) = @_; #### [ ... verifications omitted here for brevity ... ] open(MAIL,"|$mailprog -t") || die "Couldn't open |$mailprog -t: !"; # Open The Mail Program (print MAIL "To: $to_addy\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "From: $from_addy ($from_realname)\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "Subject: $subject\n\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "$msg_body\n") || die "Couldn't print to |$mailprog -t: $!"; close (MAIL) || die "Error closing $mailprog: $!"; } I now need to modify the form so that it sends copies of the message to multiple addresses. I had thought that just putting multiple addresses on the "To:" line, separated by commas, would do the trick, but it doesn't: when I set $to_addy to something like 'test_address_1@myserver.com, test_address_2@myserver.com, test_address_3@myserver.com' the message gets sent only to the first address in the list (test_address_1@myserver.com) not to any of the others. What's the correct syntax for sending to more than one address? Thanks. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Tue Feb 12 18:43:33 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: Bit::FlipFlop [was Re: SPUG: flip-flops] In-Reply-To: References: <20020207091836.B5169@hobart.helvella.org> Message-ID: <20020212164333.D15153@hobart.helvella.org> On Fri, Feb 08, 2002 at 01:54:14AM -0800, Andrew Sweger wrote: > On Thu, 7 Feb 2002, Colin Meyer wrote: > > > On Thu, Feb 07, 2002 at 01:45:26AM -0800, Andrew Sweger wrote: > > > On Wed, 6 Feb 2002, Colin Meyer wrote: > > > > > > > You'd rather that there was a FlipFlop class object that provided an > > > > accessor to that state? > > > > > > Amen. I mean, yes. [...] > > I would encourage an explicit FlipFlop class in any large production. > (Reduced to native or builtin structures in response to optimizations > where needed, natch.) Well, here you go: NAME Bit::FlipFlop - Facilitates the maintainance of one bit of state in Perl programs. SYNOPSIS use Bit::FlipFlop; my $f = Bit::FlipFlop->new(set => sub { /start/ }, reset => sub { /end/ }); for () { $f->test; print "**leading edge**\n" if $f->lead_edge; print "number ", $f->series, ": $_" if $f->state; print "**trailing edge**\n" if $f->trail_edge; } . . . Read the full documentation at: http://helvella.org/Bit::FlipFlop.html Download the module: http://helvella.org/Bit-FlipFlop-0.01.tar.gz I think that actually using this module is rediculous. ;-) Why did I do it? Well, for fun. Also, I think that it will be instructive to those who are struggling over learning the flip flop op from the straight Perl docs. And I really wanted to try my hand at expressing digital logic with ascii art: ___ $a $b | $o $a -----| \ ---------|---- | |o---- $o F F | T $b -----|___/ T F | T F T | T T T | F (This won't be pretty to those viewing with a proportional font. It might not be pretty to those using a fixed width font either.) ;-) > > Give me TMTOWTDI or give me death. Hear hear! ;-) Have fun, -C. > > -- > Andrew B. Sweger -- The great thing about multitasking is that several > things can go wrong at once. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Tue Feb 12 18:48:44 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: <116910000.1013461457@benzene.cobaltgroup.com> References: <116910000.1013461457@benzene.cobaltgroup.com> Message-ID: Matt Tucker writes: [...] > I've never seen just a bare '$' in Perl to indicate "last > line". Do you have any documentation to support the > existence of it? Regardless, doing the following gives the > correct behavior: > > perl -n -e '$body .= $_ if /^$/ .. 0;' \ > -e '$head .= $_ if (1 .. /^$/);' \ > -e 'END{print $head, "\n", "="x40, "\n", $body;}' You're right - dollar doesn't mean last line. Despite being an emacs bigot, I had my vi brain on. Imagine that! I even surprised myself. So... I went to the CD and looked it up. I had the right concept (last line), but the wrong syntax ($); the right syntax is, surprisingly, eof(). Here's the code that should work (Oh, not that trick Bullwinkle, it never works... But this time for sure...). perl -n -e '$body .= $_ if /^$/ .. eof();' \ -e '$head .= $_ if (1 .. /^$/);' \ -e 'END{print $head, "\n", "="x40, "\n", $body;}' BTW -- Matt's code would work for 1 file as input, but since the body flip-flop latches on, it will miss the EOF condition as subsequent files are processed. If this code was meant to process multiple files (via <>), the eof() test is better, but would necessitate a "close ARGV if eof()" to allow resetting $.. Other problems with this snippet that prevent it from looping over multiple files, so it's a good example. And a quote from the Camel book, via the O'Reilly CD bookshelf. Camel CD> In a scalar context, .. returns a Boolean value. The Camel CD> operator is bi-stable, like an electronic flip-flop, and Camel CD> emulates the line-range (comma) operator of sed, awk, and Camel CD> various editors. Each scalar .. operator maintains its own Camel CD> Boolean state. It is false as long as its left operand is Camel CD> false. Once the left operand is true, the range operator Camel CD> stays true until the right operand is true, after which the Camel CD> range operator becomes false again. (The operator doesn't Camel CD> become false until the next time it is evaluated. It can Camel CD> test the right operand and become false on the same Camel CD> evaluation as the one where it became true (the way awk's Camel CD> range operator behaves), but it still returns true once. If Camel CD> you don't want it to test the right operand until the next Camel CD> evaluation (which is how sed's range operator works), just Camel CD> use three dots (...) instead of two.) The right operand is Camel CD> not evaluated while the operator is in the false state, and Camel CD> the left operand is not evaluated while the operator is in Camel CD> the true state. Camel CD> Camel CD> The precedence is a little lower than || and &&. The value Camel CD> returned is either the null string for false, or a sequence Camel CD> number (beginning with 1) for true. The sequence number is Camel CD> reset for each range encountered. The final sequence number Camel CD> in a range has the string "E0" appended to it, which doesn't Camel CD> affect its numeric value, but gives you something to search Camel CD> for if you want to exclude the endpoint. You can exclude the Camel CD> beginning point by waiting for the sequence number to be Camel CD> greater than 1. If either operand of scalar .. is a numeric Camel CD> literal, that operand is evaluated by comparing it to the Camel CD> $. variable, which contains the current line number for your Camel CD> input file. Examples: Camel CD> Camel CD> As a scalar operator: Camel CD> Camel CD> if (101 .. 200) { print; } # print 2nd hundred lines Camel CD> next line if (1 .. /^$/); # skip header lines Camel CD> s/^/> / if (/^$/ .. eof()); # quote body Camel CD> -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Tue Feb 12 19:13:11 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Meeting Announcements In-Reply-To: <20020213004736.28942.qmail@w3.zipcon.net>; from spug@w3.zipcon.net on Tue, Feb 12, 2002 at 04:47:36PM -0800 References: <20020213004736.28942.qmail@w3.zipcon.net> Message-ID: <20020212171311.A30474@timji.consultix.wa.com> SPUGsters, Here's the list of upcoming meeting topics, through July. (Same info is now on the web site, seattleperl.org). Regarding next week's "Magazine/Lightning Talks" event, we can still accommodate another speaker or two, if any of you LURKERS out there want to come forward and participate for a change! 8-} Finally, those who do attend next week's meeting are advised that they'll get the most out of the talks by reading the indicated reference for each topic (see below), in preparation. -Tim P.S. Anybody checked out the saltlake2002.com web site? The "main guy" behind it is one of next week's speakers! ------------------------------------------------------------- UPCOMING SPUG MEETINGS Time & Place: 7-9pm, Safeco Building All interested parties are welcome! See www.seattleperl.org for complete details ------------------------------------------------------------- February Meeting: Tuesday, 02/19/02 "Short Talks on Perl Topics" "Perl's Flip-Flop Operator" and "Python for Perl Weenies" Colin Meyer, Helvella Reference: man perlop; see "range operator" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Parsing Protein Domains with Perl" and "General Comments on Perl for Bioinformatics" Eric Olson, Neobase, Inc. Reference: http://www.perl.com/pub/a/2001/11/16/perlbio2.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Creating XML-RPC Web Services" Joshua Lanza, Vorsite Corp. Reference: TPJ Issue #22, Winter, 2001 at: http://www.sysadminmag.com/tpj/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "The Name Game" Tim Maher, Consultix, Inc. Reference: TPJ #15, Fall, 1999, p. 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "And Other Topics" Just Might be Covered by Additional Speakers; LIKE YOU! ------------------------------------------------------------- March Meeting: Tuesday, 03/20/02 "Topics in Database and CGI Programming" by Colin Meyer, Helvella Colin will be discussing some new topics that go beyond what he covered in his talk last Fall. Incidentally, he'll also be presenting a public offering of his popular "Database Programming with Perl" class from 4/22 - 4/25 in Kirkland, WA. Full details are available at teachmeperl.com ------------------------------------------------------------- April - June Meetings, 4/16, 5/21, 6/18: We're Accepting Proposals! ------------------------------------------------------------- July Meeting: Tuesday, 07/17/02: "Perlish Musings of 'The Damian'" by Damian Conway, "The Original Perl Serf" Brought to you by Yet Another Society and Consultix, Inc. Damian will be presenting a spellbinding talk on a fascinating topic that will be so brilliantly conceived and executed that you'd be crazy to miss it, but terrified if you knew the full details in advance. So appreciate your current state of ignorance, but brace yourself the night of the talk! Also, while he's in the Seattle area, Damian will be presenting a series of seminars called the "Advanced Perl Workshop". Details will be periodically updated at: http://www.teachmeperl.com/sched.html#Damian ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From adamm at wazamatta.com Tue Feb 12 19:53:01 2002 From: adamm at wazamatta.com (Adam Monsen) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: ; from MichaelRunningWolf@att.net on Tue, Feb 12, 2002 at 07:48:44PM -0500 References: <116910000.1013461457@benzene.cobaltgroup.com> Message-ID: <20020212175301.A10948@wazamatta.com> On 12/02/02 19:48 -0500, Michael R. Wolf wrote: [...] > perl -n -e '$body .= $_ if /^$/ .. eof();' \ > -e '$head .= $_ if (1 .. /^$/);' \ > -e 'END{print $head, "\n", "="x40, "\n", $body;}' [...] That's cool. I'm currently taking a C class, and it's fun as hell to prototype the smaller problems in Perl one-liners. It is actually helpful, too, to start with extremely terse Perl, expand [loops, range/flip-flop operations, etc] into verbose Perl, then rewrite it in C. -- Adam Monsen - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Tue Feb 12 20:06:59 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Meeting Announcements In-Reply-To: <20020212171311.A30474@timji.consultix.wa.com> References: <20020213004736.28942.qmail@w3.zipcon.net> <20020212171311.A30474@timji.consultix.wa.com> Message-ID: <20020212180659.F15153@hobart.helvella.org> On Tue, Feb 12, 2002 at 05:13:11PM -0800, Tim Maher wrote: > SPUGsters, > > Here's the list of upcoming meeting topics, through July. (Same info is now > on the web site, seattleperl.org). > > Regarding next week's "Magazine/Lightning Talks" event, we can still > accommodate another speaker or two, if any of you LURKERS out there want > to come forward and participate for a change! 8-} > > Finally, those who do attend next week's meeting are advised that they'll > get the most out of the talks by reading the indicated reference for > each topic (see below), in preparation. > > -Tim > P.S. Anybody checked out the saltlake2002.com web site? The "main guy" > behind it is one of next week's speakers! Well, at least behind the database that coordinated volunteers' by their interests and abilities. ;-) > > "Perl's Flip-Flop Operator" and "Python for Perl Weenies" > Colin Meyer, Helvella > Reference: man perlop; see "range operator" That's one problem with the Perl documentation: scalar .. isn't the range operator, it's the flip flop op! List context .. is the range operator. Despite the similarity in syntax, it's much easier to think of them as different ops. see also: http://helvella.org/Bit::FlipFlop.html Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Wed Feb 13 09:07:01 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: sendmail from Perl (quick newbie question) In-Reply-To: Message-ID: Jason, This doesn't answer your question in any way, but have you looked at any of the email modules on CPAN? The Mail::Sendmail module is simple, fast, and easy to use, unless you're sending attachments. If you're sending attachments Mail::Sender is a good choice, tho it seems to be significantly slower than Mail::Sendmail. Both of these will accept addresses separated by comas. Thanks, Peter Darley -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of dancerboy Sent: Tuesday, February 12, 2002 4:00 PM To: Seattle Perl Users Group Subject: SPUG: sendmail from Perl (quick newbie question) Okay, this is more of a sendmail question than a Perl question, but I figure there are many on this list who will be able to answer it in 10 seconds flat, whereas it would take me considerable amounts of digging to find the answer in an "appropriate" forums... How do you send to multiple addresses using sendmail? I've got a super-simple form-to-email CGI that accesses sendmail like this: sub send_mail { my $mailprog = '/usr/lib/sendmail'; my ( $to_addy, $from_addy, $from_realname, $subject, $msg_body ) = @_; #### [ ... verifications omitted here for brevity ... ] open(MAIL,"|$mailprog -t") || die "Couldn't open |$mailprog -t: !"; # Open The Mail Program (print MAIL "To: $to_addy\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "From: $from_addy ($from_realname)\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "Subject: $subject\n\n") || die "Couldn't print to |$mailprog -t: $!"; (print MAIL "$msg_body\n") || die "Couldn't print to |$mailprog -t: $!"; close (MAIL) || die "Error closing $mailprog: $!"; } I now need to modify the form so that it sends copies of the message to multiple addresses. I had thought that just putting multiple addresses on the "To:" line, separated by commas, would do the trick, but it doesn't: when I set $to_addy to something like 'test_address_1@myserver.com, test_address_2@myserver.com, test_address_3@myserver.com' the message gets sent only to the first address in the list (test_address_1@myserver.com) not to any of the others. What's the correct syntax for sending to more than one address? Thanks. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Wed Feb 13 10:03:46 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: Bit::FlipFlop [was Re: SPUG: flip-flops] In-Reply-To: <20020212164333.D15153@hobart.helvella.org> References: <20020207091836.B5169@hobart.helvella.org> <20020212164333.D15153@hobart.helvella.org> Message-ID: Colin Meyer writes: [...] > > ___ $a $b | $o > $a -----| \ ---------|---- > | |o---- $o F F | T > $b -----|___/ T F | T > F T | T > T T | F > > > (This won't be pretty to those viewing with a proportional font. It might > not be pretty to those using a fixed width font either.) Beautiful! It's my eyes, I behold Beauty! -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Wed Feb 13 10:14:33 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: flip-flops In-Reply-To: <20020212175301.A10948@wazamatta.com> References: <116910000.1013461457@benzene.cobaltgroup.com> <20020212175301.A10948@wazamatta.com> Message-ID: Adam Monsen writes: > On 12/02/02 19:48 -0500, Michael R. Wolf wrote: > [...] > > perl -n -e '$body .= $_ if /^$/ .. eof();' \ > > -e '$head .= $_ if (1 .. /^$/);' \ > > -e 'END{print $head, "\n", "="x40, "\n", $body;}' > [...] > > That's cool. > > I'm currently taking a C class, and it's fun as hell to > prototype the smaller problems in Perl one-liners. It is > actually helpful, too, to start with extremely terse Perl, > expand [loops, range/flip-flop operations, etc] into > verbose Perl, then rewrite it in C. So, you're a deconstructionist[1]? 0 \ -- ) 0 / It seems that your method of learning C (expanded Perl), is actually my motivation for learning Perl (compressed C). We're on opposite sides of the same circle. It's a yin-yang thin-thang.... _________ , ` ` / \ \ / X :-)-: \ | / | | / | \ :-(-: 0 . \ \ / \______\_____/ Not to be outdone by Colin's ASCII art!!! Enjoy, Michael [1] deconstruction n : a philosophical theory of criticism (usually of literature or film) that seeks to expose deep-seated contradictions in a work by delving below its surface meaning [syn: deconstructionism] Source: WordNet ? 1.6, ? 1997 Princeton University -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From benjamin at dzhan.com Wed Feb 13 10:28:39 2002 From: benjamin at dzhan.com (Benjamin Franks) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: reducing memory footprint of forked children? Message-ID: <20020213082207.Q5579-100000@crimea.dzhan.com> In programs where a parent forks off a number of child processes, is there a way to reduce the memory footprint of the child processes? If I understand correctly, the child inherits a duplicate copy of the parents variables, etc.. Can the child explicitly undefine parent variables the child doesn't need? What about unecessary modules the parent needs that the child doesn't---can modules be unloaded in the child? Even if these techniques did reduce the memory consumption of the child, would it be visible on a program like top (or something similar) or would the memory be unused but held until child death? Is there a way to force a reallocation of unused memory while the child is running, or is that more of an OS issue? Thanks, --Ben Franks - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pfarrall at gis.usu.edu Wed Feb 13 10:31:12 2002 From: pfarrall at gis.usu.edu (Paul Farrall) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: sendmail from Perl (quick newbie question) In-Reply-To: Message-ID: On Tue, 12 Feb 2002, dancerboy wrote: d> How do you send to multiple addresses using sendmail? I've got a /usr/lib/sendmail address1 address2 ... Paul - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Wed Feb 13 10:52:40 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: CPAN question Message-ID: Friends, Is there any way that I can get CPAN to not try to upgrade my perl 5.005 to perl 5.6? I don't have the libs installed to use 5.6, but would like to be able to use 'perl -MCAPN -e shell'. Thanks, Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at colltech.com Wed Feb 13 11:03:03 2002 From: jimfl at colltech.com (Jim Flanagan) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: reducing memory footprint of forked children? In-Reply-To: <20020213082207.Q5579-100000@crimea.dzhan.com> References: <20020213082207.Q5579-100000@crimea.dzhan.com> Message-ID: <13193417.1013590982@[0.0.0.0]> --On Wednesday, February 13, 2002 8:28 AM -0800 Benjamin Franks wrote: > In programs where a parent forks off a number of child processes, is > there a way to reduce the memory footprint of the child processes? > If I understand correctly, the child inherits a duplicate copy of > the parents variables, etc.. Can the child explicitly undefine > parent variables the child doesn't need? What about unecessary > modules the parent needs that the child doesn't---can modules be > unloaded in the child? Even if these techniques did reduce the > memory consumption of the child, would it be visible on a program > like top (or something similar) or would the memory be unused but > held until child death? Is there a way to force a > reallocation of unused memory while the child is running, or is that > more of an OS issue? In many UNIX-shaped operating systems, the effects of doing a fork() are mitigated in several ways. The most common is shared objects. Once they're loaded, there will only be one copy of them in memory. Much of the perl executable is going to be made up of shared object code, and many of the more sophisticated modules will also be sharable code. On some systems, such as Linux, a call to fork() actually generates very little overhead, because it is implemented using copy-on-write pages. So the two processes are not copies of each other, they are identical except for their process id, parent process id. All that is created is the kernel datastructure to keep track of the new process. Only if you change the data will a new page have to be copied from the old one and the data modified in that new page. Of course that means if you change one variable in the child, you have to copy an entire page in memory. Still better than copying all the non-shared pages. In this case, actually undef-ing variables will do more harm than good! Other Unices (Solaris, is an example) provide the vfork() system call which does essentiallly the same thing (where as fork() is left as a heavyweight clod-stomper). Your version of perl may or may not be compiled to use vfork() instead of fork(). You can tell by doing a `perl -V:usevfork'. (You will annoy your system administrators by asking them to re-build perl to use vfork(), and while they're at it didn't they notice that emacs had a new point release last night? Offer to buy them more memory instead.) On a non-Unix OS, your milage may vary wildly. Sometimes fork() is emulated using threads (so you only get the overhead of an additional thread) -- Jim Flanagan jimfl@colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Wed Feb 13 11:57:44 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: Extreme Programming Meeting Thursday (2/14) Message-ID: <20020213175744.69757.qmail@web14207.mail.yahoo.com> EXTREME PROGRAMMING MEETING TOPICS Spend Valentine's day with the methodology you love :-) We'll do another fishbowl discusssion about XP issues, continuing our never-ending group conversation. Come prepared with your biggest XP issues and we'll discuss them and see if we can solve the world's problems, one baby step at a time. Some questions to consider: - Refactoring: When should you refactor instead of doing a rewrite? - User Interface Issues: The Beck versus Cooper debate. Are there any advantages to designing the user interface before writing the first line of code? Feel free to post more here. Also for first part of the meeting I will demo Eclipse, IBM's new open source IDE which contains refactoring support and makes it easy to add more. This shouldn't take very long, but might be a good way to segue into the refactoring discussion. DATE AND SCHEDULE Thursday, February 14, 2001 (second Thursday of the month). 6.30 pm - 7.00 pm : Pizza + Networking. 7.00 pm - 9.00 pm : Presentations and Q&A. LOCATION Suite 100, Lante's Main Conference Room 3180 139th Avenue SE Bellevue, WA 98005 425.564.8800 (main desk) DIRECTIONS I have refactored the directions into two parts. First, how to get to 139th Ave SE (which depends on which interstate you use) and then how to get to 3180 which should be same for all cases: STEP 1: How to get to 139th Ave SE >From I-405 South (going towards I-90) from Bellevue, Redmond. - Take exit 10 for Coal Creek Parkway and turn LEFT at the light as you get off the ramp onto Coal Creek Parkway. - Turn LEFT at Factoria Blvd (128th Av SE). - You will cross I-90 by going under it. - Turn RIGHT onto Eastgate Way SE, immediately after crossing I-90. - Take a LEFT at the light onto 139th Ave SE. >From I-405 North (going towards I-90) from Renton. - Take exit 10 for Coal Creek Parkway and turn RIGHT at the light as you get off the ramp onto Coal Creek Parkway. - Turn LEFT at Factoria Blvd (128th Av SE). - You will cross I-90 by going under it. - Turn RIGHT onto Eastgate Way SE, immediately after crossing I-90. - Take a LEFT at the light onto 139th Ave SE >From I-90 West (going towards I-405) from Bellevue, Issaquah, Redmond. - Take the 161st Ave SE/156th Ave SE/150th Ave SE exit (exit 11). - Keep LEFT at the fork in the ramp. - Keep RIGHT at the fork in the ramp. - Turn LEFT onto SE Eastgate Way. - Turn RIGHT onto 139th Ave SE. >From I-90 East (going towards I-405) from Seattle, Mercer Island. - Take the Richards Road exit (exit 10). - Take a LEFT at the light off the exit ramp onto Richards Rd. - You will drive under I-90 crossing it. - Take the first RIGHT onto SE Eastgate Way. - Take a LEFT at the light onto 139th Ave SE STEP 2: How to find 3180 on 139th Ave SE - Drive past the turn for SE 32nd St. - 3180 will be the first building on your RIGHT. - You will notice a parking entrance into the building on your RIGHT. - Drive into it and then drive up the parking garage to the top (the 4th floor) which has uncovered parking. - Park anywhere (parking is free). - The building entrance should be straight ahead and there will be signs pointing to the XP meeting. __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From humbaba9 at yahoo.com Wed Feb 13 14:15:00 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: iso database recommendation Message-ID: <20020213201500.90817.qmail@web12807.mail.yahoo.com> 2/13/02 Hi Folks, I'm trying to remember a database Tim or Colin might have recommended at a SPUG meeting last year. All I remember is that it was preferred to mySQL. Any suggestions? Meryll Larkin Web Developer - Perl Programmer __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From james at banshee.com Wed Feb 13 14:33:38 2002 From: james at banshee.com (James Moore) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: iso database recommendation In-Reply-To: <20020213201500.90817.qmail@web12807.mail.yahoo.com> Message-ID: <002601c1b4cd$b7fd4a10$697ba8c0@gealach> Wasn't there, but my first guess would be Postgres. - James - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at colltech.com Wed Feb 13 14:44:56 2002 From: jimfl at colltech.com (Jim Flanagan) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: iso database recommendation In-Reply-To: <20020213201500.90817.qmail@web12807.mail.yahoo.com> References: <20020213201500.90817.qmail@web12807.mail.yahoo.com> Message-ID: <13992149.1013604295@[0.0.0.0]> --On Wednesday, February 13, 2002 12:15 PM -0800 Meryll Larkin wrote: > I'm trying to remember a database Tim or Colin might > have recommended at a SPUG meeting last year. > > All I remember is that it was preferred to mySQL. Probabaly PostgreSQL. -- Jim Flanagan jimfl@colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From humbaba9 at yahoo.com Wed Feb 13 14:47:47 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:42 2004 Subject: SPUG: iso database recommendation In-Reply-To: <20020213122751.A4991@timji.consultix.wa.com> Message-ID: <20020213204747.94823.qmail@web12807.mail.yahoo.com> Thanks Tim, that sounds familiar --- Tim Maher wrote: > On Wed, Feb 13, 2002 at 12:15:00PM -0800, Meryll > Larkin wrote: > > 2/13/02 > > > > Hi Folks, > > > > I'm trying to remember a database Tim or Colin > might > > have recommended at a SPUG meeting last year. > > > > All I remember is that it was preferred to mySQL. > > Colin is the real authority on the subject, so I'll > defer > to his judgment if he disagrees, but I think the DB > you have in mind is Postgres. > > Check out www.us.postgresql.org > > -Tim > > > > > Any suggestions? > > > > Meryll Larkin > > Web Developer - Perl Programmer > > -- > *==============================================================================* > | Dr. Tim Maher, CEO, Consultix (206) > 781-UNIX/8649; ask for FAX# | > | tim@consultix-inc.com www.consultix-inc.com > www.softwareprofessor.com | > | FEB: Perl; APR: Shell; Int. & OO Perl; Perl > DataBase; JUNE: Basic UNIX, Perl | > *------------------------------------------------------------------------------* > | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl > Workshop"; Seattle, 7/15-18 | > | Adv. OOP * Adv. Module Implementation Techniques > * Programming in Perl 6 | > *==============================================================================* __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From humbaba9 at yahoo.com Wed Feb 13 14:56:26 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: iso database recommendation In-Reply-To: <20020213201500.90817.qmail@web12807.mail.yahoo.com> Message-ID: <20020213205626.48633.qmail@web12806.mail.yahoo.com> Thank you !!!! Tim, Jim, James, Ashley, and anyone else who responded. Meryll Larkin --- Meryll Larkin wrote: > 2/13/02 > > Hi Folks, > > I'm trying to remember a database Tim or Colin might > have recommended at a SPUG meeting last year. > > All I remember is that it was preferred to mySQL. > > Any suggestions? > > Meryll Larkin > Web Developer - Perl Programmer > > __________________________________________________ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://seattleperl.org > > __________________________________________________ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Wed Feb 13 15:29:00 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: sendmail from Perl (quick newbie question) In-Reply-To: References: Message-ID: Well, I sort of figured out what my problem was, and since it seems like it might be a common "gotcha", I figured I'd share: The problem appears to be that all three of my test addresses were really aliases for the same address (using the catch-all email forwarding of my strangelight.com domain). Somewhere on its route from the server where the CGI is hosted to where strangelight.com is hosted (no, they're not the same machine, nor even the same subnet) SMTP was being overly clever and deciding that since all the recipient aliases resolved to the same real address, there was no need to deliver more than one copy. The strange thing is that when I do exactly the same thing from my normal email client, i.e. send an email to multiple recipients @strangelight.com, I get multiple copies just as I would expect. Why sending from a CGI script via sendmail should be different from sending from my desktop machine via Eudora is beyond me. Be that as it may, when I used multiple test addresses that really did send to different POP accounts, the script worked as expected -- and since the real addresses will be on different machines, this should work fine. I still find this behaviour of sendmail very odd, though... -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Wed Feb 13 16:10:06 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: flip-flops References: <116910000.1013461457@benzene.cobaltgroup.com> Message-ID: <+Qua8gzkgKje092yn@efn.org> In article , "Michael R. Wolf" wrote: >perl -n -e '$body .= $_ if /^$/ .. eof();' \ > -e '$head .= $_ if (1 .. /^$/);' \ > -e 'END{print $head, "\n", "="x40, "\n", $body;}' How about: perl -pe'(/^$/..eof&&(close*ARGV||1))==1and$_.=("="x40)."\n"' >BTW -- Matt's code would work for 1 file as input, but since >the body flip-flop latches on, it will miss the EOF >condition as subsequent files are processed. If this code >was meant to process multiple files (via <>), the eof() test >is better, but would necessitate a "close ARGV if eof()" to >allow resetting $.. Other problems with this snippet that >prevent it from looping over multiple files, so it's a good >example. You don't have it quite right. perlfunc says: In a "while (<>)" loop, "eof" or "eof(ARGV)" can be used to detect the end of each file, "eof()" will only detect the end of the last file. Exam- ples: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Wed Feb 13 16:27:21 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Meeting Announcements References: <20020213004736.28942.qmail@w3.zipcon.net> <20020212171311.A30474@timji.consultix.wa.com> <20020212180659.F15153@hobart.helvella.org> Message-ID: In article <20020212180659.F15153@hobart.helvella.org>, Colin Meyer wrote: >That's one problem with the Perl documentation: scalar .. isn't the >range operator, it's the flip flop op! List context .. is the range >operator. Despite the similarity in syntax, it's much easier to think of >them as different ops. pp_flip and pp_flop are actually separate, so it's not really flip flop op, it's flip flop ops :) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Wed Feb 13 17:47:40 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: sendmail from Perl (quick newbie question) In-Reply-To: References: Message-ID: <20020213234740.GH18101@titanium.brain.org> On Wed, Feb 13, 2002 at 01:29:00PM -0800, dancerboy wrote: > I still find this behaviour of sendmail very odd, though... Not odd at all. You're sending one message with multiple recipients. All the receipients were going to the same mx (machine). So when the remote machine received it it resolved the aliases (virtusertable) saw it went ot the same user and only delivered it once. Makes a lot of sense. Saves on disk space. And generally does what the receiving user wants anyway. If somone sends a signle email to several of my addresses all at once I really don't need multiple copies of that email. -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Wed Feb 13 18:04:23 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: sendmail from Perl (quick newbie question) In-Reply-To: <20020213234740.GH18101@titanium.brain.org> References: <20020213234740.GH18101@titanium.brain.org> Message-ID: At 3:47 pm -0800 2/13/02, Ben Reser wrote: >On Wed, Feb 13, 2002 at 01:29:00PM -0800, dancerboy wrote: >> I still find this behaviour of sendmail very odd, though... > >Not odd at all. You're sending one message with multiple recipients. >All the receipients were going to the same mx (machine). So when the >remote machine received it it resolved the aliases (virtusertable) saw >it went ot the same user and only delivered it once. Makes a lot of >sense. Saves on disk space. And generally does what the receiving user >wants anyway. If somone sends a signle email to several of my addresses >all at once I really don't need multiple copies of that email. That's not what I meant. I meant that it was odd that this happened when using sendmail from a CGI script on a different server, but *didn't* happen when sending from my desktop machine using Eudora. Either behaviour makes sense. The odd thing is that it isn't consistent, and that the behaviour seems to depend on the *sending* server (which has no way of knowing that all the recipients are the same). -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From warner at oz.net Wed Feb 13 10:51:02 2002 From: warner at oz.net (Marion Scott Warner) Date: Wed Aug 4 00:08:43 2004 Subject: Bit::FlipFlop [was Re: SPUG: flip-flops] References: <20020207091836.B5169@hobart.helvella.org> <20020212164333.D15153@hobart.helvella.org> Message-ID: <3C6A9976.CACC1D7E@oz.net> Gee, that NAND looks rather NORISH "Michael R. Wolf" wrote: > Colin Meyer writes: > > [...] > > > > > ___ $a $b | $o > > $a -----| \ ---------|---- > > | |o---- $o F F | T > > $b -----|___/ T F | T > > F T | T > > T T | F > > > > > > (This won't be pretty to those viewing with a proportional font. It might > > not be pretty to those using a fixed width font either.) > > Beautiful! > > It's my eyes, I behold Beauty! > > -- > Michael R. Wolf > All mammals learn by playing! > MichaelRunningWolf@att.net > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 13 18:47:01 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Meeting Announcements In-Reply-To: References: <20020213004736.28942.qmail@w3.zipcon.net> <20020212171311.A30474@timji.consultix.wa.com> <20020212180659.F15153@hobart.helvella.org> Message-ID: <20020213164701.A18171@hobart.helvella.org> On Wed, Feb 13, 2002 at 02:27:21PM -0800, Yitzchak Scott-Thoennes wrote: > In article <20020212180659.F15153@hobart.helvella.org>, > Colin Meyer wrote: > >That's one problem with the Perl documentation: scalar .. isn't the > >range operator, it's the flip flop op! List context .. is the range > >operator. Despite the similarity in syntax, it's much easier to think of > >them as different ops. > > pp_flip and pp_flop are actually separate, so it's not really flip flop op, > it's flip flop ops :) Ssh! You're saying too much. Now you'll have people perusing perldoc perlapi, pp_ctl.c and the like, attempting to decipher the nice, simple flip flop op. ;-) But for the curious, try looking at: perl -MO=Terse -e'$a=1..10' perl -MO=Terse -e'@a=1..10' perl -MO=Terse -e'$x=10;@a=1..$x' perl -MO=Terse -e'push @a,$_ for 1..10' # and so on . . . hehehe Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Feb 13 19:10:40 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: nands and nors In-Reply-To: <3C6A9976.CACC1D7E@oz.net> References: <20020207091836.B5169@hobart.helvella.org> <20020212164333.D15153@hobart.helvella.org> <3C6A9976.CACC1D7E@oz.net> Message-ID: <20020213171040.C18171@hobart.helvella.org> On Wed, Feb 13, 2002 at 08:51:02AM -0800, Marion Scott Warner wrote: > Gee, that NAND looks rather NORISH a b | o ____ ------+--- a ---\ \ F F | T ) )o--- o T F | F b ---/___/ F T | F T T | F The NOR gate. ;-) [off topic nonsense] Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Thu Feb 14 18:11:15 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Next Week's Meeting In-Reply-To: <20020212171311.A30474@timji.consultix.wa.com>; from Tim Maher on Tue, Feb 12, 2002 at 05:13:11PM -0800 References: <20020213004736.28942.qmail@w3.zipcon.net> <20020212171311.A30474@timji.consultix.wa.com> Message-ID: <20020214161115.A14013@timji.consultix.wa.com> SPUGsters, > "And Other Topics" > Just Might be Covered by Additional Speakers; LIKE YOU! > ------------------------------------------------------------- Just a few notes on next week's meeting. First, we can still accommodate other volunteers who want to talk about something, so get in touch with me soon if you want to participate. Secondly, we have been advised that our members should not enter the auditorium in the Safeco building until 6:45 (or thereafter). So those of you who arrive early, please relax in the lobby until at least that time. Or hang out somewhere else for a while in the fascinatingly colorful U-district! 8-} -Tim > Regarding next week's "Magazine/Lightning Talks" event, we can still > accommodate another speaker or two, if any of you LURKERS out there want > to come forward and participate for a change! 8-} > > Finally, those who do attend next week's meeting are advised that they'll > get the most out of the talks by reading the indicated reference for > each topic (see below), in preparation. > > -Tim > > ------------------------------------------------------------- > UPCOMING SPUG MEETINGS > Time & Place: 7-9pm, Safeco Building > > All interested parties are welcome! > See www.seattleperl.org for complete details > ------------------------------------------------------------- > > February Meeting: Tuesday, 02/19/02 > "Short Talks on Perl Topics" > > "Perl's Flip-Flop Operator" and "Python for Perl Weenies" > Colin Meyer, Helvella > Reference: man perlop; see "range operator" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > "Parsing Protein Domains with Perl" and > "General Comments on Perl for Bioinformatics" > Eric Olson, Neobase, Inc. > Reference: http://www.perl.com/pub/a/2001/11/16/perlbio2.html > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > "Creating XML-RPC Web Services" > Joshua Lanza, Vorsite Corp. > Reference: TPJ Issue #22, Winter, 2001 at: > http://www.sysadminmag.com/tpj/ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > "The Name Game" > Tim Maher, Consultix, Inc. > Reference: TPJ #15, Fall, 1999, p. 11 > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ====================================================== | Tim Maher, Ph.D. tim@timmaher.org | | SPUG Founder & Leader spug@seattleperl.org | | Seattle Perl Users Group www.seattleperl.org | ====================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Thu Feb 14 18:43:55 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: flip-flops In-Reply-To: <+Qua8gzkgKje092yn@efn.org> References: <116910000.1013461457@benzene.cobaltgroup.com> <+Qua8gzkgKje092yn@efn.org> Message-ID: sthoenna@efn.org (Yitzchak Scott-Thoennes) writes: > In article , > "Michael R. Wolf" wrote: > >perl -n -e '$body .= $_ if /^$/ .. eof();' \ > > -e '$head .= $_ if (1 .. /^$/);' \ > > -e 'END{print $head, "\n", "="x40, "\n", $body;}' > > How about: > > perl -pe'(/^$/..eof&&(close*ARGV||1))==1and$_.=("="x40)."\n"' Wow! Do you play Perl golf? Does your editor's perl-mode prevent unnecessary spaces? Same output, but doesn't illustrate multiple flip-flops, which was part of the contrived illustration. -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From daryn at marinated.org Thu Feb 14 20:12:05 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script Message-ID: Is there a best way to get the directory containing the script you're running? or a way to use relative paths from that directory to read files? 1. pwd,cwd both return the directory you're running the script from (working directory), not where it lives. 2. using ./ or ../ is going to be relative to the working dir, not the script's dir 3. $0 could be used, but you'd have to parse for a ./ or no /, and in those cases use the working dir. I don't mind using #3, that would always work, right? -daryn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From daryn at marinated.org Thu Feb 14 20:31:52 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: database connection pooling Message-ID: Does anyone know of a database connection pooling package? I'm using mysql, but preferably this would be a pool manager implemented atop DBI. thanks, daryn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Thu Feb 14 20:52:39 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: flip-flops Message-ID: <200202150252.SAA07604@carios2.ca.boeing.com> sthoenna@efn.org (Yitzchak Scott-Thoennes) writes: >> How about: >> >> perl -pe'(/^$/..eof&&(close*ARGV||1))==1and$_.=("="x40)."\n"' > Do you play Perl golf? Does your editor's perl-mode prevent > unnecessary spaces? Deparse has a nice replay: perl -M'O (Deparse,-p)' -pe'(/^$/..eof&&(close*ARGV||1))==1and$_.=("="x40)."\n"' LINE: while (defined($_ = )) { $_ .= '=' x 40 . "\n" if (/^$/ .. eof && (close *ARGV || 1)) == 1; } continue { print $_; } -e syntax OK Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From scott at mail.dsab.rresearch.com Thu Feb 14 21:24:30 2002 From: scott at mail.dsab.rresearch.com (Scott Blachowicz) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script In-Reply-To: ; from daryn@marinated.org on Thu, Feb 14, 2002 at 06:12:05PM -0800 References: Message-ID: <20020214192430.A33944@sabami.seaslug.org> On Thu, Feb 14, 2002 at 06:12:05PM -0800, Daryn Nakhuda wrote: > > Is there a best way to get the directory containing the script > you're running? or a way to use relative paths from that > directory to read files? > > 1. pwd,cwd both return the directory you're running the script from > (working directory), not where it lives. > > 2. using ./ or ../ is going to be relative to the working dir, not the > script's dir > > 3. $0 could be used, but you'd have to parse for a ./ or no /, and in > those cases use the working dir. > > I don't mind using #3, that would always work, right? I usually use something like this: BEGIN { (my $dir = $0) =~ s,(.*)/[^/]+$,$1,; push (@INC, $dir); } Which should work unless you do chdir's in your perl. Scott - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dancerboy at strangelight.com Thu Feb 14 22:23:13 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script In-Reply-To: <20020214192430.A33944@sabami.seaslug.org> References: <20020214192430.A33944@sabami.seaslug.org> Message-ID: At 7:24 pm -0800 2/14/02, Scott Blachowicz wrote: >On Thu, Feb 14, 2002 at 06:12:05PM -0800, Daryn Nakhuda wrote: >> >> Is there a best way to get the directory containing the script >> you're running? or a way to use relative paths from that >> directory to read files? >> >> 1. pwd,cwd both return the directory you're running the script from >> (working directory), not where it lives. >> >> 2. using ./ or ../ is going to be relative to the working dir, not the >> script's dir >> >> 3. $0 could be used, but you'd have to parse for a ./ or no /, and in >> those cases use the working dir. >> >> I don't mind using #3, that would always work, right? You might also want to take a look at the standard FindBin module, which is supposed to do what you're trying to do (though IME it's not quite as robust as it should be: e.g. it never seems to get the paths right when my scripts are run as CGI...) > (my $dir = $0) =~ s,(.*)/[^/]+$,$1,; A little verbose, isn't this? Wouldn't (my $dir = $0) =~ s,/[^/]+$,,; do exactly the same thing, with less work? (And personally, I find the shorter version easier to read...) -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jope-spug at jope.net Thu Feb 14 23:56:28 2002 From: jope-spug at jope.net (El JoPe Magnifico) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: database connection pooling In-Reply-To: Message-ID: DBD::Proxy has support for a cached pool of connections. It's apparently fairly new though, and I've never used it personally. If your code happens to be running in the context of mod_perl, then Apache::DBI is the way to go. Have used that, it rocks. -jp On Thu, 14 Feb 2002, Daryn Nakhuda wrote: > Does anyone know of a database connection pooling package? I'm using > mysql, but preferably this would be a pool manager implemented atop DBI. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Fri Feb 15 00:43:51 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script References: <20020214192430.A33944@sabami.seaslug.org> Message-ID: <012e01c1b5ec$23237480$3d88ddd1@aciwin> FindBin is the way to go. Scott's and dancerboy's code fails when the script is invoked using a relative pathname, e.g., cd $HOME; bin/myscript.pl. You could try further hacking on $0, e.g. use Cwd; ($dir = $0) =~ s,(.*)/[^/]+$,$1,; unless ($dir =~ /^\//) { $dir = getcwd() . '/' . $dir; # Prefix current working directory to relative pathname $dir =~ s/\/\.$//; # Strip trailing /. $dir =~ s#/\.\./#/#g; # Not necessary, but aesthetically better } but this flunks on Windows and other OSes. Use FindBin. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "dancerboy" To: "Scott Blachowicz" ; "Daryn Nakhuda" Cc: Sent: Thursday, February 14, 2002 8:23 PM Subject: Re: SPUG: finding directory of script > At 7:24 pm -0800 2/14/02, Scott Blachowicz wrote: > >On Thu, Feb 14, 2002 at 06:12:05PM -0800, Daryn Nakhuda wrote: > >> > >> Is there a best way to get the directory containing the script > >> you're running? or a way to use relative paths from that > >> directory to read files? > >> > >> 1. pwd,cwd both return the directory you're running the script from > >> (working directory), not where it lives. > >> > >> 2. using ./ or ../ is going to be relative to the working dir, not the > >> script's dir > >> > >> 3. $0 could be used, but you'd have to parse for a ./ or no /, and in > >> those cases use the working dir. > >> > >> I don't mind using #3, that would always work, right? > > > You might also want to take a look at the standard FindBin module, > which is supposed to do what you're trying to do (though IME it's not > quite as robust as it should be: e.g. it never seems to get the paths > right when my scripts are run as CGI...) > > > > (my $dir = $0) =~ s,(.*)/[^/]+$,$1,; > > A little verbose, isn't this? Wouldn't > > (my $dir = $0) =~ s,/[^/]+$,,; > > do exactly the same thing, with less work? (And personally, I find > the shorter version easier to read...) > > -jason > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From daryn at marinated.org Fri Feb 15 01:44:45 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: database connection pooling In-Reply-To: Message-ID: Thanks. I've used Apache::DBI before, but this is something non web-app. Perhaps it would still work, never really looked at how it worked before.. On Thu, 14 Feb 2002, El JoPe Magnifico wrote: > DBD::Proxy has support for a cached pool of connections. It's > apparently fairly new though, and I've never used it personally. > > If your code happens to be running in the context of mod_perl, > then Apache::DBI is the way to go. Have used that, it rocks. > -jp > > On Thu, 14 Feb 2002, Daryn Nakhuda wrote: > > Does anyone know of a database connection pooling package? I'm using > > mysql, but preferably this would be a pool manager implemented atop DBI. > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Fri Feb 15 11:52:23 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script In-Reply-To: <012e01c1b5ec$23237480$3d88ddd1@aciwin> References: <20020214192430.A33944@sabami.seaslug.org> <012e01c1b5ec$23237480$3d88ddd1@aciwin> Message-ID: <116680000.1013795543@flashingchance.whistlingfish.net> -- Richard Anderson spake thusly: > use Cwd; > ($dir = $0) =~ s,(.*)/[^/]+$,$1,; > unless ($dir =~ /^\//) { > $dir = getcwd() . '/' . $dir; # Prefix current working > directory to relative pathname > $dir =~ s/\/\.$//; # Strip trailing /. > $dir =~ s#/\.\./#/#g; # Not necessary, but > aesthetically better > } I always cringe when I see someone escaping slashings in a regex. Try using an alternate delimiter; it'll be much easier to read. Sure TMTOWTDI, but in my opinion some of them are wrong. ;-) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020215/230d12c3/attachment.bin From cwilkes-spug at ladro.com Fri Feb 15 12:39:45 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: CPAN question In-Reply-To: ; from pdarley@kinesis-cem.com on Wed, Feb 13, 2002 at 08:52:40AM -0800 References: Message-ID: <20020215103945.A32714@www.ladro.com> On Wed, Feb 13, 2002 at 08:52:40AM -0800, Peter Darley wrote: > Friends, > Is there any way that I can get CPAN to not try to upgrade my perl > 5.005 to perl 5.6? I don't have the libs installed to use > 5.6, but would like to be able to use 'perl -MCAPN -e shell'. > Thanks, Peter Darley Did you get any responses for this question as this has happened to me a number of times and I've just given up and upgraded. Poking around on http://groups.google.com I couldn't find an answer either, but it seems like this behavior happens when you do a 'force install' of a module. Maybe that module requires 5.6.x? You could always just use CPAN to download the module for you and then cd into the ~/.cpan/build/ directory and compile it up yourself. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mathin at mathin.com Fri Feb 15 13:42:19 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header Message-ID: OK, this isn't really a perl question ... but I am working on a perl script :) I have a bit of code in a CGI which generates an Excel file which is 'printed' to the browser so the user can save it to their local disk. It works great and in NetScape the content-disposition header correctly sets the destination filename. In IE it sets the name to the name of the CGI script. print $cgi->header(-type => 'app1icati0n/0ctet-stream', -content_disposition => 'file; filename='. $filename); (one = ell, zero = o) For those not familiar with the CGI module, this generates a header like so: Content-type: app1icati0n/0ctet-stream Content-disposition: file; filename=destination.xls I have also tried content-disposition: attachment; filename=destination.xls no dice. Has anyone ran into this before? Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Fri Feb 15 13:45:40 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header Message-ID: <200202151945.LAA07969@carios2.ca.boeing.com> > OK, this isn't really a perl question ... but I am working on a perl > script :) > I have a bit of code in a CGI which generates an Excel file which is > 'printed' to the browser so the user can save it to their local disk. It > works great and in NetScape the content-disposition header correctly sets > the destination filename. In IE it sets the name to the name of the CGI > script. > > print $cgi->header(-type => 'app1icati0n/0ctet-stream', > -content_disposition => 'file; filename='. $filename); > > (one = ell, zero = o) > > For those not familiar with the CGI module, this generates a header like > so: > > Content-type: app1icati0n/0ctet-stream > Content-disposition: file; filename=destination.xls Maybe not dynamic enough for your purposes but I recall somewhere that using PATH_INFO works across various browsers and even with lynx, eg ... action="/cgi-bin/foo.cgi/destination.xls ... Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Fri Feb 15 15:22:21 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header In-Reply-To: References: Message-ID: <20020215212221.GB16477@titanium.brain.org> On Fri, Feb 15, 2002 at 11:42:19AM -0800, Dan Ebert wrote: > OK, this isn't really a perl question ... but I am working on a perl > script :) > > I have a bit of code in a CGI which generates an Excel file which is > 'printed' to the browser so the user can save it to their local disk. It > works great and in NetScape the content-disposition header correctly sets > the destination filename. In IE it sets the name to the name of the CGI > script. > > print $cgi->header(-type => 'app1icati0n/0ctet-stream', > -content_disposition => 'file; filename='. $filename); > > (one = ell, zero = o) > > For those not familiar with the CGI module, this generates a header like > so: > > Content-type: app1icati0n/0ctet-stream > Content-disposition: file; filename=destination.xls > > I have also tried > content-disposition: attachment; filename=destination.xls > > no dice. > > Has anyone ran into this before? Yep discussed on this list not very long ago. I've attached the final resolution. -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi -------------- next part -------------- An embedded message was scrubbed... From: "Parr, Ryan" Subject: RE: SPUG: HTTP Headers Date: Tue, 11 Dec 2001 12:12:13 -0800 Size: 5325 Url: http://mail.pm.org/archives/spug-list/attachments/20020215/9d52ea09/attachment.eml From mathin at mathin.com Fri Feb 15 16:22:24 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header In-Reply-To: <20020215212221.GB16477@titanium.brain.org> Message-ID: That would work if I was attempting to send a file which was on the server. I am generating a file on the fly and 'printing' it back to the browser. Also, I don't know what the filename will be until I receive input from the user, so I can't add the filename to the 'action URL' in the
tag. Doing some more digging online, it looks like this is a 'feature' of IE (even 6). I think I'll just have to tell them to use Netscape :) Thanks for all the replies. Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Fri, 15 Feb 2002, Ben Reser wrote: > On Fri, Feb 15, 2002 at 11:42:19AM -0800, Dan Ebert wrote: > > OK, this isn't really a perl question ... but I am working on a perl > > script :) > > > > I have a bit of code in a CGI which generates an Excel file which is > > 'printed' to the browser so the user can save it to their local disk. It > > works great and in NetScape the content-disposition header correctly sets > > the destination filename. In IE it sets the name to the name of the CGI > > script. > > > > print $cgi->header(-type => 'app1icati0n/0ctet-stream', > > -content_disposition => 'file; filename='. $filename); > > > > (one = ell, zero = o) > > > > For those not familiar with the CGI module, this generates a header like > > so: > > > > Content-type: app1icati0n/0ctet-stream > > Content-disposition: file; filename=destination.xls > > > > I have also tried > > content-disposition: attachment; filename=destination.xls > > > > no dice. > > > > Has anyone ran into this before? > > Yep discussed on this list not very long ago. > I've attached the final resolution. > > -- > Ben Reser > http://ben.reser.org > > What difference does it make to the dead, the orphans, and the homeless, > whether the mad destruction is wrought under the name of totalitarianism > or the holy name of liberty and democracy? - Ghandi > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From bvh at speakeasy.net Fri Feb 15 16:44:41 2002 From: bvh at speakeasy.net (Brian Van Horne) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header In-Reply-To: Message-ID: You might try using the additional path info to fool the browser. To do this, modify the URL that calls the script: /cgi-bin/your.cgi/filename.xls?name=value Where "your.cgi" is the script that generates the file. Unless your CGI script bothers with reading additional path info, the script itself will ignore "filename.xls", but the heuristics IE uses to "know better" will be fooled into thinking that's the filename. This assumes you're in control of how this script is called, of course. Brian -- "The mind is not a vessel to be filled but a fire to be kindled." - Plutarch On Fri, 15 Feb 2002, Dan Ebert wrote: > > That would work if I was attempting to send a file which was on the > server. I am generating a file on the fly and 'printing' it back to the > browser. Also, I don't know what the filename will be until I receive > input from the user, so I can't add the filename to the 'action URL' in > the tag. > > Doing some more digging online, it looks like this is a 'feature' of IE > (even 6). > > I think I'll just have to tell them to use Netscape :) > > Thanks for all the replies. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Fri, 15 Feb 2002, Ben Reser wrote: > > > On Fri, Feb 15, 2002 at 11:42:19AM -0800, Dan Ebert wrote: > > > OK, this isn't really a perl question ... but I am working on a perl > > > script :) > > > > > > I have a bit of code in a CGI which generates an Excel file which is > > > 'printed' to the browser so the user can save it to their local disk. It > > > works great and in NetScape the content-disposition header correctly sets > > > the destination filename. In IE it sets the name to the name of the CGI > > > script. > > > > > > print $cgi->header(-type => 'app1icati0n/0ctet-stream', > > > -content_disposition => 'file; filename='. $filename); > > > > > > (one = ell, zero = o) > > > > > > For those not familiar with the CGI module, this generates a header like > > > so: > > > > > > Content-type: app1icati0n/0ctet-stream > > > Content-disposition: file; filename=destination.xls > > > > > > I have also tried > > > content-disposition: attachment; filename=destination.xls > > > > > > no dice. > > > > > > Has anyone ran into this before? > > > > Yep discussed on this list not very long ago. > > I've attached the final resolution. > > > > -- > > Ben Reser > > http://ben.reser.org > > > > What difference does it make to the dead, the orphans, and the homeless, > > whether the mad destruction is wrought under the name of totalitarianism > > or the holy name of liberty and democracy? - Ghandi > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mathin at mathin.com Fri Feb 15 17:02:20 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header In-Reply-To: Message-ID: I don't know if I can use the URL-filename method. I don't know the name of the file until I get the data from the form, and the form is where the URL that calls the script is. It was suggested that I forward the script to itself with the file when the form is submitted (since I would then know what the name is). This would probably work in most cases, but the form being submitted is a file upload form (multipart form) and I think the redirect would mess up the file upload. (I haven't tried it though :) Essentially the script takes a text file (uploaded by the user) tweaks it adds some stuff and spits back an Excel file. I want to avoid writing the file to the server, so I was writing it out to STDOUT so the user can just save it on their box. (Rather than saving it to disk and giving them a link to download it, or emailing the file to them.) Oh, well. It works in Netscape, and will only be used by one person anyway. I'll tell him to use Netscape :) Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Fri, 15 Feb 2002, Brian Van Horne wrote: > You might try using the additional path info to fool the > browser. To do this, modify the URL that calls the script: > > /cgi-bin/your.cgi/filename.xls?name=value > > Where "your.cgi" is the script that generates the file. > Unless your CGI script bothers with reading additional path > info, the script itself will ignore "filename.xls", but the > heuristics IE uses to "know better" will be fooled into > thinking that's the filename. > > This assumes you're in control of how this script is called, > of course. > > Brian > > -- > "The mind is not a vessel to be filled but a fire to > be kindled." - Plutarch > > > On Fri, 15 Feb 2002, Dan Ebert wrote: > > > > > That would work if I was attempting to send a file which was on the > > server. I am generating a file on the fly and 'printing' it back to the > > browser. Also, I don't know what the filename will be until I receive > > input from the user, so I can't add the filename to the 'action URL' in > > the tag. > > > > Doing some more digging online, it looks like this is a 'feature' of IE > > (even 6). > > > > I think I'll just have to tell them to use Netscape :) > > > > Thanks for all the replies. > > > > Dan. > > ---------------------------------------------------------- > > Immigration is the sincerest form of flattery. > > - Unknown > > ---------------------------------------------------------- > > > > > > On Fri, 15 Feb 2002, Ben Reser wrote: > > > > > On Fri, Feb 15, 2002 at 11:42:19AM -0800, Dan Ebert wrote: > > > > OK, this isn't really a perl question ... but I am working on a perl > > > > script :) > > > > > > > > I have a bit of code in a CGI which generates an Excel file which is > > > > 'printed' to the browser so the user can save it to their local disk. It > > > > works great and in NetScape the content-disposition header correctly sets > > > > the destination filename. In IE it sets the name to the name of the CGI > > > > script. > > > > > > > > print $cgi->header(-type => 'app1icati0n/0ctet-stream', > > > > -content_disposition => 'file; filename='. $filename); > > > > > > > > (one = ell, zero = o) > > > > > > > > For those not familiar with the CGI module, this generates a header like > > > > so: > > > > > > > > Content-type: app1icati0n/0ctet-stream > > > > Content-disposition: file; filename=destination.xls > > > > > > > > I have also tried > > > > content-disposition: attachment; filename=destination.xls > > > > > > > > no dice. > > > > > > > > Has anyone ran into this before? > > > > > > Yep discussed on this list not very long ago. > > > I've attached the final resolution. > > > > > > -- > > > Ben Reser > > > http://ben.reser.org > > > > > > What difference does it make to the dead, the orphans, and the homeless, > > > whether the mad destruction is wrought under the name of totalitarianism > > > or the holy name of liberty and democracy? - Ghandi > > > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From davidinnes at chicagoscience.com Fri Feb 15 18:31:38 2002 From: davidinnes at chicagoscience.com (David Innes (CSG)) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Content-Dispostion http header References: Message-ID: <000701c1b681$4bdd8650$077e5e40@converger.net> Dan said: Oh, well. It works in Netscape, and will only be used by one person anyway. I'll tell him to use Netscape :) I say: Aww why take it out on him? :-) Here's a quickie script that works with Explorer (with the Feb. 13th security patch anyway, I don't know about earlier versions.) There are surely better ways to do it but it worked this way when I needed it. #----------------------- use strict; use CGI; use CGI::carp; my $filename = "test.txt"; open FILE, $filename; binmode FILE; binmode STDOUT; #you could probably just say 'binmode;' but I didn't my $q = new CGI; print $q->header( -type => "application/notepad", -Content_disposition => "attachment; filename=$filename"); my $buffer = ""; while ( read( FILE, $buffer, 1026) ) { print "$buffer"; } close FILE; #----------------------- Good luck -- David Innes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From scott at mail.dsab.rresearch.com Fri Feb 15 20:21:45 2002 From: scott at mail.dsab.rresearch.com (Scott Blachowicz) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script In-Reply-To: <012e01c1b5ec$23237480$3d88ddd1@aciwin>; from richard@richard-anderson.org on Thu, Feb 14, 2002 at 10:43:51PM -0800 References: <20020214192430.A33944@sabami.seaslug.org> <012e01c1b5ec$23237480$3d88ddd1@aciwin> Message-ID: <20020215182144.A935@sabami.seaslug.org> On Thu, Feb 14, 2002 at 10:43:51PM -0800, Richard Anderson wrote: > FindBin is the way to go. Scott's and dancerboy's code fails when the > script is invoked using a relative pathname, e.g., cd $HOME; > bin/myscript.pl. In what way does it "fail"? It seems to work fine for me (given the caveat I mentioned about not doing any chdir type stuff). And I never knew about FindBin before...and yes, that "s" command of mine looks pretty stupid (don't know how that evolved to the way it was). Scott > You could try further hacking on $0, e.g. > > use Cwd; > ($dir = $0) =~ s,(.*)/[^/]+$,$1,; > unless ($dir =~ /^\//) { > $dir = getcwd() . '/' . $dir; # Prefix current working > directory to relative pathname > $dir =~ s/\/\.$//; # Strip trailing /. > $dir =~ s#/\.\./#/#g; # Not necessary, but > aesthetically better > } > > but this flunks on Windows and other OSes. Use FindBin. > > Cheers, > Richard > richard@richard-anderson.org > www.richard-anderson.org > www.raycosoft.com > ----- Original Message ----- > From: "dancerboy" > To: "Scott Blachowicz" ; "Daryn Nakhuda" > > Cc: > Sent: Thursday, February 14, 2002 8:23 PM > Subject: Re: SPUG: finding directory of script > > > > At 7:24 pm -0800 2/14/02, Scott Blachowicz wrote: > > >On Thu, Feb 14, 2002 at 06:12:05PM -0800, Daryn Nakhuda wrote: > > >> > > >> Is there a best way to get the directory containing the script > > >> you're running? or a way to use relative paths from that > > >> directory to read files? > > >> > > >> 1. pwd,cwd both return the directory you're running the script from > > >> (working directory), not where it lives. > > >> > > >> 2. using ./ or ../ is going to be relative to the working dir, not the > > >> script's dir > > >> > > >> 3. $0 could be used, but you'd have to parse for a ./ or no /, and in > > >> those cases use the working dir. > > >> > > >> I don't mind using #3, that would always work, right? > > > > > > You might also want to take a look at the standard FindBin module, > > which is supposed to do what you're trying to do (though IME it's not > > quite as robust as it should be: e.g. it never seems to get the paths > > right when my scripts are run as CGI...) > > > > > > > (my $dir = $0) =~ s,(.*)/[^/]+$,$1,; > > > > A little verbose, isn't this? Wouldn't > > > > (my $dir = $0) =~ s,/[^/]+$,,; > > > > do exactly the same thing, with less work? (And personally, I find > > the shorter version easier to read...) > > > > -jason > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > > > > > -- Scott Blachowicz - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dvergin at igc.org Sat Feb 16 00:55:07 2002 From: dvergin at igc.org (David Vergin) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: CPAN question In-Reply-To: <20020215103945.A32714@www.ladro.com> Message-ID: <003701c1b6b6$de8a6740$0200000a@bigmindmedia.com> When the CPAN.pm module tries to upgrade to a newer version of Perl without your permission, the solution is to upgrade the CPAN.pm module itself! Certain versions of the CPAN.pm module do this Perl upgrade in some circumstances. The most recent versions do not do this. IIRC, the behavior was first observed in the spring of 2001 and the problem was resolved with a newer version of the CPAN.pm module in early summer. David V. > -----Original Message----- > From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of > Chris Wilkes > Sent: Friday, February 15, 2002 10:40 AM > To: spug-list@pm.org > Subject: Re: SPUG: CPAN question > > > On Wed, Feb 13, 2002 at 08:52:40AM -0800, Peter Darley wrote: > > Friends, > > Is there any way that I can get CPAN to not try to upgrade my perl > > 5.005 to perl 5.6? I don't have the libs installed to use > > 5.6, but would like to be able to use 'perl -MCAPN -e shell'. > > Thanks, Peter Darley > > Did you get any responses for this question as this has happened to me a > number of times and I've just given up and upgraded. > > Poking around on http://groups.google.com I couldn't find an answer > either, but it seems like this behavior happens when you do a 'force > install' of a module. Maybe that module requires 5.6.x? > > You could always just use CPAN to download the module for you and then cd > into the ~/.cpan/build/ directory and compile it up yourself. > > Chris > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Sat Feb 16 11:16:34 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: finding directory of script References: <20020214192430.A33944@sabami.seaslug.org> <012e01c1b5ec$23237480$3d88ddd1@aciwin> <20020215182144.A935@sabami.seaslug.org> Message-ID: <01fe01c1b70d$b1b5e3f0$3d88ddd1@aciwin> Your method fails in the sense that it does not always return the full pathname to the script's directory. Given the script getdir.pl: #! /usr/bin/perl use Cwd; ($dir = $0) =~ s,(.*)/[^/]+$,$1,; print "Script directory: ", $dir, "\n"; unless ($dir =~ /^\//) { $dir = getcwd() . '/' . $dir; # Prefix current working directory $dir =~ s/\/\.$//; # Strip trailing /. $dir =~ s#/\.\./#/#g; # Not necessary, but aesthetically better } print "Better script directory: ", $dir, "\n"; Here are the results on Linux: $ cd $HOME $ cd bin $ getdir.pl Script directory: /home/s/starfire/bin Better script directory: /home/s/starfire/bin $ ./getdir.pl Script directory: . Better script directory: /home/s/starfire/bin $ cd ../misc $ ../bin/getdir.pl Script directory: ../bin Better script directory: /home/s/starfire/misc/bin If all you want is a relative pathname, your method is fine. However, both our methods fails completely on Windows and MacOS. My recommendation is still to use the CPAN module FindBin. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Scott Blachowicz" To: Sent: Friday, February 15, 2002 6:21 PM Subject: Re: SPUG: finding directory of script > On Thu, Feb 14, 2002 at 10:43:51PM -0800, Richard Anderson wrote: > > FindBin is the way to go. Scott's and dancerboy's code fails when the > > script is invoked using a relative pathname, e.g., cd $HOME; > > bin/myscript.pl. > > In what way does it "fail"? It seems to work fine for me (given the caveat I > mentioned about not doing any chdir type stuff). And I never knew about > FindBin before...and yes, that "s" command of mine looks pretty stupid (don't > know how that evolved to the way it was). > > Scott > > > You could try further hacking on $0, e.g. > > > > use Cwd; > > ($dir = $0) =~ s,(.*)/[^/]+$,$1,; > > unless ($dir =~ /^\//) { > > $dir = getcwd() . '/' . $dir; # Prefix current working > > directory to relative pathname > > $dir =~ s/\/\.$//; # Strip trailing /. > > $dir =~ s#/\.\./#/#g; # Not necessary, but > > aesthetically better > > } > > > > but this flunks on Windows and other OSes. Use FindBin. > > > > Cheers, > > Richard > > richard@richard-anderson.org > > www.richard-anderson.org > > www.raycosoft.com > > ----- Original Message ----- > > From: "dancerboy" > > To: "Scott Blachowicz" ; "Daryn Nakhuda" > > > > Cc: > > Sent: Thursday, February 14, 2002 8:23 PM > > Subject: Re: SPUG: finding directory of script > > > > > > > At 7:24 pm -0800 2/14/02, Scott Blachowicz wrote: > > > >On Thu, Feb 14, 2002 at 06:12:05PM -0800, Daryn Nakhuda wrote: > > > >> > > > >> Is there a best way to get the directory containing the script > > > >> you're running? or a way to use relative paths from that > > > >> directory to read files? > > > >> > > > >> 1. pwd,cwd both return the directory you're running the script from > > > >> (working directory), not where it lives. > > > >> > > > >> 2. using ./ or ../ is going to be relative to the working dir, not the > > > >> script's dir > > > >> > > > >> 3. $0 could be used, but you'd have to parse for a ./ or no /, and in > > > >> those cases use the working dir. > > > >> > > > >> I don't mind using #3, that would always work, right? > > > > > > > > > You might also want to take a look at the standard FindBin module, > > > which is supposed to do what you're trying to do (though IME it's not > > > quite as robust as it should be: e.g. it never seems to get the paths > > > right when my scripts are run as CGI...) > > > > > > > > > > (my $dir = $0) =~ s,(.*)/[^/]+$,$1,; > > > > > > A little verbose, isn't this? Wouldn't > > > > > > (my $dir = $0) =~ s,/[^/]+$,,; > > > > > > do exactly the same thing, with less work? (And personally, I find > > > the shorter version easier to read...) > > > > > > -jason > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > > > > > > > > > > > -- > Scott Blachowicz > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From pdarley at kinesis-cem.com Mon Feb 18 07:54:12 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: CPAN question In-Reply-To: <003701c1b6b6$de8a6740$0200000a@bigmindmedia.com> Message-ID: David, Great! I'll do this. Thanks, Peter Darley -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of David Vergin Sent: Friday, February 15, 2002 10:55 PM To: spug-list@pm.org Subject: RE: SPUG: CPAN question When the CPAN.pm module tries to upgrade to a newer version of Perl without your permission, the solution is to upgrade the CPAN.pm module itself! Certain versions of the CPAN.pm module do this Perl upgrade in some circumstances. The most recent versions do not do this. IIRC, the behavior was first observed in the spring of 2001 and the problem was resolved with a newer version of the CPAN.pm module in early summer. David V. > -----Original Message----- > From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of > Chris Wilkes > Sent: Friday, February 15, 2002 10:40 AM > To: spug-list@pm.org > Subject: Re: SPUG: CPAN question > > > On Wed, Feb 13, 2002 at 08:52:40AM -0800, Peter Darley wrote: > > Friends, > > Is there any way that I can get CPAN to not try to upgrade my perl > > 5.005 to perl 5.6? I don't have the libs installed to use > > 5.6, but would like to be able to use 'perl -MCAPN -e shell'. > > Thanks, Peter Darley > > Did you get any responses for this question as this has happened to me a > number of times and I've just given up and upgraded. > > Poking around on http://groups.google.com I couldn't find an answer > either, but it seems like this behavior happens when you do a 'force > install' of a module. Maybe that module requires 5.6.x? > > You could always just use CPAN to download the module for you and then cd > into the ~/.cpan/build/ directory and compile it up yourself. > > Chris > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From digigasm at sdf.lonestar.org Mon Feb 18 21:19:10 2002 From: digigasm at sdf.lonestar.org (Michael) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Lottery Analyzer Message-ID: Hello, I am trying to write a little lotto analyzer, just for self-indulgence. I'm not really trying to win Lotto, but just using it as an interesting excuse to increase my perl exposure. If I win, bonus! Here's what I have so far: A text file containing WA Lotto results back to 1999. Each line in the file contains date (MMM-DD-YYYY) followed by whitespace followed by first picked number followed by whitespace follwed by second picked number, etc. Example: Jan-16-1999 12 14 16 33 35 45 Jan-13-1999 2 25 32 35 41 45 Jan-09-1999 3 10 11 12 19 35 Jan-06-1999 19 24 32 37 41 42 Jan-02-1999 3 8 20 36 38 39 Here's the code I have so far: ##!/usr/bin/perl -w #open(DATA, "< lottery.txt"); # #while () { #chomp; #s/\s+/:/g; #@line=split(':', $_); ## print "$line[0]\n"; #print "@line\n"; ## $line{$line[0]}=$line[1..6]; #} #close(DATA); ---------------------------------- I'm looking more for help with techniques and references rather than just code examples but I'll appreciate any advice/help offered. I want to start by finding the most often occurring numbers, but I'm pretty new to programming, and don't really know how to go about doing it. I suspect I'll need to use a hash or two, but I don't know where to start. After finding the most often occurring numbers, I'll probably want to look into the numbers between the numbers. Finding things like the average span between numbers; stuff like that. Can any of you offer advice on the data structures I'll need to work with? If I win, I'll give SPUG a million :) I'd really only be able to handle 1-2 million by myself. digigasm@freeshell.org SDF Public Access UNIX System - http://sdf.lonestar.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Tue Feb 19 00:00:50 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Lottery Analyzer In-Reply-To: ; from digigasm@sdf.lonestar.org on Tue, Feb 19, 2002 at 03:19:10AM +0000 References: Message-ID: <20020218220050.A72296@www.ladro.com> On Tue, Feb 19, 2002 at 03:19:10AM +0000, Michael wrote: > > I want to start by finding the most often occurring numbers, but I'm > pretty new to programming, and don't really know how to go about doing it. > I suspect I'll need to use a hash or two, but I don't know where to start. > > After finding the most often occurring numbers, I'll probably want to look > into the numbers between the numbers. Finding things like the average > span between numbers; stuff like that. > > Can any of you offer advice on the data structures I'll need to work with? > If I win, I'll give SPUG a million :) I'd really only be able to handle > 1-2 million by myself. I would use a hash, making the lotto number the key and the number of times it has shown up as the value. That would mean you'll have a hash that looks like $seen{'35'} => 3 # the number 35 shows up three times There's an example if you type "perldoc -q word" Since you used the split function in your example I'll use it in this modification. The sort part is a little tricky to newcomers, do a "perldoc -q sort" to see what's going on. In a nutshell you're sorting by the value, and you have to do this numerically with the <=> operator. As for your next part on doing statistical analysis, I would check out the Statistics:: modules on CPAN first to see if someone else has already done the work for you. "perldoc CPAN" to see how to use it, or type "perl -MCPAN -e shell" and then "install Statistics::Descriptive" to get one that does simple stuff like mode. If you want to tackle this yourself use the @ary array as that's in the order read in, which you'll need if you want to find out the distance between two numbers. Of course you'll have to make sure that the input is in some sort of dated order. Good luck! Chris #!/usr/bin/perl use strict; my (%seen, @ary); while () { chomp; s/^\S+\s+//; # get rid of date as you don't need it foreach (split) { # loop over each value on the line $seen{$_}++; # $_ is the lotto number push @ary, $_; # if you wanted to } } foreach (sort {$seen{$b} <=> $seen{$a} } keys %seen) { print "$_\t$seen{$_}\n"; } __DATA__ Jan-16-1999 12 14 16 33 35 45 Jan-13-1999 2 25 32 35 41 45 Jan-09-1999 3 10 11 12 19 35 Jan-06-1999 19 24 32 37 41 42 Jan-02-1999 3 8 20 36 38 39 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Tue Feb 19 13:02:41 2002 From: sweetsue at sweethomes.com (S Bullo) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: How to deal with pop-ups in automation Message-ID: Does anyone know how to get around or deal with automatic pop-ups when running a script? I have one that inserts a bunch of information into a url, two items being a username and a password. A site has been set up to use .htaccess and this, of course, causes a pop-up box to open for this information. I'm not certain how to go about having my script "see" this and adjust accordingly. Any help is appreciated! Susanne Bullo -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020219/3f660462/attachment.htm From daryn at marinated.org Tue Feb 19 13:30:19 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: How to deal with pop-ups in automation In-Reply-To: Message-ID: I'm assuming you're talking about basic auth; in that case just send the following header in the http request, and it will be authenticated. Authorization: Basic wqdjqd32jf3kj== that second piece is user:password base 64 encoded. On Tue, 19 Feb 2002, S Bullo wrote: > Does anyone know how to get around or deal with automatic pop-ups when > running a script? I have one that inserts a bunch of information into a > url, two items being a username and a password. A site has been set up to > use .htaccess and this, of course, causes a pop-up box to open for this > information. I'm not certain how to go about having my script "see" this > and adjust accordingly. > > Any help is appreciated! > > Susanne Bullo > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Tue Feb 19 14:09:11 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: How to deal with pop-ups in automation In-Reply-To: References: Message-ID: <20020219200911.GC14846@titanium.brain.org> On Tue, Feb 19, 2002 at 11:02:41AM -0800, S Bullo wrote: > > Does anyone know how to get around or deal with automatic pop-ups when > running a script? I have one that inserts a bunch of information into > a url, two items being a username and a password. A site has been set > up to use .htaccess and this, of course, causes a pop-up box to open > for this information. I'm not certain how to go about having my > script "see" this and adjust accordingly. http://username:password@hostname/path -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Feb 19 14:22:46 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Re: How to deal with pop-ups in automation References: Message-ID: <001501c1b983$33da3f80$2188ddd1@aciwin> If you don't have a valid userid/password for the server you are accessing, you are out of luck (unless you are a good cracker and are willing to risk arrest and prosecution :-] ). The way I handled this situation was to use CPAN modules LWP::UserAgent and HTTP::Request::Common to create an HTTP user agent. This allows you to pass a userid and password with your request. Here's a sketchy code outline: use HTTP::Request::Common qw(GET POST); use HTTP::Response qw(code content is_error status_line); use LWP::UserAgent qw(agent request); $request = POST($url, [ ]); $request->header('Content-type' => 'application/x-www-form-urlencoded'); $request->authorization_basic($test->{auth}->[0], $test->{auth}->[1]); $response = $user_agent->request($request); Some informational resources: perldoc lwpcook perldoc HTTP::Response CPAN module HTTP::WebTest Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "S Bullo" To: "Seattle Perl User's Group" Sent: Tuesday, February 19, 2002 11:02 AM Subject: SPUG: How to deal with pop-ups in automation > Does anyone know how to get around or deal with automatic pop-ups when > running a script? I have one that inserts a bunch of information into a > url, two items being a username and a password. A site has been set up to > use .htaccess and this, of course, causes a pop-up box to open for this > information. I'm not certain how to go about having my script "see" this > and adjust accordingly. > > Any help is appreciated! > > Susanne Bullo > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Tue Feb 19 14:26:28 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Re: How to deal with pop-ups in automation Message-ID: <001e01c1b983$b714c2d0$2188ddd1@aciwin> Correction to sketchy code: use HTTP::Request::Common qw(GET POST); use HTTP::Response qw(code content is_error status_line); use LWP::UserAgent qw(agent request); $request = POST($url, [ ]); $request->header('Content-type' => 'application/x-www-form-urlencoded'); $request->authorization_basic($userid, $password); # Handle basic authorization $response = $user_agent->request($request); ----- Original Message ----- From: "Richard Anderson" To: "S Bullo" ; "Seattle Perl User's Group" Sent: Tuesday, February 19, 2002 12:22 PM Subject: Re: How to deal with pop-ups in automation > If you don't have a valid userid/password for the server you are accessing, > you are out of luck (unless you are a good cracker and are willing to risk > arrest and prosecution :-] ). > > The way I handled this situation was to use CPAN modules LWP::UserAgent and > HTTP::Request::Common to create an HTTP user agent. This allows you to pass > a userid and password with your request. Here's a sketchy code outline: > use HTTP::Request::Common qw(GET POST); > use HTTP::Response qw(code content is_error status_line); > use LWP::UserAgent qw(agent request); > $request = POST($url, [ ]); > $request->header('Content-type' => 'application/x-www-form-urlencoded'); > $request->authorization_basic($test->{auth}->[0], $test->{auth}->[1]); > $response = $user_agent->request($request); > > Some informational resources: > perldoc lwpcook > perldoc HTTP::Response > CPAN module HTTP::WebTest > > Cheers, > Richard > richard@richard-anderson.org > www.richard-anderson.org > www.raycosoft.com > ----- Original Message ----- > From: "S Bullo" > To: "Seattle Perl User's Group" > Sent: Tuesday, February 19, 2002 11:02 AM > Subject: SPUG: How to deal with pop-ups in automation > > > > Does anyone know how to get around or deal with automatic pop-ups when > > running a script? I have one that inserts a bunch of information into a > > url, two items being a username and a password. A site has been set up to > > use .htaccess and this, of course, causes a pop-up box to open for this > > information. I'm not certain how to go about having my script "see" this > > and adjust accordingly. > > > > Any help is appreciated! > > > > Susanne Bullo > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From aaron at activox.com Wed Feb 20 08:38:33 2002 From: aaron at activox.com (Aaron Salo) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: CPAN question In-Reply-To: <003701c1b6b6$de8a6740$0200000a@bigmindmedia.com> References: <20020215103945.A32714@www.ladro.com> Message-ID: <3.0.5.32.20020220063833.01b75f40@pop3.norton.antivirus> Was the fix to have it prompt you nicely and imply that it will only update itself before it starts a perl flush-and-refresh? Two weeks ago I logged into a customer's server to install a couple modules. While I was in the CPAN shell arranging for the couple packages I wanted, CPAN prompted me and suggested in a very nice tone that I update CPAN.pm to the newest version during my stay, and that I was good looking and smart. I said okay, since you put it that way, sure, go ahead, update *yourself*. I then made the mistake of not paying attention for a few minutes. IT UPGRADED THE ENTIRE PERL INSTALLATION. Fortunately no harm done in this instance but obviously this is the sort of thing where you would like a clear warning, a la "if you do this you will upgrade Perl and all std modules to the latest versions as well". I think. Although I was happy to find out that I am smart and good looking. Okay, that part really didn't happen. But the rest is true, I swear it! ~!a At 10:55 PM 2/15/2002 -0800, David Vergin wrote: >When the CPAN.pm module tries to upgrade to a newer version of Perl without your >permission, the solution is to upgrade the CPAN.pm module itself! > >Certain versions of the CPAN.pm module do this Perl upgrade in some >circumstances. The most recent versions do not do this. IIRC, the behavior was >first observed in the spring of 2001 and the problem was resolved with a newer >version of the CPAN.pm module in early summer. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Thu Feb 21 11:41:46 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: FL PM groups Message-ID: I'm in Florida for a bit, and wanting to get involved with some Perl folks while I'm here. I've -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Thu Feb 21 11:45:39 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: FL PM groups Message-ID: I'm in Florida for a bit, and wanting to get involved with some Perl folks while I'm here. I've sent email to the list I found at pm.org, but haven't gotten responses yet. Does anyone know of an active Perl group (or an active Perl person) that I could get in touch with to plug into the Perl community while I'm here? Thanks, Michael -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Thu Feb 21 12:07:02 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: FL PM groups In-Reply-To: Message-ID: <20020221180702.3778.qmail@web14202.mail.yahoo.com> Michael R. Wolf wrote: > I'm in Florida for a bit, and wanting to get > involved with some Perl folks while I'm here. > I've sent email to the list I found at pm.org, > but haven't gotten responses yet. Does anyone > know of an active Perl group (or an active > Perl person) that I could get in touch with to > plug into the Perl community while I'm here? Do you want to be more specific? Florida is pretty big. Also try Google. Asim __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From MichaelRunningWolf at att.net Thu Feb 21 15:17:38 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: FL PM groups In-Reply-To: <20020221180702.3778.qmail@web14202.mail.yahoo.com> References: <20020221180702.3778.qmail@web14202.mail.yahoo.com> Message-ID: Asim Jalis writes: > Michael R. Wolf wrote: > > I'm in Florida for a bit, and wanting to get > > involved with some Perl folks while I'm here. > > I've sent email to the list I found at pm.org, > > but haven't gotten responses yet. Does anyone > > know of an active Perl group (or an active > > Perl person) that I could get in touch with to > > plug into the Perl community while I'm here? > > Do you want to be more specific? Florida is > pretty big. No. I'm pretty mobile. -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From listings at submititright.com Thu Feb 21 17:29:02 2002 From: listings at submititright.com (Jennifer Jenkins) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: re: your Yahoo listing Message-ID: <200202211529917.SM01412@fvt-s04> We'd like to offer you the opportunity to list your website on Yahoo. Click here if you're interested: http://www.submititright.com/?AID=y4&Email=spug-list%40pm.org Your site will be indexed and listed within 5 days. Best Regards, Jennifer Jenkins Customer Service ********************************************************** Note: If your e-mail program did not display the link correctly, simply copy and paste the following line into your browser's address bar and hit [ENTER]: http://www.submititright.com/?AID=y4&Email=spug-list%40pm.org ********************************************************** Why are you on our mailing list? You opted-in to our mailing list when you submitted your ad or URL (either manually or through a submission service) to one of our search engines, FFA, or classified sites. To unsubscribe, please click here: http://www.futurevisiontoday.com/promotion/remove.asp?AID=y4&Email=spug-list%40pm.org ********************************************************** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Fri Feb 22 16:11:44 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? Message-ID: <20020222141144.A7945@www.ladro.com> Hello everyone, I wanted to read in a mutt configuration file and only pull out one of the lines that starts with mailboxes so I did this: #!/usr/bin/perl -w $file = ".muttrc"; open (FOO, $file) || die "Can't open $file\n"; while ( !~ /^mailboxes/) { print "#$_\n"; } close FOO; print "$_\n"; To my surprise just a bunch of pound signs show up. $_ has been replaced with nothing in the loop; also exiting the loop $_ is set to nothing. There are warnings about "use of an uninitialized value in concatentation" Then I decided to go about the easy way of fixing this: while (($in = ) !~ /^mailboxes/) { } # Style 2 which gave me $in on the exit. However being the experimental type I decided to do this: while (($_ = ) !~ /^mailboxes/) { } # Style 3 now in the loop and exiting $_ is set to the right thing, that is each line of the .muttrc file. I think the warning happens as the magic variable doesn't match ^mailboxes so it complains on the "print $_" line as there is nothing in there. However it does exit at the right time when it hits ^mailboxes so I would expect it to be in $_ upon exit. Can someone shed some light on this? Also when I did this with and __DATA__ instead of the filehandle FOO it complains about a pattern match in addition to the concatenation error when doing it in Style #3, where it didn't complain before with the opened file. The script also loops on forever if it can't (not) match the ^mailboxes.: #!/usr/bin/perl -w while (($_ = ) !~ /^mailboxes/) { print "#$_\n"; } __DATA__ The quick brown fox jumped over the lazy dog That boggles me too. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Fri Feb 22 16:42:49 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:43 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? In-Reply-To: <20020222141144.A7945@www.ladro.com> References: <20020222141144.A7945@www.ladro.com> Message-ID: <138990000.1014417769@benzene.cobaltgroup.com> -- Chris Wilkes spake thusly: > I wanted to read in a mutt configuration file and only pull out one > of the lines that starts with mailboxes so I did this: Why not just do: #!/usr/bin/perl -w $file = ".muttrc"; open (FOO, $file) || die "Can't open $file\n"; while () { last if =~ /^mailboxes/; print "#$_\n"; } close FOO; print "$_\n"; This gives you the proper while condition (while reading the file) and $_ behavior, with an additional exit condition. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020222/b01a5fd0/attachment.bin From dean at ero.com Fri Feb 22 16:41:43 2002 From: dean at ero.com (Dean Hudson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? In-Reply-To: <20020222141144.A7945@www.ladro.com> References: <20020222141144.A7945@www.ladro.com> Message-ID: <20020222224143.GA18803@ero.com> If you want $_ to get set you should probably do something more like: while () { next if /^mailboxes/; } while ( !~ /^mailboxes/) does not set implicitly set $_ the way you hope. It's not really clear to me what you're trying to do exactly. Do you want to print the mailboxes line with a prepended # or the other lines with a # prepended. Here's another way you could do either: dean@apogee:~ > perl -e 'grep {/^mailboxes/ && print "#$_" } <>'; this is a test mailboxes test #mailboxes dean@apogee:~ > perl -e 'grep {!/^mailboxes/ && print "#$_" } <>'; this is a test mailboxes test #this #is #a #test #test dean@apogee:~ > dean. On Fri, Feb 22, 2002 at 02:11:44PM -0800, Chris Wilkes wrote: > Hello everyone, > > I wanted to read in a mutt configuration file and only pull out one of > the lines that starts with mailboxes so I did this: > #!/usr/bin/perl -w > $file = ".muttrc"; > open (FOO, $file) || die "Can't open $file\n"; > while ( !~ /^mailboxes/) { > print "#$_\n"; > } > close FOO; > print "$_\n"; > To my surprise just a bunch of pound signs show up. $_ has been > replaced with nothing in the loop; also exiting the loop $_ is set to > nothing. There are warnings about "use of an uninitialized value in > concatentation" > Then I decided to go about the easy way of fixing this: > while (($in = ) !~ /^mailboxes/) { } # Style 2 > which gave me $in on the exit. However being the experimental type I > decided to do this: > while (($_ = ) !~ /^mailboxes/) { } # Style 3 > now in the loop and exiting $_ is set to the right thing, that is each > line of the .muttrc file. > I think the warning happens as the magic variable doesn't match > ^mailboxes so it complains on the "print $_" line as there is nothing in > there. However it does exit at the right time when it hits ^mailboxes > so I would expect it to be in $_ upon exit. > Can someone shed some light on this? > Also when I did this with and __DATA__ instead of the > filehandle FOO it complains about a pattern match in addition to the > concatenation error when doing it in Style #3, where it didn't complain > before with the opened file. The script also loops on forever if it > can't (not) match the ^mailboxes.: > #!/usr/bin/perl -w > while (($_ = ) !~ /^mailboxes/) { > print "#$_\n"; > } > __DATA__ > The quick brown fox > jumped over > the lazy dog > That boggles me too. > > Chris > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes at ladro.com Fri Feb 22 17:01:11 2002 From: cwilkes at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? In-Reply-To: <20020222224143.GA18803@ero.com>; from dean@ero.com on Fri, Feb 22, 2002 at 02:41:43PM -0800 References: <20020222141144.A7945@www.ladro.com> <20020222224143.GA18803@ero.com> Message-ID: <20020222150111.A8365@www.ladro.com> On Fri, Feb 22, 2002 at 02:41:43PM -0800, Dean Hudson wrote: > If you want $_ to get set you should probably do something more like: > > while () { > next if /^mailboxes/; > } > > while ( !~ /^mailboxes/) does not set implicitly set $_ the way > you hope. > > It's not really clear to me what you're trying to do exactly. Do you > want to print the mailboxes line with a prepended # or the other lines > with a # prepended. > > Here's another way you could do either: > > dean@apogee:~ > perl -e 'grep {/^mailboxes/ && print "#$_" } <>'; I'm just trying to scan down through .muttrc for the line that starts with "mailboxes" and I'm currently doing it the way Matt Tucker has with a simple while () { last if (/^mailboxes/); } print if ($_); which is fine. The grep you had works even better if I had two ^mailboxes lines in there. I'm a little leary about using grep like this as it sucks in all of into a big array and then goes over it. But I know this file is only going to be a couple dozen lines so I'm fine. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dean at ero.com Fri Feb 22 16:56:30 2002 From: dean at ero.com (Dean Hudson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? In-Reply-To: <20020222224143.GA18803@ero.com> References: <20020222141144.A7945@www.ladro.com> <20020222224143.GA18803@ero.com> Message-ID: <20020222225630.GA19756@ero.com> Sorry if my response was mildly incoherent; I was interrupted in the process of writing it and never fully recovered. To clarify (just a bit): on the command line output below, the lines beginning with '#' were generated by the one-liners whereas the lines not beginning with '#' were typed by me into STDIN. dean. On Fri, Feb 22, 2002 at 02:41:43PM -0800, Dean Hudson wrote: > If you want $_ to get set you should probably do something more like: > > while () { > next if /^mailboxes/; > } > > while ( !~ /^mailboxes/) does not set implicitly set $_ the way > you hope. > > It's not really clear to me what you're trying to do exactly. Do you > want to print the mailboxes line with a prepended # or the other lines > with a # prepended. > > Here's another way you could do either: > > dean@apogee:~ > perl -e 'grep {/^mailboxes/ && print "#$_" } <>'; > this > is > a > test > mailboxes > test > #mailboxes > > dean@apogee:~ > perl -e 'grep {!/^mailboxes/ && print "#$_" } <>'; > this > is > a > test > mailboxes > test > #this > #is > #a > #test > #test > dean@apogee:~ > > > dean. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From dean at ero.com Fri Feb 22 17:07:16 2002 From: dean at ero.com (Dean Hudson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Should I not do while ( !~ /^mailboxes/) { } ? In-Reply-To: <20020222150111.A8365@www.ladro.com> References: <20020222141144.A7945@www.ladro.com> <20020222224143.GA18803@ero.com> <20020222150111.A8365@www.ladro.com> Message-ID: <20020222230716.GC19756@ero.com> On Fri, Feb 22, 2002 at 03:01:11PM -0800, Chris Wilkes wrote: > I'm a little leary about using grep like this as it sucks in all of > into a big array and then goes over it. But I know this file > is only going to be a couple dozen lines so I'm fine. Know your enemy. Then type as little as possible but no less, lest the forward compatibility police find you and hit you in the head with a melon. dean. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From oladar at drizzle.com Fri Feb 22 21:47:12 2002 From: oladar at drizzle.com (Sean Dwyer) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: question on fork() Message-ID: All, What I am trying to do is iterate through a list (call it 100 items for sake of argument) 5 at a time. I can fork off the initial 5 processes but is it possible to, as a processes finishes, spawn a new proceses to handle the next item in the list. Everything I have tried so far isn't working. ANy advice would be great. thanks, Sean Dwyer Oladar Computer Services - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From oladar at drizzle.com Fri Feb 22 21:53:33 2002 From: oladar at drizzle.com (Sean Dwyer) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: question on fork() In-Reply-To: Message-ID: I realised in re-reading this that I left out a few to many details. I am working on HPUX/Linux while I am doing this so I can use POSIX. The child processes will connect to a database do there work and then close quietly of error out into the sql servers error logs where they can be picked up later and dealt with. All I am really concerned with here though is the controlling processes for the threads. Sean -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Sean Dwyer Sent: Friday, February 22, 2002 7:47 PM To: Spug Subject: SPUG: question on fork() All, What I am trying to do is iterate through a list (call it 100 items for sake of argument) 5 at a time. I can fork off the initial 5 processes but is it possible to, as a processes finishes, spawn a new proceses to handle the next item in the list. Everything I have tried so far isn't working. ANy advice would be great. thanks, Sean Dwyer Oladar Computer Services - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Sat Feb 23 02:07:58 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Re: question on fork() References: Message-ID: <000c01c1bc41$36964b40$2e88ddd1@aciwin> Being a fan of the System V interprocess communication facilities, I'd put the list in shared memory with an associated semaphore to allow multiple processes to use the list. Then I'd fork of 5 subprocesses, each of which takes an item off the list, processes it, then takes another item off the list until the list is empty. No need to keep respawning subprocesses; five is all you need. See man perlipc. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "Sean Dwyer" To: "Spug" Sent: Friday, February 22, 2002 7:47 PM Subject: SPUG: question on fork() > All, > > What I am trying to do is iterate through a list (call it 100 items for > sake of argument) 5 at a time. I can fork off the initial 5 processes but is > it possible to, as a processes finishes, spawn a new proceses to handle the > next item in the list. Everything I have tried so far isn't working. ANy > advice would be great. > > thanks, > > Sean Dwyer > Oladar Computer Services > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Sat Feb 23 12:58:55 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Perl virtual machine browser plugins Message-ID: <20020223105855.B1035@timji.consultix.wa.com> Creation of real-time dynamic web sites seems to be a rather disparate process with java and javascritp on the client side and Perl on the server side. Are there any Perl byte code run time virtual machine plug-ins for browsers? What is the most integrated dynamic web development environment currently available? Thanks Scott W. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From noah at geospiza.com Mon Feb 25 12:02:29 2002 From: noah at geospiza.com (Noah Iliinsky) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Perl virtual machine browser plugins In-Reply-To: <20020223105855.B1035@timji.consultix.wa.com> References: <20020223105855.B1035@timji.consultix.wa.com> Message-ID: <02022510022901.24544@backbay.office.geospiza> Curl might be your solutions. I know very little about it, but it is plug-in based and allows you to send sophisticated code to the browser. http://www.curl.com/html/ Cheers, Noah On Saturday 23 February 2002 10:58, Tim Maher wrote: > Creation of real-time dynamic web sites seems to be a rather disparate > process with java and javascritp on the client side and Perl on the > server side. Are there any Perl byte code run time virtual machine > plug-ins for browsers? What is the most integrated dynamic web > development environment currently available? > > Thanks > Scott W. > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org -- Noah Iliinsky noah at geospiza dot com (206) 633-4403 x106 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From asimjalis at yahoo.com Mon Feb 25 13:32:58 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Perl virtual machine browser plugins In-Reply-To: <02022510022901.24544@backbay.office.geospiza> Message-ID: <20020225193258.58244.qmail@web14201.mail.yahoo.com> > Curl might be your solutions. I know very little > about it, but it is plug-in based and allows you > to send sophisticated code to the browser. > > http://www.curl.com/html/ Curl has two main problems: First it is another attempt by the MIT/New England crowd to sneak Lisp into the mainstream (it's Lisp with curlies instead of parens). Second it has a really wacky and mildly oppressive license. Basically you pay every time someone downloads your curl script. Here is an excerpt from their web page: http://www.curl.com/html/products/pricing.jsp?c1=46 "Our fees are based upon the size of files written in the Curl content language that are executed on client devices . . . " "Our license fees are $0.001 per kilobyte of Curl language source code executed on a client device. This includes applets, packages and scripts written in the Curl content language; but does not include data or images." Asim __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From wildwood_players at yahoo.com Mon Feb 25 14:14:57 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: backticks, system, and ImageMagick Message-ID: <20020225201457.69859.qmail@web11503.mail.yahoo.com> I am a unix kind of guy trying to function in a win98 situation. I am having a problem with backticks and I am looking for new ideas on what it could be. I am running in a MSDOS window trying to execute some ImageMagick commands from perl. The path to the ImageMagick bin directory in included in my PATH environment variable. I can issue all of the ImageMagick commands from the command line (mogrify, identify, composite, and montage and they all return the usage for the command. When I write a very simple script such as: perl -e "print `mogrify`;" I get the usage only if I use mogrify, or convert. If I try identify, composite, or montage, I get nothing. On the other hand, if I write: perl -e "system(montage);" it works and returns the usage for all of the commands, but I guess I can't capture the output in an array in my perl when I use system, right? I have tried using the full path to the executable and it still doesn't work. Could some of the commands be writing to something other than STDOUT? like STDERR? I would appreciate any ideas. ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.941.9437 __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Mon Feb 25 14:45:45 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: backticks, system, and ImageMagick In-Reply-To: <20020225201457.69859.qmail@web11503.mail.yahoo.com> References: <20020225201457.69859.qmail@web11503.mail.yahoo.com> Message-ID: <158710000.1014669944@benzene.cobaltgroup.com> -- Richard Wood spake thusly: > I am having a problem with backticks and I am looking > for new ideas on what it could be. > When I write a very simple script such as: > > perl -e "print `mogrify`;" > > I get the usage only if I use mogrify, or convert. > If I try identify, composite, or montage, I get > nothing. > Could some of the commands be writing to something > other than STDOUT? like STDERR? Yes. Backticks fail to capture STDERR, and many programs write their usage to that. However, you should still be seeing the output, since the backticks aren't capturing it. On unix I'd say do '2>&1', but obviously that's not a choice without installing cygwin. The other option is to use something like IPC::Open3. As I recall there's an OO interface to that functionality that works rather nicely, but I can't remember what it's called. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020225/06ea3cf5/attachment.bin From wildwood_players at yahoo.com Mon Feb 25 17:20:47 2002 From: wildwood_players at yahoo.com (Richard Wood) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: backticks, system, and ImageMagick In-Reply-To: <20020225130115.C11297@hobart.helvella.org> Message-ID: <20020225232047.96940.qmail@web11501.mail.yahoo.com> Thanks for your ideas. I didn't get any of them to work yet, but I found that if I specified -verbose on the identify command, the output went to STDOUT and I was able to capture it. Regards, Rich Wood --- Colin Meyer wrote: > On Mon, Feb 25, 2002 at 12:14:57PM -0800, Richard > Wood wrote: > > I am a unix kind of guy trying to function in a > win98 > > situation. > > > > I am having a problem with backticks and I am > looking > > for new ideas on what it could be. > > > > I am running in a MSDOS window trying to execute > some > > ImageMagick commands from perl. The path to the > > ImageMagick bin directory in included in my PATH > > environment variable. I can issue all of the > > ImageMagick commands from the command line > (mogrify, > > identify, composite, and montage and they all > return > > the usage for the command. When I write a very > simple > > script such as: > > Another approach to using ImageMagick tools from > within Perl > programs is to use the Image::Magick module. This > provides a > nice, object oriented interface to all of the > functionallity > of the ImageMagick library. Error conditions are > available > via return values of method calls instead of STDERR > capturing > trickery. > > For more info, see: > http://www.simplesystems.org/ImageMagick/www/perl.html > > The installation section claims that you can install > it on Win95, though > I only have experience using it on Linux and Solaris > systems. I seem to > remember that installing it wasn't quite as straight > forward as most > modules, but don't recall the exact trouble. I think > that it was getting > a compatible version of the ImageMagick library > installed. > > Have fun, > -C. ===== Richard O. Wood Wildwood IT Consultants, Inc. wildwood_players@yahoo.com 425.941.9437 __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ced at carios2.ca.boeing.com Mon Feb 25 17:51:23 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: backticks, system, and ImageMagick Message-ID: <200202252351.PAA16473@carios2.ca.boeing.com> > I didn't get any of them to work yet, but I found that > if I specified -verbose on the identify command, the > output went to STDOUT and I was able to capture it. Perhaps, the problem was that error output was written directly to /dev/tty... At any rate, Perl 5.6.1 at least on W2K seems to get the Unix redirection semantics right: C:\perl -wl my $out = qx{ foo 2>&1 }; die "failed $?: $out" if $?; gives: "failed: 256 'foo' is not recognized as an internal or external command, operable program or batch file. Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From davidinnes at chicagoscience.com Tue Feb 26 00:50:41 2002 From: davidinnes at chicagoscience.com (David Innes (CSG)) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: backticks, system, and ImageMagick References: <20020225232047.96940.qmail@web11501.mail.yahoo.com> Message-ID: <008201c1be91$e7e0a880$077e5e40@converger.net> Yup, I did the same thing when I was learning Perl. I couldn't get PerlMagick running on my (win9x) system so I used shell calls to ImageMagick utilities and used the -verbose argument to capture the results. -- David Innes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From james at banshee.com Tue Feb 26 10:55:50 2002 From: james at banshee.com (James Moore) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Shared colocation? In-Reply-To: <02022510022901.24544@backbay.office.geospiza> Message-ID: <002401c1bee6$73945120$697ba8c0@gealach> Right now I'm using rackspace.com for hosting, and I'd like to switch to a local provider to (hopefully) lower my costs. Would anyone here be interested in sharing a rack or a half-rack at a local colo facility? Or does anyone know of people doing this already who have space available? I'll admit this is slightly off-topic for SPUG, but I need my own machine for mod_perl and to configure perl exactly the way I want it (no asking tech support for module installations, etc.). - James Moore james@banshee.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jcokos at iwebsoftware.com Tue Feb 26 12:28:51 2002 From: jcokos at iwebsoftware.com (John Cokos) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Re: Shared colocation? References: <002401c1bee6$73945120$697ba8c0@gealach> Message-ID: <002201c1bef3$70b86e70$ac00a8c0@IWEBX> You know rackspace has some nice lowend servers from $99/month now.... I've been an RS Customer since they opened their doors (Customer #39). See what they can do about downgrading you John ----- Original Message ----- From: James Moore To: spug-list@pm.org Sent: Tuesday, February 26, 2002 8:55 AM Subject: SPUG: Shared colocation? Right now I'm using rackspace.com for hosting, and I'd like to switch to a local provider to (hopefully) lower my costs. Would anyone here be interested in sharing a rack or a half-rack at a local colo facility? Or does anyone know of people doing this already who have space available? I'll admit this is slightly off-topic for SPUG, but I need my own machine for mod_perl and to configure perl exactly the way I want it (no asking tech support for module installations, etc.). - James Moore james@banshee.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020226/9f09ddc1/attachment.htm From andrew at sweger.net Tue Feb 26 12:38:20 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: [OT] Shared colocation? In-Reply-To: <002401c1bee6$73945120$697ba8c0@gealach> Message-ID: I don't think this is exactly what James is looking for. But his inquiry made me think to spam y'all with an offer (maybe even helping James, shrug). I have rack space to share (you provide your own box). But there's a catch. It's in my basement with UPS (main server up 205 days even through complete house wiring upgrade) and climate controls (well, I'll install the AC down here if it ever gets warmer than 75F) on a 768 kbps SDSL circuit (Covad via Speakeasy, pray Tauzin-Dingell doesn't pass). I'm looking to defray my costs (bandwidth and electricity). So, the price would be honest and reasonable, the bandwidth relatively limited on a single uplink circuit and not much in the way of guarantees. Contact me privately (andrew@sweger.net) if you're interested. There are many points on which I can negotiate (including circuit speed if we decide to upgrade). On Tue, 26 Feb 2002, James Moore wrote: > Right now I'm using rackspace.com for hosting, and I'd like to switch to > a local provider to (hopefully) lower my costs. Would anyone here be > interested in sharing a rack or a half-rack at a local colo facility? > Or does anyone know of people doing this already who have space > available? -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From david.corcoran at Boeing.COM Tue Feb 26 12:45:04 2002 From: david.corcoran at Boeing.COM (EXT-Corcoran, David) Date: Wed Aug 4 00:08:44 2004 Subject: OT: RE: SPUG: Shared colocation? Message-ID: <58B6DA1B98AA9149B13B029976A48BCC088F57E9@xch-nw-31.nw.nos.boeing.com> I just came across this recently, not local, but may be cheaper ... Virtual Machine vs Virtual Host Unlike most other Hosting Companies, we provide you with a Virtual Machine ... a completely encapsulated environment that allows us to provide a higher level of customization than is possible with a Virtual Host. http://www.hub.org --@@ ~ DavidC The Biggest Game In Town - http://www.wces.org/html_files/burien.html Finally, America will begin to see the staggering wealth our own city, county, state, and federal governments hold secret accounts. If these hidden assets - that the AMERICAN PEOPLE own - can be liberated from government agencies, we can see a virtual end to property and income tax. Sound impossible? Then you haven't heard Walter Burien exposing the Comprehensive Annual Financial Report (CAFR) scam. > -----Original Message----- > From: James Moore [mailto:james@banshee.com] > Sent: Tuesday, February 26, 2002 8:56 AM > To: spug-list@pm.org > Subject: SPUG: Shared colocation? > > > Right now I'm using rackspace.com for hosting, and I'd like > to switch to > a local provider to (hopefully) lower my costs. Would anyone here be > interested in sharing a rack or a half-rack at a local colo facility? > Or does anyone know of people doing this already who have space > available? > > I'll admit this is slightly off-topic for SPUG, but I need my own > machine for mod_perl and to configure perl exactly the way I > want it (no > asking tech support for module installations, etc.). > > - James Moore > james@banshee.com > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address > For daily traffic, use spug-list for LIST ; for weekly, > spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From warner at oz.net Tue Feb 26 10:51:22 2002 From: warner at oz.net (Marion Scott Warner) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: rack space Message-ID: <3C7BBD0A.4D6ABA67@oz.net> Speaking of rackspace, does anyone have a short enclosed rack cabinet of recent vintage they would like to sell? I'm not sure I can call my basement a basement, about 6 feet from floor to ceiling. Not enough room for the typical cabinet I'm afraid. OK, not a Perl question, but I'm using Perl CGI scripts, mod_perl, and PostgreSQL. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From brian at tangent.org Tue Feb 26 19:25:08 2002 From: brian at tangent.org (Brian Aker) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: rack space In-Reply-To: <3C7BBD0A.4D6ABA67@oz.net> References: <3C7BBD0A.4D6ABA67@oz.net> Message-ID: <1014773109.21566.249.camel@avenger> On Tue, 2002-02-26 at 08:51, Marion Scott Warner wrote: > Speaking of rackspace, does anyone have a short enclosed rack cabinet > of recent vintage they would like to sell? I'm not sure I can call my > basement A half height rack? I have one. No covers though, it is the steal cage (I believe it has wheels). It was once used for a PDP 11/03. -Brian -- _______________________________________________________ Brian Aker, brian@tangent.org Slashdot Senior Developer Seattle, Washington http://tangent.org/~brian/ http://askbrian.org/ _______________________________________________________ You can't grep a dead tree. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From andrew at sweger.net Tue Feb 26 22:26:30 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: rack space (at home) In-Reply-To: <3C7BBD0A.4D6ABA67@oz.net> Message-ID: If you're willing to do a little work (and a cheap PDP 11 cage doesn't come your way), Hammond Manufacturing (and probably many others) sells rack rails made of 10 gauge steel with tapped holes (or square holes) with standard EIA spacing of various lengths. A pair of 56" (32U) tapped rails will run about US$73. You can start at http://www.hammondmfg.com/ for more details. DigiKey (www.digikey.com) and Hammond Electronics (www.hammondelec.com) are both distributors. Keep in mind these are just the rails. You'll have to mount them to something with the appropriate spacing for equipment. On Tue, 26 Feb 2002, Marion Scott Warner wrote: > Speaking of rackspace, does anyone have a short enclosed rack cabinet > of recent vintage they would like to sell? I'm not sure I can call my > basement > a basement, about 6 feet from floor to ceiling. Not enough room for the > typical > cabinet I'm afraid. OK, not a Perl question, but I'm using Perl CGI > scripts, mod_perl, > and PostgreSQL. -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From bill at celestial.com Wed Feb 27 12:12:08 2002 From: bill at celestial.com (Bill Campbell) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: rack space In-Reply-To: <3C7BBD0A.4D6ABA67@oz.net>; from warner@oz.net on Tue, Feb 26, 2002 at 08:51:22AM -0800 References: <3C7BBD0A.4D6ABA67@oz.net> Message-ID: <20020227101208.B23753@barryg.mi.celestial.com> On Tue, Feb 26, 2002 at 08:51:22AM -0800, Marion Scott Warner wrote: >Speaking of rackspace, does anyone have a short enclosed rack cabinet of >recent vintage they would like to sell? I'm not sure I can call my basement >a basement, about 6 feet from floor to ceiling. Not enough room for the >typical cabinet I'm afraid. OK, not a Perl question, but I'm using Perl CGI >scripts, mod_perl, and PostgreSQL. If you're in the Seattle area, RE*PC often has these, particularly the South Center location (formerly Bruno's). Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ ``The trouble with fighting for human freedom is that one spends most of one's time defending scoundrels. For it is against scoundrels that oppressive laws are first aimed, and oppression must be stopped at the beginning if it is to be stopped at all.'' -- H. L. Mencken - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From benjamin at dzhan.com Wed Feb 27 17:25:14 2002 From: benjamin at dzhan.com (Benjamin Franks) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: general hash performance questions Message-ID: <20020227150857.A35842-100000@crimea.dzhan.com> I was just messing about with some test code to gauge execution times and came up with 2 general questions: (1) While iterating over the keys of a large hash, I notice speed increase if I do the following: foreach (keys %hash) { $hash{$_}++; } instead of doing: foreach (keys %hash) { if (exists $hash{$_}) {$hash{$_}++;} else {$hash{$_}=1;} } This intuitively makes sense because I'm cutting out the conditional statement and test for existence. But why does it work? If I increment a non-existent hash/key value, how does it get to (correctly) 1? (2) Let's say I build a hash of 1 million keys, each having a value of 1. foreach (1..1000000) { $hash{$_}=1; } If I watch the memory consumption with "top," I can see the memory footprint grow pretty big. However, if I make a complex data structure of hashes like: foreach $a (1..100) { foreach $b (1..100) { foreach $c (1..100) { $hash{$a}{$b}{$c}=1; ... , I don't see the memory footprint grow nearly as large as for simpler case. Why is this? I understand "top" is probably not the greatest tool for this; can anyone recommend better perl memory profiling tools? (3) And even though this is a perl list, can complex structures like hash tables of hash tables be done in C? Any sample code sources? Thanks, --Ben - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tuck at whistlingfish.net Wed Feb 27 20:27:51 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: general hash performance questions In-Reply-To: <20020227150857.A35842-100000@crimea.dzhan.com> References: <20020227150857.A35842-100000@crimea.dzhan.com> Message-ID: <39490000.1014863270@flashingchance.whistlingfish.net> -- Benjamin Franks spake thusly: > I was just messing about with some test code to gauge execution times > and came up with 2 general questions: > > (1) While iterating over the keys of a large hash, I notice speed > increase if I do the following: > > foreach (keys %hash) { > $hash{$_}++; > } > > instead of doing: > > foreach (keys %hash) { > if (exists $hash{$_}) {$hash{$_}++;} > else {$hash{$_}=1;} > } > > This intuitively makes sense because I'm cutting out the conditional > statement and test for existence. But why does it work? If I > increment a non-existent hash/key value, how does it get to > (correctly) 1? Because empty strings and undefined values, when interpreted as numbers, evaluate to 0. Doing $hash{$_}++ the first time gives you the equivalent of $hash{$_} = undef + 1, which is interpreted as $hash{$_} = 0 + 1. > (2) Let's say I build a hash of 1 million keys, each having a value > of 1. > > foreach (1..1000000) { > $hash{$_}=1; > } > > If I watch the memory consumption with "top," I can see the memory > footprint grow pretty big. However, if I make a complex data > structure of hashes like: > > foreach $a (1..100) { > foreach $b (1..100) { > foreach $c (1..100) { > $hash{$a}{$b}{$c}=1; > ... > > , I don't see the memory footprint grow nearly as large as for simpler > case. Why is this? I understand "top" is probably not the greatest > tool for this; can anyone recommend better perl memory profiling > tools? I suspect this is because hash keys are shared among all hashes, so instead of having 1000000 strings representing the numbers 1 - 1000000, you've got 100 representing the numbers 1 - 100. > (3) And even though this is a perl list, can complex structures like > hash tables of hash tables be done in C? Any sample code sources? If I were going to do something like that, I'd use C++ and STL. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020227/0748d495/attachment.bin From dancerboy at strangelight.com Wed Feb 27 22:14:19 2002 From: dancerboy at strangelight.com (dancerboy) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: general hash performance questions In-Reply-To: <20020227150857.A35842-100000@crimea.dzhan.com> References: <20020227150857.A35842-100000@crimea.dzhan.com> Message-ID: At 3:25 pm -0800 2/27/02, Benjamin Franks wrote: >I was just messing about with some test code to gauge execution times and >came up with 2 general questions: > >(1) While iterating over the keys of a large hash, I notice speed >increase if I do the following: > > foreach (keys %hash) { > $hash{$_}++; > } > >instead of doing: > > foreach (keys %hash) { > if (exists $hash{$_}) {$hash{$_}++;} > else {$hash{$_}=1;} > } > >This intuitively makes sense because I'm cutting out the conditional >statement and test for existence. But why does it work? If I increment a >non-existent hash/key value, how does it get to (correctly) 1? It's not clear from your question *exactly* which part of Perl's behaviour you're asking about: there are several possible sources of confusion here, so I'll just go over all of them. My apologies of some of this you already know... First, understand that exists $hash{foo} is not the same thing as defined $hash{foo} exists $hash{foo} checks to see whether %hash already has a key 'foo'. The *value* associated with that key could still be undefined. defined $hash{foo} checks to see whether the *value* associated with the key 'foo' is defined. Also, understand that evaluating $hash{foo} will automatically create an entry for key 'foo' in %hash (the only exception is when $hash{foo} is the argument to the exists function). This can sometimes create counter-intuitive results. Consider this example: undef %hash; # %hash now contains no keys or values exists $hash{foo}; # evaluates to FALSE defined $hash{foo}; # evaluates to FALSE exists $hash{foo}; # now evaluates to TRUE because the previous # line, in evaluating $hash{foo}, added # key 'foo' to %hash defined $hash{foo}; # still evaluates to FALSE, because the # *value* associated with $hash{foo} is still # undefined. This is why you'll often see expressions like this in Perl code: if ( exists $hash{$key} and $hash{$key} eq $some_specific_string ) { ... In terms of boolean logic, this is redundant: obviously $hash{$key} isn't going to equal $some_specific_string if $hash{$key} doesn't even exist! But it's necessary to write the expression this way, otherwise $hash{$key} will get created if it didn't exist already. As for why $hash{foo}++ will turn an undefined value into 1, that's just the way Perl handles "undefined" values: when an undefined value is encountered in a numeric context, Perl interprets the undefined value as zero. If your question is: why is the second loop so much slower, when it's doing essentially the same thing? Then you need to remember that in the second loop, you're forcing Perl to do its existence test *twice*: the expression $hash{$_}++ is implicitly testing for the existence of the key $_. It doesn't matter that you just explicitly did the same test yourself: the interpreter still needs to do the test internally to know how to handle the expression $hash{$_}++. > >(3) And even though this is a perl list, can complex structures like hash >tables of hash tables be done in C? Any sample code sources? I'm pretty sure that Perl itself is written in C, so the answer is, of course: yes, you can make any Perl data structures in C -- but it takes a lot more work. You might want to check out the STL (Standard Template Library) for C++ -- the STL has templates for many different data structures, including associative arrays (aka hashes). Here's one place to start: http://www.cs.rpi.edu/projects/STL/htdocs/stl.html A google search for "C++" and "STL" should turn up plenty more. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Wed Feb 27 22:00:36 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: general hash performance questions References: <20020227150857.A35842-100000@crimea.dzhan.com> <39490000.1014863270@flashingchance.whistlingfish.net> Message-ID: Matt Tucker wrote: >Because empty strings and undefined values, when interpreted as >numbers, evaluate to 0. Doing $hash{$_}++ the first time gives you the >equivalent of $hash{$_} = undef + 1, which is interpreted as $hash{$_} >= 0 + 1. Its worth noting that if you actually say something like undef() + 1 you'll get a Use of uninitialized value warning. ++ on an undefined lvalue is deliberately prevented from giving this warning. Other operators that work this way are: -- += -= .= |= ^= &&= ||= The undefined value is silently treated as 0 or "". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Thu Feb 28 10:35:41 2002 From: sweetsue at sweethomes.com (S Bullo) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: HTTP::Cookies question Message-ID: Once again, I have a question concerning a module (what a surprise, eh?). I have determined that my script needs a way to implement cookies with a few urls. From checking, I assumed that HTTP::Cookies would be what I need. I can't seem to get into my head exactly how this works. I have: ... (other coding) use HTTP::Cookies; ... (other coding) my $cookie_jar = new HTTP::Cookies(); ... (other coding) my $url = "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me ssage=$row[8]"; my $cookie = HTTP::Cookies->add_cookie_header($url); ... (other coding) When checking it, I see: "Can't locate object method "url" via package (here my url information is listed out in detail) at Cookies.pm line 104" So, obviously I thought about this incorrectly. I seem to have a hard time figuring out examples at these sites. Can someone pound something in my head on this? TIA Susanne Bullo -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020228/a50b3910/attachment.htm From richard at richard-anderson.org Thu Feb 28 14:33:12 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Re: HTTP::Cookies question References: Message-ID: <008501c1c097$25aa0a60$2088ddd1@aciwin> >From perldoc HTTP::Cookies: SYNOPSIS use HTTP::Cookies; $cookie_jar = HTTP::Cookies->new; $cookie_jar->add_cookie_header($request); $cookie_jar->extract_cookies($response); $request must be a request OBJECT created by LWP::UserAgent (or some other method I'm unaware of), not a URL. HTTP::Cookies tried to invoke a method named "url" in the parameter you passed to add_cookie_jar. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "S Bullo" To: "Seattle Perl User's Group" Sent: Thursday, February 28, 2002 8:35 AM Subject: SPUG: HTTP::Cookies question > Once again, I have a question concerning a module (what a surprise, eh?). I > have determined that my script needs a way to implement cookies with a few > urls. From checking, I assumed that HTTP::Cookies would be what I need. I > can't seem to get into my head exactly how this works. I have: > > ... (other coding) > use HTTP::Cookies; > ... (other coding) > my $cookie_jar = new HTTP::Cookies(); > ... (other coding) > my $url = > "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me > ssage=$row[8]"; > my $cookie = HTTP::Cookies->add_cookie_header($url); > ... (other coding) > > When checking it, I see: > > "Can't locate object method "url" via package (here my url information is > listed out in detail) at Cookies.pm line 104" > > So, obviously I thought about this incorrectly. I seem to have a hard time > figuring out examples at these sites. Can someone pound something in my > head on this? > > TIA > > Susanne Bullo > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Thu Feb 28 14:57:40 2002 From: sweetsue at sweethomes.com (S Bullo) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: RE: HTTP::Cookies question In-Reply-To: <008501c1c097$25aa0a60$2088ddd1@aciwin> Message-ID: Ok, I changed it to the following: my $url = "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me ssage=$row[8]"; $row[6] =~ s|'s|s|g; $row[7] =~ s|#| |g; $row[8] =~ s|#| |g; my $sec_file_path = "members/data/$row[9]"; my $data = "members/data/$row[9]/$row[10].html"; if (! -d "$sec_file_path") { system "mkdir -p $sec_file_path" } my $req = HTTP::Request->new(GET=>$url); my $domain = $cookie_jar->add_cookie_header($req); my $resp = $ua->request($req, $data); my $domain2 = $cookie_jar->extract_cookies($resp); my $outfile = "index.html"; my $filename = "$sec_file_path/$outfile"; open (FILE,">>$filename") or die "Error opening $filename: $!"; { print FILE "Report on $date for '$row[10]'
"; } close (FILE); } Doesn't give me an error but it doesn't seem to be passing any cookies through - I am still getting incorrect, correct? Susanne Bullo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mathin at mathin.com Thu Feb 28 15:42:25 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: RE: HTTP::Cookies question In-Reply-To: Message-ID: I have used something like this in the past. This is just with 'use CGI' my $cookie = $cgi->cookie(-name=>'name',-value=>\%hash); then when you print the header ... print $cgi->header(-cookie=>$cookie); to retrieve: my %scores = $cgi->cookie(-name=>'name'); Hope it helps. Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Thu, 28 Feb 2002, S Bullo wrote: > Ok, I changed it to the following: > > my $url = > "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me > ssage=$row[8]"; > $row[6] =~ s|'s|s|g; > $row[7] =~ s|#| |g; > $row[8] =~ s|#| |g; > my $sec_file_path = "members/data/$row[9]"; > my $data = "members/data/$row[9]/$row[10].html"; > if (! -d "$sec_file_path") { system "mkdir -p $sec_file_path" } > my $req = HTTP::Request->new(GET=>$url); > my $domain = $cookie_jar->add_cookie_header($req); > my $resp = $ua->request($req, $data); > my $domain2 = $cookie_jar->extract_cookies($resp); > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename") or die "Error opening $filename: $!"; > { print FILE "Report on $date for > '$row[10]'
"; } > close (FILE); > } > > Doesn't give me an error but it doesn't seem to be passing any cookies > through - I am still getting incorrect, correct? > > > Susanne Bullo > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jimfl at colltech.com Thu Feb 28 15:50:57 2002 From: jimfl at colltech.com (Jim Flanagan) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: RE: HTTP::Cookies question In-Reply-To: References: Message-ID: <5832193.1014904256@[0.0.0.0]> --On Thursday, February 28, 2002 12:57 PM -0800 S Bullo wrote: > Doesn't give me an error but it doesn't seem to be passing any > cookies through - I am still getting incorrect, correct? You will have to add at least one cookie to the jar using set_cookie(). -- Jim Flanagan jimfl@colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From richard at richard-anderson.org Thu Feb 28 15:51:56 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Re: HTTP::Cookies question References: Message-ID: <00a801c1c0a2$303a5a10$2088ddd1@aciwin> You haven't added any cookies to the cookie jar using HTTP::Cookies::set_cookie. See perldoc HTTP::Cookies. On an unrelated note, it is more portable and less error prone to use use File::Path; mkpath($newdir) than system "mkdir -p $newdir" since on some OSes mkdir does not have the -p option. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org www.raycosoft.com ----- Original Message ----- From: "S Bullo" To: "Richard Anderson" ; "Seattle Perl User's Group" Sent: Thursday, February 28, 2002 12:57 PM Subject: RE: HTTP::Cookies question > Ok, I changed it to the following: > > my $url = > "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me > ssage=$row[8]"; > $row[6] =~ s|'s|s|g; > $row[7] =~ s|#| |g; > $row[8] =~ s|#| |g; > my $sec_file_path = "members/data/$row[9]"; > my $data = "members/data/$row[9]/$row[10].html"; > if (! -d "$sec_file_path") { system "mkdir -p $sec_file_path" } > my $req = HTTP::Request->new(GET=>$url); > my $domain = $cookie_jar->add_cookie_header($req); > my $resp = $ua->request($req, $data); > my $domain2 = $cookie_jar->extract_cookies($resp); > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename") or die "Error opening $filename: $!"; > { print FILE "Report on $date for > '$row[10]'
"; } > close (FILE); > } > > Doesn't give me an error but it doesn't seem to be passing any cookies > through - I am still getting incorrect, correct? > > > Susanne Bullo > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sthoenna at efn.org Thu Feb 28 23:22:04 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:44 2004 Subject: SPUG: Re: HTTP::Cookies question References: <00a801c1c0a2$303a5a10$2088ddd1@aciwin> Message-ID: <8/wf8gzkgC6a092yn@efn.org> In article <00a801c1c0a2$303a5a10$2088ddd1@aciwin>, "Richard Anderson" wrote: >On an unrelated note, it is more portable and less error prone to use >use File::Path; >mkpath($newdir) > >than >system "mkdir -p $newdir" >since on some OSes mkdir does not have the -p option. To be equivalent, you need to make that: eval { mkpath($newdir) } since mkpath croaks on errors. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org