From seppy at mail.TANZATECH.COM Tue Aug 3 15:07:10 1999 From: seppy at mail.TANZATECH.COM (Jafaar Nyang'oro) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: FWD: FYI Message-ID: <199908031607.AA26018266@mail.TANZATECH.COM> -----Original Message----- From: Ronald Gochenouer [mailto:rongoch@webtv.net] Sent: Saturday, July 31, 1999 3:46 AM To: bhurley@queens.org; CalnSue@aol.com; dewvick@aol.com; SoJoWy21@aol.com; codafam@aol.com; glsecor@lava.net; jo@tfs.net; gizmo316@aol.com; leahcvp@lavanet.com; bringor@queens.org; gochel@aol.com; martin14elena@hotmail.com; KAMANAKA@aol.com; marseilles.assoc@juno.com; stboggs@aol.com; earthangel@hawaii.rr.com; Idefoster@aol.com; fireaks@aol.com; trmanoagal@webtv.net Subject: FYI    For your information and protection: I received a telephone call last evening from an individual identifying himself as an AT&T Service technician who was conducting a test on our telephone lines. He stated that to complete the test, I should touch nine (9), zero (0), the pound sign (#) and then hang up. Luckily, I was suspicious and refused. Upon contacting the telephone company, I was informed that by pushing 90#, you give the requesting individual full access to your telephone line, which allows them to place long distance calls billed to your home phone number. I was further informed that this scam has been originating from many of the local jails/prisons. I have also verified this information with UCB telecomm, Pacific Bell,MCI,Bell, Atlantic, GTE and NYNEX. Please beware. DO NOT press 90# for ANYONE. The GTE Security Department requested that I share this information with EVERYONE I KNOW. PLEASE pass this on to everyone YOU know. If you have mailing lists and/or newsletters from organizations you are connected with, I encourage you to pass this information on to them, too. Ronald Gochenouer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From seppy at mail.TANZATECH.COM Wed Aug 4 18:31:19 1999 From: seppy at mail.TANZATECH.COM (Jafaar Nyang'oro) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: problem in printing the struct member variables Message-ID: <199908041931.AA1729626304@mail.TANZATECH.COM> Hi I am trying to create a table-like structure, I am successful in creating the structure, but when I try to print the value stored in the structure member it's printing the address instead of the value it contains. can you pl. tell me why is it failing to print the values ? #!/usr/local/bin/perl use Class::Struct; #use diagnostics; struct ( Table => [ header => '@', comments => '@', rows => '@', ] ); my $obj = new Table; open (INPUT_FILE, ") { $index=0; if($_=~/^HEADER/) { print "entered if statement \n"; #$obj->header($_); $some_name = $_; $obj->header($_); print "$some_name\n"; printf "using instance %s \n", $obj->header; } elsif($_=~/^#/) { print "entered comment line \n"; $some_comment = $_; $obj->comments($_); print "SOME COMMENT ---- $some_comment \n"; } else { print "entered rows \n"; $some_rows = $_; $obj->rows(\@_); print "Some Rows ---- $some_rows\n"; printf "---> %s\n", $obj->rows; } } And the test.dat contains #This file was created on 08/04/99 HEADER Name EmpID Manager Seppy 1 David Stella 2 David Siva 3 David - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Richard.Anderson at seaslug.org Thu Aug 5 14:40:12 1999 From: Richard.Anderson at seaslug.org (Richard Anderson) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: Job Postings: Feedback Solicited! References: <199907292230.PAA11144@consultix.wa.com> Message-ID: <01ce01bedf85$a730cbf0$99223fce@adcom133> I say leave things as they are, I can manally filter based on the subject headings. Richard.Anderson@seaslug.org www.halcyon.com/starfire/home (personal) www.halcyon.com/starfire/rayco (corporate) ----- Original Message ----- From: Tim Maher/CONSULTIX To: Sent: Thursday, July 29, 1999 3:30 PM Subject: SPUG: Job Postings: Feedback Solicited! > >> Message submitted at: Thu Jul 29 15:30:16 PDT 1999 > X-Mailer: ELM [version 2.4 PL25] > MIME-Version: 1.0 > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: 7bit > Content-Length: 1019 > > SPUG-ers, > > Don't know what's happening today - we're getting flooded with > new job postings all of a sudden. Personally, I consider this > a valuable and perhaps even vital function of this list, and to > keep the signal/noise ratio acceptable, I only post messages here > once the recruiter has divulged the most critical info, including > location, pay range, payment status, and contract duration. > > What do you think about the way this is working out? Should we > make a separate list (or perhaps newsgroup) for job postings? Or > just add an extra identifier to the Subject line (to facilitate > filtration)? Add additional informational requirements to > the postings? Just leave things the way they are? > > Let me know - > > Tim Maher > ========================================================== > | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | > | SPUG Founder & Leader Email: spug@halcyon.com | > | Seattle Perl Users Group HTTP: www.halcyon.com/spug | > ========================================================== > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From sarapata at hotmail.com Thu Aug 5 16:16:12 1999 From: sarapata at hotmail.com (Steve Sarapata) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: Job Postings: Feedback Solicited! Message-ID: <19990805211612.24354.qmail@hotmail.com> I agree things seem to be working pretty good now. I also like the idea of squeezing all the info from the recruiter. > >-----Original Message----- >From: Richard Anderson [mailto:Richard.Anderson@seaslug.org] >Sent: Thursday, August 05, 1999 12:40 PM >To: Tim Maher/CONSULTIX; spug-list@pm.org >Subject: Re: SPUG: Job Postings: Feedback Solicited! > > >I say leave things as they are, I can manally filter based on the subject >headings. > >Richard.Anderson@seaslug.org >www.halcyon.com/starfire/home (personal) >www.halcyon.com/starfire/rayco (corporate) >----- Original Message ----- >From: Tim Maher/CONSULTIX >To: >Sent: Thursday, July 29, 1999 3:30 PM >Subject: SPUG: Job Postings: Feedback Solicited! > > > > >> Message submitted at: Thu Jul 29 15:30:16 PDT 1999 > > X-Mailer: ELM [version 2.4 PL25] > > MIME-Version: 1.0 > > Content-Type: text/plain; charset=US-ASCII > > Content-Transfer-Encoding: 7bit > > Content-Length: 1019 > > > > SPUG-ers, > > > > Don't know what's happening today - we're getting flooded with > > new job postings all of a sudden. Personally, I consider this > > a valuable and perhaps even vital function of this list, and to > > keep the signal/noise ratio acceptable, I only post messages here > > once the recruiter has divulged the most critical info, including > > location, pay range, payment status, and contract duration. > > > > What do you think about the way this is working out? Should we > > make a separate list (or perhaps newsgroup) for job postings? Or > > just add an extra identifier to the Subject line (to facilitate > > filtration)? Add additional informational requirements to > > the postings? Just leave things the way they are? > > > > Let me know - > > > > Tim Maher > > ========================================================== > > | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | > > | SPUG Founder & Leader Email: spug@halcyon.com | > > | Seattle Perl Users Group HTTP: www.halcyon.com/spug | > > ========================================================== > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >- > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > > Email to majordomo@pm.org: ACTION spug-list your_address > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Richard.Anderson at seaslug.org Fri Aug 6 01:16:40 1999 From: Richard.Anderson at seaslug.org (Richard Anderson) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: Contractor's Handbook Web Site References: <199907300140.SAA12013@consultix.wa.com> Message-ID: <02b901bedfd3$46809d00$99223fce@adcom133> I have been contracting for six years, and I find this web site (www.cehandbook.com/cehandbook/htmlpages/ceh_main.html) to be sophmoric, especially the "Contract Worker's Bill of Rights". Janet Ruhl publishes a book that is essentially an FAQ for contractors that is better, although I don't agree with everything in it. See her web site, http://javanet.com/~technion/, for ordering information. She also compiles statistical information about contract rates based on area, type of work, brokered vs. non-brokered, etc. at www.realrates.com . I have a set of written guidelines that I use, email me if you want a copy. I haven't included it in this e-mail because this thread is a bit off the subject of this distribution list, and Tim flamed me once before for "unapproved" content in my messages :-] Richard.Anderson@seaslug.org www.halcyon.com/starfire/home (personal) www.halcyon.com/starfire/rayco (corporate) ----- Original Message ----- From: Tim Maher/CONSULTIX To: Sent: Thursday, July 29, 1999 6:40 PM Subject: SPUG: Contractor's Handbook Web Site > >> Message submitted at: Thu Jul 29 18:40:55 PDT 1999 > X-Mailer: ELM [version 2.4 PL25] > MIME-Version: 1.0 > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: 7bit > Content-Length: 591 > > According to Michael Leary: > > > http://www.cehandbook.com > > > LOTS of wonderful info for contractors, quite possibly > > worthy of a post to the list, so that at least the list > > members can be better prepared to deal with agencies and > > make them better servants to us. > > Check it out! Looks good! > > ========================================================== > | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | > | SPUG Founder & Leader Email: spug@halcyon.com | > | Seattle Perl Users Group HTTP: www.halcyon.com/spug | > ========================================================== > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Fri Aug 6 09:48:26 1999 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: Using import() as init under mod_perl Message-ID: Let's say you've got a Perl module (Module.pm) that you've loaded via the PerlRequire Apache directive (a la mod_perl) and you're planning on 'use'ing it in a Perl script serviced under Apache::Registry. Can anyone comment on any possible problems with using Module::import() as an initialization routine to reset global variables? Example: in Module.pm package Module; sub import { $Module::tabulator = 0; } As I understand it, Module->import ("class" method) will be called each time the module is 'use'd. Make sense? -- Andrew Sweger N2H2, Creators of Bess and SearchOpolis 900 Fourth Avenue, Suite 3400 No thanks, I'll just have the Seattle WA 98164-1059 Linux with a side of Perl http://www.n2h2.com/ (206) 336-2947 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jope-spug at n2h2.com Fri Aug 6 12:27:20 1999 From: jope-spug at n2h2.com (El JoPe Magnifico) Date: Wed Aug 4 00:09:29 2004 Subject: SPUG: Using import() as init under mod_perl In-Reply-To: Message-ID: FYI, CGI.pm deals with mod_perl by doing this in the new() subroutine, which gets called on every 'use' of the module. Actually new() calls _reset_globals() which is a passthrough to intialize_globals(); the latter also gets called once in the main block, near the beginning of the module, apparently to "make mod_perl happy". Suggest checking out the gory details yourself. =) Dunno about import() and mod_perl. At best that's a kludgy place to put (re-)initialization. -jp On Fri, 6 Aug 1999, Andrew Sweger wrote: > Subject: SPUG: Using import() as init under mod_perl > Let's say you've got a Perl module (Module.pm) that you've loaded via the > PerlRequire Apache directive (a la mod_perl) and you're planning on > 'use'ing it in a Perl script serviced under Apache::Registry. Can anyone > comment on any possible problems with using Module::import() as an > initialization routine to reset global variables? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Fri Aug 6 12:56:24 1999 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Using import() as init under mod_perl In-Reply-To: Message-ID: How does Perl know to call new() when it encounters a 'use CGI;' (assuming the module had already been previously loaded elsewhere)? I could just instruct the module users to call a Module->init(), but I wanted to handle the issue behind the scenes. import() seemed like a good candidate. On 08/06/99 @ 17:27, the magnificent El JoPe Magnifico wrote: :} FYI, CGI.pm deals with mod_perl by doing this in the new() :} subroutine, which gets called on every 'use' of the module. -- Andrew Sweger N2H2, Creators of Bess and SearchOpolis 900 Fourth Avenue, Suite 3400 No thanks, I'll just have the Seattle WA 98164-1059 Linux with a side of Perl http://www.n2h2.com/ (206) 336-2947 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at webrocket.net Fri Aug 6 14:08:44 1999 From: ryan at webrocket.net (Ryan Forsythe) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: newbie question over here Message-ID: <99080612160002.02012@arthur> hi there...this is my first post to this list, so be nice... i've been (trying) to teach myself perl over the last few weeks, and i've been getting somewhere. however, for the last few days i've been plagued by this problem with the 'next if ' command. i've pored over the camel book and all the FAQs i can find...i still can't figure out what i'm doing wrong. any help would be greatly appreciated (and contribute postively to my mental health) here's the chunk of my code that wigs out: if ($queryLine =~ m/^$/) { unless ( !($dbaseLine = ) && ($dbaseLine =~ m/^$/) && ($count >= $maxRecords) ) { $count++; #i've used the pound sign as comment in the dbase, so if it's the first char in the record #i skip the record line. next if $dbaseLine =~ m/^#/; ....more code.... } } and i get this error from the compiler: Can't "next" outside a block at findacct.pl line 34, chunk 1. (line 34 is the line beginning with 'next if...') thanks in advance --ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From kevin at n2h2.com Fri Aug 6 14:30:35 1999 From: kevin at n2h2.com (Kevin Fink) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: newbie question over here In-Reply-To: <99080612160002.02012@arthur> Message-ID: "next" only works within a block (usually a loop). "unless" isn't a loop construct - try "while" or "until" instead. Kevin On Fri, 6 Aug 1999, Ryan Forsythe wrote: > hi there...this is my first post to this list, so be nice... > > i've been (trying) to teach myself perl over the last few weeks, and i've been > getting somewhere. however, for the last few days i've been plagued by this > problem with the 'next if ' command. i've pored over the camel book > and all the FAQs i can find...i still can't figure out what i'm doing wrong. > any help would be greatly appreciated (and contribute postively to my mental > health) > > here's the chunk of my code that wigs out: > > if ($queryLine =~ m/^$/) { > unless ( !($dbaseLine = ) && ($dbaseLine =~ m/^$/) && ($count >= $maxRecords) ) { > $count++; > > #i've used the pound sign as comment in the dbase, so if it's the first char in the record > #i skip the record line. > next if $dbaseLine =~ m/^#/; > > ....more code.... > > } > } > > and i get this error from the compiler: > Can't "next" outside a block at findacct.pl line 34, chunk 1. > > (line 34 is the line beginning with 'next if...') > > thanks in advance > --ryan > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > ------------------------------------------------------------------------------ Kevin Fink N2H2, Creators of Bess and Searchopolis Chief Technology Officer 900 Fourth Avenue, Suite 3400 http://www.n2h2.com/ Seattle, WA 98164 VOICE: 206-336-1501 / 800-971-2622 FAX: 206-336-1541 ------------------------------------------------------------------------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Richard.Anderson at seaslug.org Fri Aug 6 15:13:39 1999 From: Richard.Anderson at seaslug.org (Richard Anderson) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: newbie question over here References: <99080612160002.02012@arthur> Message-ID: <00f801bee048$2ddf2b20$8a223fce@adcom133> The next statement can only be used inside a loop construct (while, until, for, foreach). I don't see any of these in your code. Maybe you have one of these statements above the code snippet, but let an extra curly bracket sneak in that terminated the loop block. Richard.Anderson@seaslug.org www.halcyon.com/starfire/home (personal) www.halcyon.com/starfire/rayco (corporate) ----- Original Message ----- From: Ryan Forsythe To: Sent: Friday, August 06, 1999 12:08 PM Subject: SPUG: newbie question over here > hi there...this is my first post to this list, so be nice... > > i've been (trying) to teach myself perl over the last few weeks, and i've been > getting somewhere. however, for the last few days i've been plagued by this > problem with the 'next if ' command. i've pored over the camel book > and all the FAQs i can find...i still can't figure out what i'm doing wrong. > any help would be greatly appreciated (and contribute postively to my mental > health) > > here's the chunk of my code that wigs out: > > if ($queryLine =~ m/^$/) { > unless ( !($dbaseLine = ) && ($dbaseLine =~ m/^$/) && ($count >= $maxRecords) ) { > $count++; > > #i've used the pound sign as comment in the dbase, so if it's the first char in the record > #i skip the record line. > next if $dbaseLine =~ m/^#/; > > ....more code.... > > } > } > > and i get this error from the compiler: > Can't "next" outside a block at findacct.pl line 34, chunk 1. > > (line 34 is the line beginning with 'next if...') > > thanks in advance > --ryan > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jope-spug at n2h2.com Fri Aug 6 15:56:43 1999 From: jope-spug at n2h2.com (El JoPe Magnifico) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: breaking out with "next" In-Reply-To: Message-ID: I'm guessing you eventually expect to have a while loop around your if block, in which case the error will go away. If not (or if you're leaving out the while loop for the moment to deal with just a single iteration) the alternative is to wrap a labelled bare block around the if block, e.g... BLOCKNAME: { if (1) { unless (0) { warn("inside the unless block\n"); next BLOCKNAME if 1; warn("oops, the next didn't take!\n"); } } } warn("and that's all there is.\n"); This will allow you to use "next" and "last" without a loop. Note that "next" acts like last in such a loopless block. If you want to later change the bare block into a loop block, just stick the loop condition (while, for, foreach) between the block label and the opening curly bracket, e.g... BLOCKNAME: while ($keep_on_truckin) { if (1) ...yadda yadda yadda... See pages 101-106 of the camel book (2nd ed, anyway) for a discussion of labels. -jp On Fri, 6 Aug 1999, Kevin Fink wrote: > "next" only works within a block (usually a loop). > "unless" isn't a loop construct - try "while" or "until" instead. > > On Fri, 6 Aug 1999, Ryan Forsythe wrote: >> problem with the 'next if ' command. i've pored over the >> camel book and all the FAQs i can find...i still can't figure out what >> i'm doing wrong. [...] here's the chunk of my code that wigs out: >> >> if ($queryLine =~ m/^$/) { >> unless ( !($dbaseLine = ) >> && ($dbaseLine =~ m/^$/) >> && ($count >= $maxRecords) >> ) { >> $count++; >> >> # i've used the pound sign as comment in the dbase, so if >> # it's the first char in the record i skip the record line. >> next if $dbaseLine =~ m/^#/; >> >> ....more code.... >> } >> } >> >> and i get this error from the compiler: >> Can't "next" outside a block at findacct.pl line 34, chunk 1. >> >> (line 34 is the line beginning with 'next if...') - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at webrocket.net Fri Aug 6 16:09:32 1999 From: ryan at webrocket.net (Ryan Forsythe) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: newbie question over here Message-ID: <99080614110902.02057@arthur> thx all. i was being stupid and thinking 'unless' was the opposite of 'while' rather than the opposite of 'if'; i thought if 'next' works on 'while', it must work on 'unless'....doh! --ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Fri Aug 6 17:33:28 1999 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: The Regexp of Infinitude. In-Reply-To: Ryan Forsythe's message of "Fri, 6 Aug 1999 14:09:32 -0700" Message-ID: <87k8r84k07.fsf@ralf.serv.net> For reasons which, I'm afraid, are going to be obscure at the moment, I have the following line in my Perl script: $buffer =~ m#^(\043(.*?[^\\])*?)(\043/\})(.*)#s; Basically, this should be interpreted as Starting with the beginning of a multiline string, a group consisting of "#" followed by zero or more groups of any characters that do not end with a backslash, followed by a group consisting exactly of "#/}", followed by a group containing the rest of the string. Another way to look at this would be Starting with the beginning of a multiline string, a group consisting of "#" followed by zero or more groups of any characters, followed by a group consisting exactly of "#/}" which is NOT preceded by a backslash, followed by a group containing the rest of the string. In other words, I'm working on a program which parses a configuration file. Its comment syntax (again, for obscure reasons) is {# comment text #/} So I'm working on a state machine that has, at this point of the program, already trimmed the beginning brace, and now is trying to collect the rest of the comment. HOWEVER, the following should be legal: {# End comments with the (ignore the backslash) "\#/}" string #/} Seems to me that the regexp should work, but I can't tell---Perl takes pretty much forever to run that regexp. Is there a more efficient way of writing this, or do I really need to take a completely different approach? (I'd hate to have to do this in lex and yacc.) Thanks. ---Ken P.S. Anyone looking for Perl subcontracts? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From stuart_poulin at yahoo.com Fri Aug 6 19:07:23 1999 From: stuart_poulin at yahoo.com (Stuart Poulin) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: The Regexp of Infinitude. Message-ID: <19990807000723.23354.rocketmail@send205.yahoomail.com> One trick is to hide the escaped \# before doing the match, then unhide them after. # Warning - Untested $_ =~ s{\\#}{\\\0377}g; # Do some match but don't worry about \# since you've hid it. my ($buffer) = m{#(.*)#/}; # Now undo the hiding: $buffer =~ s{\\\0377}{\\#}g; --- Ken McGlothlen wrote: > For reasons which, I'm afraid, are going to be obscure at the moment, I have > the following line in my Perl script: > > $buffer =~ m#^(\043(.*?[^\\])*?)(\043/\})(.*)#s; > > Basically, this should be interpreted as > _____________________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Fri Aug 6 19:23:10 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: forwarded message from David Bitseff Message-ID: <14251.31798.16617.48628@maakie.uswc.uswest.com> Darn, I didn't send this to the right place. Here it is again. -------------- next part -------------- An embedded message was scrubbed... From: David Bitseff Subject: Re: SPUG: The Regexp of Infinitude. Date: Fri, 6 Aug 1999 16:55:59 -0700 (PDT) Size: 3352 Url: http://mail.pm.org/archives/spug-list/attachments/19990806/81baa37e/attachment.eml -------------- next part -------------- -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 From dougb at scalar.org Fri Aug 6 19:30:58 1999 From: dougb at scalar.org (Doug Beaver) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Using import() as init under mod_perl In-Reply-To: ; from El JoPe Magnifico on Fri, Aug 06, 1999 at 05:27:20PM +0000 References: Message-ID: <19990806173057.A55944@scalar.org> On Fri, Aug 06, 1999 at 05:27:20PM +0000, El JoPe Magnifico wrote: > FYI, CGI.pm deals with mod_perl by doing this in the new() > subroutine, which gets called on every 'use' of the module. Actually, I don't think it calls CGI->new each time you C. CGI::import() doesn't call CGI->new for the user, the user instead has to create a CGI object and then call methods on it (or just call the class methods if they prefer). Maybe you meant that and I was just confused... > Actually new() calls _reset_globals() which is a passthrough > to intialize_globals(); the latter also gets called once in > the main block, near the beginning of the module, apparently > to "make mod_perl happy". Suggest checking out the gory > details yourself. =) It calls initialize_globals() when the module is first loaded to set them to their initial values, and then it also registers a cleanup handler with mod_perl to call _reset_globals() when each individual HTTP request has finished being processed by mod_perl. > Dunno about import() and mod_perl. At best that's a kludgy > place to put (re-)initialization. Well, the choices are placing it in import(), a BEGIN block, an INIT block (if you're using 5.005 and above), or in the constructor of the object if you're creating an OO module. (Can anyone think of any more? I think I'm missing one.) The main idea is that you should check $ENV{'GATEWAY_INTERFACE'} and if it says you're running under mod_perl, setup a cleanup handler to be ran once the request has completed. 'Writing Apache Modules with Perl and C' is an excellent book if you're working with mod_perl, it helps take care of most the headaches you'll encounter. I can't say enough good things about the book, the authors are Lincoln Stein (Mr. CGI.pm) and Doug MacEachern (creator of mod_perl), so they really know what they're talking about... Doug > On Fri, 6 Aug 1999, Andrew Sweger wrote: > > Subject: SPUG: Using import() as init under mod_perl > > Let's say you've got a Perl module (Module.pm) that you've loaded > > via the PerlRequire Apache directive (a la mod_perl) and you're > > planning on 'use'ing it in a Perl script serviced under > > Apache::Registry. Can anyone comment on any possible problems with > > using Module::import() as an initialization routine to reset global > > variables? -- Ned: So recycling is our way of giving Mother Earth a great big hug! Burns: Yes, well, it does sound like fun. I can't wait to start pawing through my trash like some starving racoon! [To Smithers] Release the hounds! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Mon Aug 9 13:04:22 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: The Regexp of Infinitude. In-Reply-To: <87k8r84k07.fsf@ralf.serv.net> References: <87k8r84k07.fsf@ralf.serv.net> Message-ID: <14255.4811.772519.101121@maakie.uswc.uswest.com> Okay, my other post reguarding this did not really help and was not even in the same thread. I'll try not to do that again. Ken pointed out to me that the '*?' metacharacter sequence is indeed valid and not redundant. It's the 'match 0 or more non-greedy' operator. This metacharacter may be specific to perl. I haven't had much of a use for this as I am a very greedy person. Here is my first stab at a working solution: m,{#(#*[^\\#]+(:?(:?\\#/}|\\[^\\]|#[^/]|#/[^}])[^\\#]*#*)*)#/}, I know it looks ugly, but the idea is preatty simple. First match the opening comment. Mabey the opening comment will have some '#' following. Then match anything that is not special. The characters '#' and '\' are special as they symbolize the beginning of special things like an ending comment or an escaped thing (like an escaped ending comment). Try to get as many of those as possible. If one of the special things is found, use the sequence of OR'ed items in the middle to find out how to match the special thing. After the special thing, try to get more of the regular type of thing. You can do the special/regular matching more than once. Then there may be some '#' before the ending comment. Then match the ending comment. This will not get everything. I think that a sequence of '\' will fail a match. Most escaped things should match. You should be able to use the same general idea for matching text surrounded by some sort of delimiter.\ >>>>> On VI Aug MCMXCIX XV:XXXIII:XXVIII, Ken McGlothlen writes: Ken> For reasons which, I'm afraid, are going to be obscure at the moment, I have Ken> the following line in my Perl script: Ken> $buffer =~ m#^(\043(.*?[^\\])*?)(\043/\})(.*)#s; Ken> Basically, this should be interpreted as Ken> Starting with the beginning of a multiline string, a group consisting Ken> of "#" followed by zero or more groups of any characters that do not Ken> end with a backslash, followed by a group consisting exactly of "#/}", Ken> followed by a group containing the rest of the string. Ken> Another way to look at this would be Ken> Starting with the beginning of a multiline string, a group consisting Ken> of "#" followed by zero or more groups of any characters, followed by a Ken> group consisting exactly of "#/}" which is NOT preceded by a backslash, Ken> followed by a group containing the rest of the string. Ken> In other words, I'm working on a program which parses a configuration file. Ken> Its comment syntax (again, for obscure reasons) is Ken> {# comment text #/} Ken> So I'm working on a state machine that has, at this point of the program, Ken> already trimmed the beginning brace, and now is trying to collect the rest of Ken> the comment. HOWEVER, the following should be legal: Ken> {# End comments with the (ignore the backslash) "\#/}" string #/} Ken> Seems to me that the regexp should work, but I can't tell---Perl takes pretty Ken> much forever to run that regexp. Ken> Is there a more efficient way of writing this, or do I really need to take a Ken> completely different approach? (I'd hate to have to do this in lex and yacc.) Ken> Thanks. Ken> ---Ken Ken> P.S. Anyone looking for Perl subcontracts? Ken> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ken> POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Ken> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ Ken> SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Ken> Email to majordomo@pm.org: ACTION spug-list your_address -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From sean at DigiDot.com Mon Aug 9 22:21:46 1999 From: sean at DigiDot.com (Sean Ruddy) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? Message-ID: <37AF9ACA.384AB7@DigiDot.com> Better way to get just the domain from referer? I think this code will show my newbieness (but it works...) my $re = referer(); my $doubleslash = rindex($re,'//'); my $headslash = substr($re,$doubleslash+2); my $domslash = index($headslash,'/'); print substr($headslash,0,$domslash); Thanks, Sean - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From nathan at n2h2.com Tue Aug 10 15:39:32 1999 From: nathan at n2h2.com (Nathan Lewis) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? In-Reply-To: <37AF9ACA.384AB7@DigiDot.com> Message-ID: You could reduce the number of lines of code by using regex pattern matching. my $re = referer(); $re =~ m|//([^/]*)|; print $1,"\n"; I don't know if that's better. BTW, is a new pair of XML tags you're defining ;-) Nathan On Mon, 9 Aug 1999, Sean Ruddy wrote: > Better way to get just the domain from referer? > I think this code will show my newbieness (but it works...) > > my $re = referer(); > my $doubleslash = rindex($re,'//'); > my $headslash = substr($re,$doubleslash+2); > my $domslash = index($headslash,'/'); > print substr($headslash,0,$domslash); > > > Thanks, > Sean > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From charles.e.derykus at boeing.com Tue Aug 10 15:34:11 1999 From: charles.e.derykus at boeing.com (charles.e.derykus@boeing.com) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? Message-ID: <199908102034.NAA07661@carios2.ca.boeing.com> > Better way to get just the domain from referer? > I think this code will show my newbieness (but it works...) > > my $re = referer(); > my $doubleslash = rindex($re,'//'); > my $headslash = substr($re,$doubleslash+2); > my $domslash = index($headslash,'/'); > print substr($headslash,0,$domslash); > Another possibility is to make URI::URL take care of that stuff, e.g. use URI::URL; my $url = URI::URL->new('http://www.amazon.com'); my($scheme, $user, $pass , $host, $port) = $url->crack; hope this helps, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Scott.Blachowicz at seaslug.org Tue Aug 10 15:51:17 1999 From: Scott.Blachowicz at seaslug.org (Scott Blachowicz) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? In-Reply-To: <37AF9ACA.384AB7@DigiDot.com>; from Sean Ruddy on Mon, Aug 09, 1999 at 08:21:46PM -0700 References: <37AF9ACA.384AB7@DigiDot.com> Message-ID: <19990810135116.A15473@sabami.seaslug.org> On Mon, Aug 09, 1999 at 08:21:46PM -0700, Sean Ruddy wrote: > Better way to get just the domain from referer? > I think this code will show my newbieness (but it works...) > > my $re = referer(); > my $doubleslash = rindex($re,'//'); > my $headslash = substr($re,$doubleslash+2); > my $domslash = index($headslash,'/'); > print substr($headslash,0,$domslash); > How about something like this: my ($dom) = (referer() =~ m{//([^/]+)/}; print "$dom"; A bit of advice for those new to perl...regular expressions are really powerful :-) (even though this simple example doesn't demonstrate THAT)...and worth learning. Scott.Blachowicz@seaslug.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jope-spug at n2h2.com Tue Aug 10 16:32:18 1999 From: jope-spug at n2h2.com (El JoPe Magnifico) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: domain from URL (was: better way?) In-Reply-To: <19990810135116.A15473@sabami.seaslug.org> Message-ID: >> Better way to get just the domain from referer? [...] > my ($dom) = (referer() =~ m{//([^/]+)/}; Typo: Forgot your trailing parenthesis (just before the semicolon). Also, a clarification on th original question: Do you want the fully qualified hostname (host + domain), or just the _domain_? Everyone so far has done just the former. -jp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From sean at DigiDot.com Tue Aug 10 16:56:52 1999 From: sean at DigiDot.com (Sean Ruddy) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? References: Message-ID: <37B0A024.C2A389E3@DigiDot.com> Thanks all! That's more what I was looking for. Obviously I need to reread the regex chapter. Yes a new XML DTD will be coming to a web server near you for HACK, KLUGE, RANT... Sean Nathan Lewis wrote: > You could reduce the number of lines of code by using regex pattern > matching. > > my $re = referer(); > $re =~ m|//([^/]*)|; > print $1,"\n"; > > I don't know if that's better. BTW, is a new pair of XML > tags you're defining ;-) > > Nathan > > On Mon, 9 Aug 1999, Sean Ruddy wrote: > > > Better way to get just the domain from referer? > > I think this code will show my newbieness (but it works...) > > > > my $re = referer(); > > my $doubleslash = rindex($re,'//'); > > my $headslash = substr($re,$doubleslash+2); > > my $domslash = index($headslash,'/'); > > print substr($headslash,0,$domslash); > > > > > > Thanks, > > Sean > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > > Email to majordomo@pm.org: ACTION spug-list your_address > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Tue Aug 10 17:02:15 1999 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? In-Reply-To: Sean Ruddy's message of "Mon, 09 Aug 1999 20:21:46 -0700" References: <37AF9ACA.384AB7@DigiDot.com> Message-ID: <87lnbjthug.fsf@ralf.serv.net> Sean Ruddy writes: | Better way to get just the domain from referer? | I think this code will show my newbieness (but it works...) | | my $re = referer(); | my $doubleslash = rindex($re,'//'); | my $headslash = substr($re,$doubleslash+2); | my $domslash = index($headslash,'/'); | print substr($headslash,0,$domslash); | Yes, that works. But you might be better off with a regex: sub urldomain { $_ = shift; m|^http://([^/]+)|; return( $1 ); } Then you can call it with something like my $dom = &urldomain( $re ); In recognition that this is new for you, let's go over that routine line by line. sub urldomain { # Well, almost line by line. That one # shouldn't be so hard to figure out. $_ = shift; # This takes the first parameter passed # in, and assigns it to the special # variable "$_", which is used as the # default variable for the match # function, used in the next line. I'm # going to replace this line with # another perfectly legal Perl usage. m|^http:// # The string has to start with http:// ( # Save whatever matches next in $1 [^/]+ # One or more characters which aren't / ) # That ends $1 |x; # And that ends the match, with a # modifier that allows us to put in # whitespace and comments in the # regexp. # Remember that if we don't bind the # match operator with the =~ operator, # it automatically acts on $_. return( $1 ); # Now we return what we got as $1. } You could make this more general by replacing the "http" with "[a-z]+", which would match "http", "ftp", "gopher" or any other string consisting entirely of one or more lowercase alphabetic characters. ---Ken - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Scott.Blachowicz at seaslug.org Tue Aug 10 18:18:56 1999 From: Scott.Blachowicz at seaslug.org (Scott Blachowicz) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: domain from URL (was: better way?) In-Reply-To: Message-ID: <199908102318.QAA22704@c2-sab.seanet.com> > > my ($dom) = (referer() =~ m{//([^/]+)/}; > > Typo: Forgot your trailing parenthesis (just before the semicolon). Oops. > Also, a clarification on th original question: > Do you want the fully qualified hostname (host + domain), > or just the _domain_? Everyone so far has done just the former. OK...minor adjustment...how about something like this: my ($hostname, $domain) = (referer() =~ m{ // # Starting double-slash ([^\./]+) # a string of non-dot, non-slash chars (\.[^/]+) # a dot followed by one or more non-slashes ? # zero or one of the above / # Ending slash }); $domain = getdomainname() if ! $domain; my $FQDN = "$hostname$domain"; where the 'getdomainname' function is left as an exercise for the reader :-)). Scott.Blachowicz@seaslug.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Tue Aug 10 18:48:43 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: better way? In-Reply-To: <87lnbjthug.fsf@ralf.serv.net> References: <37AF9ACA.384AB7@DigiDot.com> <87lnbjthug.fsf@ralf.serv.net> Message-ID: <14256.47479.906451.153553@maakie.uswc.uswest.com> Okay, that is the second time this week I've replied to the wrong address in this group. I think I've got it figured out now. Sorry about that Ken. ----------------------------------------------------------------------- It's also good to use the regex or URI::URL because while the rindex/substr/index might run slightly faster, it won't correctly match all URI. Consider this one: http://somewhere.somemachine.net/A=181217/?http://somewhereelse.there.com The rindex would return the position of '//' right before 'somwhereelse'. Of course, if you don't use URLs like this is doesn't really matter. >>>>> On 1 Aug MCMXCIX XV:II:XV, Ken McGlothlen writes: Ken> Sean Ruddy writes: Ken> | Better way to get just the domain from referer? Ken> | I think this code will show my newbieness (but it works...) Ken> | Ken> | my $re = referer(); Ken> | my $doubleslash = rindex($re,'//'); Ken> | my $headslash = substr($re,$doubleslash+2); Ken> | my $domslash = index($headslash,'/'); Ken> | print substr($headslash,0,$domslash); Ken> | Ken> Yes, that works. But you might be better off with a regex: Ken> sub urldomain { Ken> $_ = shift; Ken> m|^http://([^/]+)|; Ken> return( $1 ); Ken> } Ken> Then you can call it with something like Ken> my $dom = &urldomain( $re ); -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From wade at headbone.com Thu Aug 12 00:03:43 1999 From: wade at headbone.com (Wade Naveja) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: I killed CPAN.pm! Message-ID: while updating DBI.pm, i managed to mangle CPAN.pm. I now have to manually reinstall CPAN.pm. Having always used CPAN.pm to install Perl modules and bundles, I'm looking for direction on how to go about doing this. Regards, Wade Naveja - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From nathan at n2h2.com Thu Aug 12 01:46:52 1999 From: nathan at n2h2.com (Nathan Lewis) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: I killed CPAN.pm! In-Reply-To: Message-ID: Go to any CPAN mirror and go to /CPAN/modules/by-module/CPAN in that directory grab CPAN-1.50.tar.gz unpack it on your machine. cd into that directory and then as root run perl Makefile.PL make make install that should work. check what it says in README or INSTALL to be sure. Nathan On Wed, 11 Aug 1999, Wade Naveja wrote: > while updating DBI.pm, i managed to mangle CPAN.pm. I now have to > manually reinstall CPAN.pm. Having always used CPAN.pm to install Perl > modules and bundles, I'm looking for direction on how to go about doing > this. > > Regards, > > Wade Naveja > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From eckman at u.washington.edu Thu Aug 12 10:58:33 1999 From: eckman at u.washington.edu (John Eckman) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: getting versions of modules? Message-ID: <199908121559.IAA32729@mailhost2.u.washington.edu> How do I tell what version of URI a system is running? I'm working with a script called checkbot.pl It makes the following call: my $redir_url = URI->new_abs($response->header('Location'), $baseURI); which generates an error on execution- apparentley the version of URI we have is old. But how do I find out what version we do have? John _______________________________________________________________________ John Eckman Interdisciplinary Writing Program Dept. of English; Box 35-4330 University of Washington Seattle, WA 91895 _______________________________________________________________________ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Scott.Borow at pss.boeing.com Thu Aug 12 11:24:42 1999 From: Scott.Borow at pss.boeing.com (Borow, Scott W) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: getting versions of modules? Message-ID: <212F359A8596D0118C8E00805FFE12BE040D14A9@xch-sea-07.ca.boeing.com> You can check what version is installed by requiring a non existent high version of the module from the command line and examining the error message. For example for CGI.pm (since I don't have URI installed) borow@bandit ~ 512 > perl -M'CGI 9999' CGI version 9999 required--this is only version 2.36. BEGIN failed--compilation aborted. borow@bandit ~ 513 > --Scott > ---------- > From: John Eckman[SMTP:eckman@u.washington.edu] > Sent: Thursday, August 12, 1999 8:58 AM > Cc: SPUG List > Subject: SPUG: getting versions of modules? > > How do I tell what version of URI a system is running? > > I'm working with a script called checkbot.pl > > > > It makes the following call: > > my $redir_url = URI->new_abs($response->header('Location'), $baseURI); > > which generates an error on execution- apparentley the version of URI we > have is old. > > But how do I find out what version we do have? > > John > [...] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan2 at webrocket.net Fri Aug 13 03:57:24 1999 From: ryan2 at webrocket.net (Ryan Forsythe) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: and now, for something completely different: References: <212F359A8596D0118C8E00805FFE12BE040D14A9@xch-sea-07.ca.boeing.com> Message-ID: <37B3DDF4.26F29A1A@webrocket.net> i was wondering what everybody out there uses for perl decelopment (okay, let's narrow it down -- what do you use if it isn't emacs or vi?). specifically, do you know of anything better for linux than the text editor for kde (which just colors all the different elements of the script, like all the variables are blue and all the strings are red, stuff like that). --ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Fri Aug 13 11:18:15 1999 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: and now, for something completely different: In-Reply-To: <37B3DDF4.26F29A1A@webrocket.net> Message-ID: <200606.3143524695@erdos.nwest.attws.com> --On Fri, Aug 13, 1999 1:57 AM -0700 Ryan Forsythe wrote: > i was wondering what everybody out there uses for perl decelopment > (okay, let's narrow it down -- what do you use if it isn't emacs or > vi?). specifically, do you know of anything better for linux than > the text editor for kde (which just colors all the different > elements of the script, like all the variables are blue and all the > strings are red, stuff like that). I use gvim, which supports syntax highlighting, and a little script I wrote which pipes the buffer through 'perl -c', determines the line number of any errors, and puts a comment containing the error on the line above the error. The comments begin with the string '#PLCK: ' I can then seach for the comments in the file and fix all the errors. When the script is run again, it strips out error comments which no longer apply. -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Fri Aug 13 14:03:03 1999 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: and now, for something completely different: In-Reply-To: Ryan Forsythe's message of "Fri, 13 Aug 1999 01:57:24 -0700" References: <212F359A8596D0118C8E00805FFE12BE040D14A9@xch-sea-07.ca.boeing.com> <37B3DDF4.26F29A1A@webrocket.net> Message-ID: <87wvuzh5aw.fsf@perv.daft.com> Ryan Forsythe , in an immanent manifestation of deity, wrote: >i was wondering what everybody out there uses for perl decelopment >(okay, let's narrow it down -- what do you use if it isn't emacs or >vi?). specifically, do you know of anything better for linux than the >text editor for kde (which just colors all the different elements of the >script, like all the variables are blue and all the strings are red, >stuff like that). Why not emacs? I find it works really well. I use cperl mode which highlights and indents automatically for me. If I think it's indented wrong then I've made an error. The syntax coloring is very useful. I've also got help from perlfunc at my fingertips. Finally to debug, I can run it through perl -cw or use the perl debugger interace into emacs. Works great. There's supposed to be a Perl class browser available for emacs but it hasn't been important enough for me to look for it. I'm actually using XEmacs 20.4. I haven't gone to XEmacs 21 yet. Darren -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From bill at thinker.celestial.com Fri Aug 13 15:04:33 1999 From: bill at thinker.celestial.com (Bill Campbell) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: I killed CPAN.pm! In-Reply-To: ; from Wade Naveja on Wed, Aug 11, 1999 at 10:03:43PM -0700 References: Message-ID: <19990813130433.A4762@thinker.celestial.com> On Wed, Aug 11, 1999 at 10:03:43PM -0700, Wade Naveja wrote: >while updating DBI.pm, i managed to mangle CPAN.pm. I now have to >manually reinstall CPAN.pm. Having always used CPAN.pm to install Perl >modules and bundles, I'm looking for direction on how to go about doing >this. Make backups? Bill -- INTERNET: bill@Celestial.COM Bill Campbell; Celestial Systems, Inc. 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/ It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -- Dijkstra - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From trey at ministry.eu.org Fri Aug 13 15:36:19 1999 From: trey at ministry.eu.org (Trey Valenta) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: and now, for something completely different: In-Reply-To: "Darren/Torin/Who Ever..." "Re: SPUG: and now, for something completely different:" (Aug 13, 12:03) Message-ID: <19990813203619.27805.qmail@zipcon.net> > Why not emacs? I find it works really well. I use cperl mode which > highlights and indents automatically for me. If I think it's indented wrong > then I've made an error. The syntax coloring is very useful. I've also Knowing better than to get involvled in a land war in asia... but not heading said advice.... I used to use emacs or jove as my editors. But since the question is 'Why not emacs?', there are several reasons I switched to vim. emacs got too big for my needs. I don't need it as a mail reader or new reader. It does have great support for running 'make' and jumping to your location, but i don't use that either. In previous lives I didn't have enough disk space for an emacs install. I switched to vi/m because no matter at what machine I sat down, I always had a copy of vi to use and for that I felt it would be good to know. I also worked on boxes that for various reasons I couldn't install emacs. I could go to a client and start editing proficiently without having to install a new editor. Yes, the keystrokes were a bit more difficult to learn, but once I did I found it to be, for me, quicker to use. vim added the things I missed... multiple undo, syntax highlighting, paragraph formatting, multiple windows, and it was still quite small. On the other hand, I needed to work on many different machines. If I didn't do any administration, I would probably still be using emacs and just request my administrator install it for me. my suggestion is to flip a coin, pick your editor, and work on the assumption that either will be just fine if you can't come up with a reason for choosing one or the other from the beginning. Join your local jihad in your free time and edit away without any cares in the world because you chose the right one. -- trey valenta trey@ministry.eu.org seattle (maybe a) random quote--v Test-tube babies shouldn't throw stones. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From FBreuer at acsts.com Fri Aug 13 19:28:46 1999 From: FBreuer at acsts.com (Farhana Breuer) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Web Developer opportunity Message-ID: <9117AF4C156AD211A0D600105A9A675F05CEC8@SEA-PDC> Hi there! ACS Technology Solutions has an exciting Web Developer opportunity available immediately. If you are interested please e-mail your resume and 3 professional references to Farhana Breuer at fbreuer@acsts.com . I am enclosing the job description below for your review. The particulars for this contract are as follows: Length: Through the end of the year. After the new year the position could be extended or most likely will want to bring the person aboard full time. The full time salary range is 45 to 52K. Pay rate range: $30 to $40 Skills needed: Experience working with Unix, Perl, HTML, CGI, Java, Oracle, and SQL. Main skills needed are Unix, Perl, and HTML. Secondary skills are Oracle, CGI, Java, and SQL along with Shell scripting, using primarily AWK Job description: Doing database restructuring and understanding relational databases, not a DBA, but a programmer with the above technologies who understands databases. Work on a Unix system doing shell scripting with AWK using primarily Perl, HTML, and CGI, along with some Oracle and SQL. Look forward to receiving your resume. With much regard, Farhana Breuer Sr. Technical Recruiter fbreuer@acsts.com ACS Technology Solutions 1750 112th Avenue N.E, Suite D-159 Bellevue, Washington 98004 (425)462-0085 - Phone (800)763-2272 - toll free (425)462-0229 - Fax - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From cmeyer at zipcon.net Fri Aug 13 19:34:48 1999 From: cmeyer at zipcon.net (Colin Meyer) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: getting versions of modules? In-Reply-To: <212F359A8596D0118C8E00805FFE12BE040D14A9@xch-sea-07.ca.boeing.com>; from Borow, Scott W on Thu, Aug 12, 1999 at 09:24:42AM -0700 References: <212F359A8596D0118C8E00805FFE12BE040D14A9@xch-sea-07.ca.boeing.com> Message-ID: <19990813173448.A6948@sim.zipcon.net> ...or try: perl -MCGI -e'print "$CGI::VERSION\n"' 2.53 -Colin. On Thu, Aug 12, 1999 at 09:24:42AM -0700, Borow, Scott W wrote: > > You can check what version is installed by requiring > a non existent high version of the module from the > command line and examining the error message. > > For example for CGI.pm (since I don't have URI installed) > > borow@bandit ~ 512 > perl -M'CGI 9999' > CGI version 9999 required--this is only version 2.36. > BEGIN failed--compilation aborted. > borow@bandit ~ 513 > > > > --Scott > > > ---------- > > From: John Eckman[SMTP:eckman@u.washington.edu] > > Sent: Thursday, August 12, 1999 8:58 AM > > Cc: SPUG List > > Subject: SPUG: getting versions of modules? > > > > How do I tell what version of URI a system is running? > > > > I'm working with a script called checkbot.pl > > > > > > > > It makes the following call: > > > > my $redir_url = URI->new_abs($response->header('Location'), $baseURI); > > > > which generates an error on execution- apparentley the version of URI we > > have is old. > > > > But how do I find out what version we do have? > > > > John > > > [...] > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Aug 13 19:52:51 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Web Developer opportunity In-Reply-To: <9117AF4C156AD211A0D600105A9A675F05CEC8@SEA-PDC> from "Farhana Breuer" at Aug 13, 99 07:28:46 pm Message-ID: <199908140052.RAA16869@consultix.wa.com> >> Message submitted at: Fri Aug 13 17:52:51 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2987 According to Farhana Breuer: Please note that we do not allow direct postings of employment opportunities to this mailing list; they need to be emailed first to "spug@halcyon.com" so we can ensure that all the information we require is provided (and it wasn't in your posting.) Please refrain from posting any more announcements directly to the list, but you are welcome to submit them as indicated above. ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== > > Hi there! > > ACS Technology Solutions has an exciting Web Developer opportunity available > immediately. If you are interested please e-mail your resume and 3 > professional references to Farhana Breuer at fbreuer@acsts.com > . I am enclosing the job description below for > your review. > > The particulars for this contract are as follows: > > Length: Through the end of the year. After the new year the position could > be extended or most likely will want to bring the person aboard full time. > The full time salary range is 45 to 52K. > > Pay rate range: $30 to $40 > Skills needed: Experience working with Unix, Perl, HTML, CGI, Java, > Oracle, and SQL. > Main skills needed are Unix, Perl, and HTML. > Secondary skills are Oracle, CGI, Java, and SQL along with Shell scripting, > using primarily AWK > > Job description: Doing database restructuring and understanding > relational databases, not a DBA, but a programmer with the above > technologies who understands databases. Work on a Unix system doing shell > scripting with AWK using primarily Perl, HTML, and CGI, along with some > Oracle and SQL. > > Look forward to receiving your resume. > > With much regard, > Farhana Breuer > Sr. Technical Recruiter > fbreuer@acsts.com > ACS Technology Solutions > 1750 112th Avenue N.E, Suite D-159 > Bellevue, Washington 98004 > (425)462-0085 - Phone > (800)763-2272 - toll free > (425)462-0229 - Fax > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address > > > *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Sun Aug 15 15:15:46 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Perl Cooks Needed Now! Message-ID: <199908152015.NAA23046@consultix.wa.com> >> Message submitted at: Sun Aug 15 13:15:46 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1237 SPUG-ers, As long-time readers of this list will already know, we've been slowly working through the O'Reilly "Perl Cookbook" at our meetings. Accordingly, I'm putting out a "call for cooks", to see who might be interested in leading a discussion on one of the next Cookbook chapters, on Arrays, Hashes, or Pattern Matching. Currently, I'm most interested in lining somebody up for the 8/17 meeting, but if anyone would like to volunteer to cover one of these chapters at a later date (9/21, 10/19, 11/16, 12/21), I'll take those reservations too. Of course, if anybody would like to volunteer to speak on any other topic, let me know what you have in mind and we can discuss that possibility also. Remember, we are a "Perl educational cooperative", and this format depends on volunteer speakers to make things work! *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Sun Aug 15 17:45:44 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: Perl Cooks Needed Now! Message-ID: <199908152245.PAA23381@consultix.wa.com> >> Message submitted at: Sun Aug 15 15:45:44 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 937 > > Currently, I'm most interested in lining somebody up for > the 8/17 meeting, but if anyone would like to volunteer to > cover one of these chapters at a later date (9/21, 10/19, > 11/16, 12/21), I'll take those reservations too. > Oops! - I recycled an old Email message here, and neglected to edit it sufficiently - so, let me be clear about this: the next open date for volunteer speakers is 9/21; Elf Sternberg will be talking about "ncurses" on 8/17, as previously announced, and as indicated on the Web site. *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Tue Aug 17 14:14:16 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: "ncurses" talk tonight, + speaker payoffs Message-ID: <199908171914.MAA06219@consultix.wa.com> >> Message submitted at: Tue Aug 17 12:14:16 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2110 TONIGHT'S MEETING Just a reminder, tonight at 7pm, at the usual place (Fred's Cancer Center), Elf Sternberg will be talking about the "ncurses" library, used by lynx, menuconfig, and other character-terminal-oriented applications. FORMER SPEAKERS TO BE RECOGNIZED IN AWARD CEREMONY As a special treat, all attendees who have previously been featured as SPUG speakers will receive for free, and at absolutely no charge, but only if they want to, and while supplies last, but subject to availability, a SEMI-VALUABLE LINUX-RELATED ITEM (non-downloadable), courtesy of Caldera Systems. SPEAKER-"WannaBe's" APPLY NOW! Oh, by the way, those wishing to join the exclusive community of former SPUG-speakers may still apply, as I am keeping a few openings free for the next wave of volunteers, such as the 9/21 meeting, for which I'm proposing coverage of the Cookbook chapter on Arrays, and the 10/19 meeting, for which I'm proposing the Hashes chapter (but other suggestions are welcome). WORLD-CLASS EXPERTISE NOT REQUIRED You don't have to be a world-class expert on a topic to lead the meeting on it, because our friendly attendees are easily pleased and always get much more than their ($0.00) money's worth out of each and every meeting. However, if you put in a significant amount of preparation prior to your meeting, as most of us do, you'll certainly end up knowing a lot more about the topic than you did before. And so will many of those who attend your talk! In fact, that's why we do this! And you might even earn a semi-valuable prize for your efforts (no guarantee though). -Please, one at a time - don't all charge forward at once! Give me air! 8-} *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Wed Aug 18 05:05:29 1999 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: No Motif for Curses, but found Curses Development Kit Message-ID: <87iu6dpfo6.fsf@perv.daft.com> -----BEGIN PGP SIGNED MESSAGE----- I was curious to see if I could find something called "Motif for Curses". I failed. But I did find something interesting called the Curses Development Kit. It's both a C library and a Perl extension. I haven't used it yet but it looks interesting. Check out: for more. They have a table listing some of the stuff it does: Alphalist, Buttonbox, Calendar, Dialog, Entry, File Selector, Graph, Histogram, Item List, Label, Marquee, Matrix, Menu, Multiple Line Entry, Radio List, Scale, Scrolling List, Scrolling Window, Selection List, Slider, Template, and Viewer. Now whether the Perl interface implements all of this, I don't know. Darren - -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ -----BEGIN PGP SIGNATURE----- Version: 2.6.3a Charset: noconv Comment: Processed by Mailcrypt 3.5.1, an Emacs/PGP interface iQCVAwUBN7qFaI4wrq++1Ls5AQGnTwP/YHr0/5pTKmtcbemvTqMR6MVlbAQKnb2x XoPrNgTCDooQryY/uGkGs6Okq1CAg/vcqjcV4pQ2sdnR091gDQ86hhDOzEkxUHMw mVTITQ9bK+vRaD4QKqvMzRCsKuph/msklk/QI3h6PMx6PaETQhRd/rBcyeJ++Z3j 4Pk+pm8VbMM= =LBSL -----END PGP SIGNATURE----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan at erwin.org Wed Aug 18 14:10:38 1999 From: ryan at erwin.org (Ryan Erwin) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: VI and Perl tools... Message-ID: <99081812515801.00411@linbox> I was looking for the vi tools for perl editing by Tom Christiansen. I checked on CPAN and all I found was a perl tags script for vi. If anyone knows of other utilities for editing perl with vi please let me know where I can find them. ryan erwin [ryan@erwin.org] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From elf at halcyon.com Wed Aug 18 17:19:31 1999 From: elf at halcyon.com (Elf Sternberg) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: No Motif for Curses, but found Curses Development Kit Message-ID: <199908182219.PAA17868@king.halcyon.com> "Darren/Torin/Who Ever..." wrote: >I was curious to see if I could find something called "Motif for >Curses". I failed. But I did find something interesting called the >Curses Development Kit. It's both a C library and a Perl extension. I >haven't used it yet but it looks interesting. Check out: > for more. That's the one I was thinking of. I'm not so impressed with it as I one was, although it does have a lot of attractive features. I've found that, in Perl at least, a lot of the things it offers are easier to write using the Perl run-time library rather than the XS interface-based stuff. Elf Elf M. Sternberg, rational romantic mystic cynical idealist MST3K - Help save the saving grace of television. A.A 1493 http://www.halcyon.com/elf/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dougb at scalar.org Wed Aug 18 17:18:04 1999 From: dougb at scalar.org (Doug Beaver) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: VI and Perl tools... In-Reply-To: <99081812515801.00411@linbox>; from Ryan Erwin on Wed, Aug 18, 1999 at 12:10:38PM -0700 References: <99081812515801.00411@linbox> Message-ID: <19990818151804.A7442@scalar.org> On Wed, Aug 18, 1999 at 12:10:38PM -0700, Ryan Erwin wrote: > I was looking for the vi tools for perl editing by Tom > Christiansen. I checked on CPAN and all I found was a perl tags > script for vi. If anyone knows of other utilities for editing > perl with vi please let me know where I can find them. I don't think tchrist has any tools for editing perl code w/ vi, but he has the vi/pdb interface: http://www.cpan.org/authors/Tom_Christiansen/scripts/vi-db.shar.gz I haven't had a chance to check it out yet, so I don't know how useful it is... Also, if you're going to give vi a test drive, try vim. You can compile it with an embedded perl interpreter, so you can use perl regexes for substitutions and it also comes with a neat OO package that allows you to manipulate editor buffers using perl. I'm going on vacation on Friday, and one of the things I want to do is create some cool commands for the vim perl extension. If I ever get around to doing it, I'll forward a url to the list once I get back into town... Doug -- Smithers: I'm afraid we have a bad image, Sir. Market research shows people see you as somewhat of an ogre. Burns: I ought to club them and eat their bones! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan2 at webrocket.net Wed Aug 18 17:34:05 1999 From: ryan2 at webrocket.net (Ryan Forsythe) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... References: <99081812515801.00411@linbox> Message-ID: <37BB34DD.AF0CA3B1@webrocket.net> hi, it's ryan the perl newbie again, with another (probably) simple question... i'm writing a program which opens a text file, searches each line, and extracts data from it and sticks it in a hash...well, that's what it's supposed to do. here's a simplification of the loop i'm having problems with: while (defined($dbaseLine = )) { #code here... if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { $hash{'key1'} = $1; $hash{'key2'} = $2; #etc... } else { next; } } however, my program has 26 of these '\"(.*)\",' in the 'if ($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable okay, but when it gets to that if test, it locks up and i watch perl's cpu time go up to 99%. i'm assuming it's getting in an infinite loop, but why? i don't understand how an if can cause and infinite loop, especially when it doesn't affect the test variable of the while it's wrapped in (if that makes any sense to anybody :)) btw, is there any shorter way to write that 'if' that still stores substrings? --ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Wed Aug 18 18:28:21 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <37BB34DD.AF0CA3B1@webrocket.net> References: <99081812515801.00411@linbox> <37BB34DD.AF0CA3B1@webrocket.net> Message-ID: <14267.16773.884802.773309@maakie.uswc.uswest.com> If you are getting stuck in the 'if' statement the problem could be with your regex. A sample of the data you are matching against might help us with your problem if the regex is the culprit. Another option you may consider is to use the split function. You could hack off the leading quote and then do a '@values = split(/", "/, $dbaseLine);' >>>>> On Wed XVIII Aug MCMXCIX XV:XXXIV:V, Ryan Forsythe writes: Ryan> hi, it's ryan the perl newbie again, with another (probably) simple Ryan> question... Ryan> i'm writing a program which opens a text file, searches each line, and Ryan> extracts data from it and sticks it in a hash...well, that's what it's Ryan> supposed to do. here's a simplification of the loop i'm having problems Ryan> with: Ryan> while (defined($dbaseLine = )) { Ryan> #code here... Ryan> if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { Ryan> $hash{'key1'} = $1; Ryan> $hash{'key2'} = $2; Ryan> #etc... Ryan> } else { Ryan> next; Ryan> } Ryan> } Ryan> however, my program has 26 of these '\"(.*)\",' in the 'if Ryan> ($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable Ryan> okay, but when it gets to that if test, it locks up and i watch perl's Ryan> cpu time go up to 99%. i'm assuming it's getting in an infinite loop, Ryan> but why? i don't understand how an if can cause and infinite loop, Ryan> especially when it doesn't affect the test variable of the while it's Ryan> wrapped in (if that makes any sense to anybody :)) Ryan> btw, is there any shorter way to write that 'if' that still stores Ryan> substrings? Ryan> --ryan Ryan> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ryan> POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Ryan> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ Ryan> SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Ryan> Email to majordomo@pm.org: ACTION spug-list your_address -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Wed Aug 18 18:31:17 1999 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <37BB34DD.AF0CA3B1@webrocket.net> Message-ID: On 08/18/99 @ 15:34, the infamous Ryan Forsythe wrote: :} while (defined($dbaseLine = )) { :} if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { :} :} $hash{'key1'} = $1; :} $hash{'key2'} = $2; :} #etc... :} } :} } Some of this can be simplified (by taking advantage of $_) to: while ( | N2H2, Incorporated v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400 "Intelligent Technologies For | Seattle WA 98164-1059 a Safe and Productive Internet" | http://www.n2h2.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dougb at scalar.org Wed Aug 18 18:29:46 1999 From: dougb at scalar.org (Doug Beaver) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <37BB34DD.AF0CA3B1@webrocket.net>; from Ryan Forsythe on Wed, Aug 18, 1999 at 03:34:05PM -0700 References: <99081812515801.00411@linbox> <37BB34DD.AF0CA3B1@webrocket.net> Message-ID: <19990818162946.A7792@scalar.org> On Wed, Aug 18, 1999 at 03:34:05PM -0700, Ryan Forsythe wrote: > hi, it's ryan the perl newbie again, with another (probably) simple > question... > > i'm writing a program which opens a text file, searches each line, and > extracts data from it and sticks it in a hash...well, that's what it's > supposed to do. here's a simplification of the loop i'm having problems > with: > > while (defined($dbaseLine = )) { > > #code here... > > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > > $hash{'key1'} = $1; > $hash{'key2'} = $2; > #etc... > } else { > next; > } > } > > however, my program has 26 of these '\"(.*)\",' in the 'if > ($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable > okay, but when it gets to that if test, it locks up and i watch perl's > cpu time go up to 99%. i'm assuming it's getting in an infinite loop, > but why? i don't understand how an if can cause and infinite loop, > especially when it doesn't affect the test variable of the while it's > wrapped in (if that makes any sense to anybody :)) The program isn't getting stuck on the while loop, it's getting stuck on your regex. I think it's because you're making the regex engine backtrack each time it trys to match another \"(.*)\"... .* is greedy, so in order to match the regex against the string, it keeps having to chop off text from previous greedy matches and try to use it on the new greedy matches. I can't explain it very well (Jeffrey Friedl does a good job in 'Mastering Regular Expressions'), but it'll take forever to run. You almost never want to use .* or .*? in order to match stuff like that anyways, you want to use this: "([^"]*)" (Look in 'Mastering Regular Expressions' for the discussion about balanced matches, it talks about the evils of using .*? vs using negated character classes.) If you know how many fields you're going to need to match, you don't even have to create the regex by hand (if you have a huge regex, it's easy to make small typos which are hard to track down): my $field_regex = '"([^"]*)"'; my $num_fields = 20; my @tmp; until (scalar @tmp >= $num_fields) { push @tmp, $field_regex; } my $line_regex = join ',', @tmp; Try using that or a variation thereof and see if it solves your cpu usage problem... HTH, Doug -- Smithers: I'm afraid we have a bad image, Sir. Market research shows people see you as somewhat of an ogre. Burns: I ought to club them and eat their bones! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Wed Aug 18 18:34:56 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <37BB34DD.AF0CA3B1@webrocket.net> from "Ryan Forsythe" at Aug 18, 99 03:34:05 pm Message-ID: <199908182334.QAA10123@consultix.wa.com> >> Message submitted at: Wed Aug 18 16:34:56 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2805 According to Ryan Forsythe: > > hi, it's ryan the perl newbie again, with another (probably) simple > question... > > i'm writing a program which opens a text file, searches each line, and > extracts data from it and sticks it in a hash...well, that's what it's > supposed to do. here's a simplification of the loop i'm having problems > with: > > while (defined($dbaseLine = )) { > > #code here... > > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > > $hash{'key1'} = $1; > $hash{'key2'} = $2; > #etc... > } else { > next; > } > } > > however, my program has 26 of these '\"(.*)\",' in the 'if > ($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable > okay, but when it gets to that if test, it locks up and i watch perl's > cpu time go up to 99%. i'm assuming it's getting in an infinite loop, I think it's looking ahead to see how much data each .* part can gobble up without invalidating the rest of the complete match, and repeatedly back-tracking and starting over until it finds the maximal match for each .* part that allows the overall match. This is exactly where you want to use the "stingy" match option, .*?, which will get the shortest match and obviate the need for all the scanning-ahead and back-tracking. > if ($dbaseLine =~ m/^\"(?:.*?)\",\"(.*?)\",\"(.*?)\"/) { Regarding simplifying the writing, you could grab each match from a separate iteration of a loop with the matching operator as the test condition, but then you'd have to implement your own counter to make sure you got all 26 matches, so it's probably easier just to write the hairy RE and go for the match all at once. I think you can also do something like: (the_match){26} to say you want 26 of those matches, but I wasn't getting 26 variables populated in my test case, just $1 holding the last match. There might be a way to do this, but off the top of my head (here on my reclining chair in full sunlight, without recourse to Friedl's book) this is as close as I can come right now! 8-} Can somebody else tell Ryan how to do this? > but why? i don't understand how an if can cause and infinite loop, > especially when it doesn't affect the test variable of the while it's > wrapped in (if that makes any sense to anybody :)) > > btw, is there any shorter way to write that 'if' that still stores > substrings? > > --ryan *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Wed Aug 18 18:51:05 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <19990818162946.A7792@scalar.org> from "Doug Beaver" at Aug 18, 99 04:29:46 pm Message-ID: <199908182351.QAA10291@consultix.wa.com> >> Message submitted at: Wed Aug 18 16:51:05 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 3318 According to Doug Beaver: > > On Wed, Aug 18, 1999 at 03:34:05PM -0700, Ryan Forsythe wrote: > > hi, it's ryan the perl newbie again, with another (probably) simple > > question... > > > > i'm writing a program which opens a text file, searches each line, and > > extracts data from it and sticks it in a hash...well, that's what it's > > supposed to do. here's a simplification of the loop i'm having problems > > with: > > > > while (defined($dbaseLine = )) { > > > > #code here... > > > > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > > > > $hash{'key1'} = $1; > > $hash{'key2'} = $2; > > #etc... > > } else { > > next; > > } > > } > > > > however, my program has 26 of these '\"(.*)\",' in the 'if > > ($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable > > okay, but when it gets to that if test, it locks up and i watch perl's > > cpu time go up to 99%. i'm assuming it's getting in an infinite loop, > > but why? i don't understand how an if can cause and infinite loop, > > especially when it doesn't affect the test variable of the while it's > > wrapped in (if that makes any sense to anybody :)) > > The program isn't getting stuck on the while loop, it's getting stuck on > your regex. I think it's because you're making the regex engine > backtrack each time it trys to match another \"(.*)\"... > > .* is greedy, so in order to match the regex against the string, it > keeps having to chop off text from previous greedy matches and try to > use it on the new greedy matches. I can't explain it very well (Jeffrey > Friedl does a good job in 'Mastering Regular Expressions'), but it'll > take forever to run. > > You almost never want to use .* or .*? in order to match stuff like that > anyways, you want to use this: > > "([^"]*)" - or ([^"]+), depending on the minimal acceptable match. Good idea Doug, but according to his code, he was trying to match up to the next \" sequence, not the next ". He may have mistakenly been trying to (unnecessarily) escape the " characters, in which case your approach above would be appropriate, but I recommended the .*? approach on the basis of his apparent need to match up to the next \" sequence. > > (Look in 'Mastering Regular Expressions' for the discussion about > balanced matches, it talks about the evils of using .*? vs using negated > character classes.) > > If you know how many fields you're going to need to match, you don't > even have to create the regex by hand (if you have a huge regex, it's > easy to make small typos which are hard to track down): > > my $field_regex = '"([^"]*)"'; > my $num_fields = 20; > my @tmp; > > until (scalar @tmp >= $num_fields) { > push @tmp, $field_regex; > } > > my $line_regex = join ',', @tmp; > > Try using that or a variation thereof and see if it solves your cpu > usage problem... > > HTH, > > Doug *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Wed Aug 18 18:56:41 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <199908182351.QAA10291@consultix.wa.com> from "Tim Maher/CONSULTIX" at Aug 18, 99 04:51:05 pm Message-ID: <199908182356.QAA10354@consultix.wa.com> >> Message submitted at: Wed Aug 18 16:56:41 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 843 According to Tim Maher/CONSULTIX: > > > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { Okay, one last attempt to save face and put this \ issue to rest: 8-} * if you want to match \", you need to write \\"; * if you want to match ", you only need to write ". * If you write \" when trying to match ", you'll succeed in getting your match, but you might confuse your code-readers with those extraneous backslashes! *==================================================================* | Tim Maher, PhD CEO, Consultix & (206) 781-UNIX/8649 | | Pacific Software Gurus, Inc. Email: tim@consultix-inc.com | | "The UNIX/Perl Training Experts" http://www.consultix-inc.com | |CLASSES: Shell+Utils: 8/23-27; Perl: 8/30-9/1; Perl Modules: 9/2;| *==================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Scott.Blachowicz at seaslug.org Wed Aug 18 18:55:27 1999 From: Scott.Blachowicz at seaslug.org (Scott Blachowicz) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <199908182334.QAA10123@consultix.wa.com>; from Tim Maher/CONSULTIX on Wed, Aug 18, 1999 at 04:34:56PM -0700 References: <37BB34DD.AF0CA3B1@webrocket.net> <199908182334.QAA10123@consultix.wa.com> Message-ID: <19990818165527.A9053@sabami.seaslug.org> > > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > ... > I think you can also do something like: > (the_match){26} > to say you want 26 of those matches, but I wasn't getting 26 variables > populated in my test case, just $1 holding the last match. There might > be a way to do this, but off the top of my head (here on my reclining > chair in full sunlight, without recourse to Friedl's book) this is as > close as I can come right now! 8-} Depends...are there commas in the $dbaseLine that are NOT delimiters? Another way to approach it might be something like: @tokens = split(/,/, $dbaseLine); if (@tokens == 26) { # Individual tokens are in $tokens[0] thru $tokens[25] - just # need to strip leading & trailing quotes. } Also...can you have embedded quotes inside your individual tokens? If so, that regexp will need some tweaking...maybe something like: if ($dbaseLine =~ m/^\"(([^"]|\\\")*)",/) { to match one of them (getting rid of the ".*" construct probably means you can get rid of the "non-greedy" "?:" as well. And much as I hate to do explicit loops...maybe... my @tokens; my $token; my $arg2; my $rest = $dbaseLine; while (($token,$arg2,$rest) = ($rest =~ m/^\"(([^"]|\\\")*)"(,.*|$)/)) { push (@tokens, $rest); } if (@tokens == 26) { } (NOTE: The perl code quoted here is completely free from having been run, tested or otherwise validated...) -- Scott.Blachowicz@seaslug.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Scott.Blachowicz at seaslug.org Wed Aug 18 18:57:47 1999 From: Scott.Blachowicz at seaslug.org (Scott Blachowicz) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <199908182351.QAA10291@consultix.wa.com>; from Tim Maher/CONSULTIX on Wed, Aug 18, 1999 at 04:51:05PM -0700 References: <19990818162946.A7792@scalar.org> <199908182351.QAA10291@consultix.wa.com> Message-ID: <19990818165746.B9053@sabami.seaslug.org> On Wed, Aug 18, 1999 at 04:51:05PM -0700, Tim Maher/CONSULTIX wrote: > - or ([^"]+), depending on the minimal acceptable match. > > Good idea Doug, but according to his code, he was trying to match up > to the next \" sequence, not the next ". He may have mistakenly > been trying to (unnecessarily) escape the " characters, in which > case your approach above would be appropriate, but I recommended > the .*? approach on the basis of his apparent need to match up to > the next \" sequence. I don't think so...the sequence \" in a regexp should match a single, literal double-quote. I thought the general rule was that you could back-whack any non-alphanumeric to get it treated as a literal (regardless of whether it has a special interpretation without the back-whack). -- Scott.Blachowicz@seaslug.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Wed Aug 18 19:18:37 1999 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: Ryan Forsythe's message of "Wed, 18 Aug 1999 15:34:05 -0700" References: <99081812515801.00411@linbox> <37BB34DD.AF0CA3B1@webrocket.net> Message-ID: <87yaf8tyg2.fsf@ralf.serv.net> Ryan Forsythe writes: | i'm writing a program which opens a text file, searches each line, and | extracts data from it and sticks it in a hash...well, that's what it's | supposed to do. here's a simplification of the loop i'm having problems | with: | | while (defined($dbaseLine = )) { | | #code here... | | if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { | | $hash{'key1'} = $1; | $hash{'key2'} = $2; | #etc... | } else { | next; | } | } | | however, my program has 26 of these '\"(.*)\",' in the 'if ($dbaseLine...' | test. when i run it, it assigns the $dbaseLine variable okay, but when it | gets to that if test, it locks up and i watch perl's cpu time go up to 99%. | i'm assuming it's getting in an infinite loop, but why? i don't understand | how an if can cause and infinite loop, especially when it doesn't affect the | test variable of the while it's wrapped in (if that makes any sense to | anybody :)) Well, it's not the "if" statement itself---it's the matching process. Perl is attempting all sorts of possible combinations in this case to figure out if the regexp fits (I posted a similar problem to this list just the other day). You might do well to replace the .* expression with [^"]*, which would at least stop at the first non-quote character. However, what I would probably do in this case is try to figure out what actually makes a line qualify as a $dbaseLine. What are you trying to exclude? If all you're worried about is blank lines, that's easy enough to handle: while( defined( $dbaseLine = ) ) { chomp( $dbaseLine ); next if( $dbaseLine eq "" ); ... } for example. As far as handling the breaking up of the variable itself, I might recommend going with something else that will work a lot faster. For example: $dbaseLine = s/^"//; # Trim opening quote. $dbaseLine = s/"$//; # And the trailing one. @vals = split( /","/, $dbaseLine ) # Break it up. $count = 0; for( @vals ) { ++$count; $hash{"key$count"} = $_; } More code, but avoids the endless attempts to match the complex regex. ---Ken - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dougb at scalar.org Wed Aug 18 19:59:16 1999 From: dougb at scalar.org (Doug Beaver) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: <199908182351.QAA10291@consultix.wa.com>; from Tim Maher/CONSULTIX on Wed, Aug 18, 1999 at 04:51:05PM -0700 References: <19990818162946.A7792@scalar.org> <199908182351.QAA10291@consultix.wa.com> Message-ID: <19990818175916.A8794@scalar.org> On Wed, Aug 18, 1999 at 04:51:05PM -0700, Tim Maher/CONSULTIX wrote: > According to Doug Beaver: > > You almost never want to use .* or .*? in order to match stuff like that > > anyways, you want to use this: > > > > "([^"]*)" > > - or ([^"]+), depending on the minimal acceptable match. > > Good idea Doug, but according to his code, he was trying to match up > to the next \" sequence, not the next ". He may have mistakenly > been trying to (unnecessarily) escape the " characters, in which > case your approach above would be appropriate, but I recommended > the .*? approach on the basis of his apparent need to match up to > the next \" sequence. (The \" vs " thing has already been discussed...) I still advocate using a negated character class instead of .*? in almost all situations, .*? has pitfalls that are hard to understand until you've been bitten by them a few times. ;-) See pp 226-227 of Mastering Regular Expressions for details. (I'd list the pitfalls and show some example input and matches using both .*? and a negated character class, but I'm leaving town soon and have too much work to finish before I leave... :-/) Doug -- Smithers: I'm afraid we have a bad image, Sir. Market research shows people see you as somewhat of an ogre. Burns: I ought to club them and eat their bones! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From charles.e.derykus at boeing.com Wed Aug 18 20:44:04 1999 From: charles.e.derykus at boeing.com (charles.e.derykus@boeing.com) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... Message-ID: <199908190144.SAA13484@carios2.ca.boeing.com> > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > > $hash{'key1'} = $1; > $hash{'key2'} = $2; > #etc... > .. > however, my program has 26 of these '\"(.*)\",' in the 'if As Doug noted, this regex'll backtrack quite a bit. Another possibility for speedup would be to break up the regex and use the '\G' operator and the 'g' modifier for the repetitive portion: my $count = 26; my $pattern = '[^"]*'; if ( /^"(?:[^"]*",)/g # note: need 'g' here and ( @matches = /\G"($pattern)",?/g ) == $count ) { @hash{@key_names) = @matches; } Regards, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From charles.e.derykus at boeing.com Wed Aug 18 20:53:25 1999 From: charles.e.derykus at boeing.com (charles.e.derykus@boeing.com) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... Message-ID: <199908190153.SAA13496@carios2.ca.boeing.com> > ( @matches = /\G"($pattern)",?/g ) == $count ^^ go Also, could use the 'o' modifier too since the pattern doesn't vary. -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Thu Aug 19 03:02:09 1999 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: Ryan Forsythe's message of "Wed, 18 Aug 1999 15:34:05 -0700" References: <99081812515801.00411@linbox> <37BB34DD.AF0CA3B1@webrocket.net> Message-ID: <87zozomc5a.fsf@perv.daft.com> -----BEGIN PGP SIGNED MESSAGE----- Ryan Forsythe , in an immanent manifestation of deity, wrote: > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { > > $hash{'key1'} = $1; > $hash{'key2'} = $2; > #etc... > } else { > >however, my program has 26 of these '\"(.*)\",' in the 'if >($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable >okay, but when it gets to that if test, it locks up and i watch perl's >cpu time go up to 99%. i'm assuming it's getting in an infinite loop, >but why? i don't understand how an if can cause and infinite loop, >especially when it doesn't affect the test variable of the while it's >wrapped in (if that makes any sense to anybody :)) The if isn't the infinite loop, the regex is. And theoretically, it's not infinite loop. But it probably won't finish before the projected heat-death of the universe. The problem is back-tracking. I think (someone please correct me if I'm wrong) that with the /\"(.*)\",/, you are increasing your runtime exponentially (O^n). Assuming that you want each substring to stop as soon as it hits the sequence "," then your regex will work much quicker if you use /^\"(?:.*?)\",\"(.*?)\",\"(.*?)\"/. This says to minimally match what's inside quotes. It stops as soon as it can complete a match rather than trying for the largest match. If you don't allow there to be escaped quotes in your matched strings, it's much quicker to say: /^\"(?:[^"])\",\"([^"])\",\"([^"])\"/. That tells it that you want everything to the right of a " until there is another ". Note that you're just parsing CSV (comma separated values), a known problem. I asked for the CSV modules on CPAN and got the following: Module Bundle::DBD::CSV (N/A) Module DBD::CSV (JWIED/DBD-CSV-0.1021.tar.gz) Module Text::CSV (ALANCITT/Text-CSV-0.01.tar.gz) Module Text::CSV_XS (JWIED/Text-CSV_XS-0.20.tar.gz) You probably aren't interested in the DBD module unless you're incorporating your data into a real database. Text::CSV and Text::CSV_XS would probably work for you though. I saw the following regex in the Owl book (read it, learn it, love it): push(@fields, $+) while $text =~ m{ "([^\"\\]*(?:\\.[^\"\\]*)*)",? # Standard quoted string (with possible comma) | ([^,]+),? # or up to next comma (with possible comma) | , # or just a comma }gx; This is quite what you want but it's close. Look on pages 205-209 of the Owl Book (Mastering Regular Expressions by Jeffrey Friedl, published by ORA, 1997; ISBN: 1-56592-257-3) for an explanation of this. Darren - -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ -----BEGIN PGP SIGNATURE----- Version: 2.6.3a Charset: noconv Comment: Processed by Mailcrypt 3.5.1, an Emacs/PGP interface iQCVAwUBN7u53Y4wrq++1Ls5AQH8LAP/ZjaxW20/odYfwQkR5okzZmiX2qAtxB67 BEQqokjq7gf6JbUvWC+pcGvJkyPQpq8wdDGhrmjHGpvqhBUWyoRzTbhaIwqlRNgJ D4n3jjUCqsFUzkm9i+PhLbzkJ2nhdeaeDH1zcxMRiKWqVNqfPtJv01kxyG0a9fCX KvFCOnfuHQ8= =8Up+ -----END PGP SIGNATURE----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From torin at daft.com Thu Aug 19 06:19:45 1999 From: torin at daft.com (Darren/Torin/Who Ever...) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... In-Reply-To: "Darren/Torin/Who Ever..."'s message of "19 Aug 1999 01:02:09 -0700" References: <99081812515801.00411@linbox> <37BB34DD.AF0CA3B1@webrocket.net> <87zozomc5a.fsf@perv.daft.com> Message-ID: <87d7wkm2zy.fsf@perv.daft.com> Sorry for commenting on what everyone else had already commented on. For some reason, I didn't see this in Gnus when I was first looking. Hrm. At least, I did give the full reference to the Owl book and what's available on CPAN. :) I said: >be escaped quotes in your matched strings, it's much quicker to say: >/^\"(?:[^"])\",\"([^"])\",\"([^"])\"/. That tells it that you want >everything to the right of a " until there is another ". And of course those should be [^"]*. This is a problem I have at times with regexes. Thankfully, it's usually very obvious. Darren -- Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996 @ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @ @ Make a little hot-tub in your soul. @ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From elf at halcyon.com Thu Aug 19 11:08:23 1999 From: elf at halcyon.com (Elf Sternberg) Date: Wed Aug 4 00:09:30 2004 Subject: SPUG: ifs and whiles and hashes... Message-ID: <199908191608.JAA19530@king.halcyon.com> Ryan Forsythe writes: > if ($dbaseLine =~ m/^\"(?:.*)\",\"(.*)\",\"(.*)\"/) { >however, my program has 26 of these '\"(.*)\",' in the 'if >($dbaseLine...' test. when i run it, it assigns the $dbaseLine variable >okay, but when it gets to that if test, it locks up and i watch perl's >cpu time go up to 99%. i'm assuming it's getting in an infinite loop, >but why? It's not an infinite loop. What it *is* is perl creating 351 possible different regular expression DFAs and then assigning different parts of your string, in different lengths, to each one of the 351 possibilities, over and over and over until it gets one that's a match. I'm assuming that you're keeping the results of this regexp, otherwise you wouldn't have parens around them. If so, there is an easier way to do this: my @res = (); $_ = $dbaseLine; while(s/^"([^"]*?)",?\s*//) { push @res, $1 } if (scalar(@res) == 26) { ... } There. Now @res contains an array that theoretically has 26 elements in it. The regular expression only has to match one thing (something contained in quotes that is made up of anything that is not a quote), that may or may not be followed by a comma. That element is destroyed (I put it in a temporary variable anyway so $dbaseLine is not affected), but the paren match is pushed onto the array. When you're out of stuff, the match is unsuccessful and the loop terminates. You then test to see if you got 26 things; if you did, you proceed. The regular expression here is efficient because it knows to terminate when is sees the *first* quote symbol. >btw, is there any shorter way to write that 'if' that still stores >substrings? Shorter? No. Smarter? Absolutely. With this technique, as long as you're consistent, you can use lines of different length, or with some magic use inconsistent quote symbols, like single quotes. while((s/^"([^"]+)",?//) || ((s/^'([^']+)',?//)) { push @res, $1 } Elf Elf M. Sternberg, rational romantic mystic cynical idealist MST3K - Help save the saving grace of television. A.A 1493 http://www.halcyon.com/elf/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From consulti at consultix-inc.com Fri Aug 20 12:26:28 1999 From: consulti at consultix-inc.com (Consultix) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Testing-Please-Ignore Message-ID: <199908201726.KAA15269@consultix.wa.com> >> Message submitted at: Fri Aug 20 10:26:29 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 8 Testing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Aug 20 12:25:55 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: WEB/CGI Job Downtown Seattle, $$ Open In-Reply-To: <01BEEAF1.FA852400.troyv@thewatsongroup.com> from "Troy Valladares" at Aug 20, 99 09:54:21 am Message-ID: <199908201725.KAA15252@consultix.wa.com> >> Message submitted at: Fri Aug 20 10:25:55 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 2219 According to Troy Valladares: > > Hi- > > I have been in touch with Darren Stalder about an open position we have > with one of our clients in the downtown Seattle area. We are an IT > Staffing firm that specializes in placing contractors on assignment. Please > check out our web site below for additional information. Any person > interested in this opportunity please feel free to contact me. I have > listed my contact information below. > > thanks, > > Troy > > > > POSITION DETAILS > > > Position Title: Web Developer > Required Skills: Perl, HTML, SQL, Sun/Unix, Apache, Javascript, Source > Control experience > Desired Skills: Remedy experience / Oracle / C++ / > Project Description: Develop / enhance the web front end to remedy UNIX CGI > experience STRONG Perl! > Misc. Information (Culture/Ads, etc): Stock options included - Relocation > is available. > Other: This is an internet company located in downtown Seattle, would be > W-2 contract position or full time, rates are open. > > CLIENT JOB-POSTING > Remedy is an off-the-shelf trouble ticketing, asset tracking, change > management product that is miserably lacking in its web functionality. > They have a web front end, but it is almost completely unusable. We need > to get someone in that can help us rewrite our web application using > html/perl/sql on a Sun / Unix box. We're looking to hire someone into this > position full time, but we also have contingent positions available - > especially for someone who can start right away. There would be a lot of > perl/cgi - understanding of SQL and web/database applications is a must. > Responsibilities: Develop/enhance the web front end to remedy UNIX cgi > experience (need Strong perl - they must live, eat and breathe perl.) > Web/database experience - not just cgi to flat files - (must have talked > to a server class database such as Oracle) HTML layout skills Source > Control experience Javascript Apache web server Netscape web server > Documentation Desired: Oracle a plus c/c++ a plus Remedy experience a > > > The Watson Group > http://www.thewatsongroup.com > 425-488-5825 office > 206-898-8366 cell > 425-488-5817 Fax > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From ryan2 at webrocket.net Fri Aug 20 13:07:07 1999 From: ryan2 at webrocket.net (Ryan Forsythe) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: son of ifs and whiles and hashes Message-ID: <37BD994B.D39F631D@webrocket.net> thanks a lot, all...i didn't know (.*?) was so inefficient. i guess i'll have to go rummaging through my code changing all of them (doh!) i ended up doing it the $dbaseLine =~ s/^"//; $dbaseLine =~ s/"$//; @record = split /","/, $dbaseLine; way, since that doesn't make me remember how many items are in each record (well, it puts it off for a bit, at least : ) --ryan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From tim at consultix-inc.com Fri Aug 20 14:33:13 1999 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: son of ifs and whiles and hashes In-Reply-To: <37BD994B.D39F631D@webrocket.net> from "Ryan Forsythe" at Aug 20, 99 11:07:07 am Message-ID: <199908201933.MAA15749@consultix.wa.com> >> Message submitted at: Fri Aug 20 12:33:13 PDT 1999 X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 918 According to Ryan Forsythe: > > thanks a lot, all...i didn't know (.*?) was so inefficient. i guess > i'll have to go rummaging through my code changing all of them (doh!) > > i ended up doing it the > > $dbaseLine =~ s/^"//; > $dbaseLine =~ s/"$//; > @record = split /","/, $dbaseLine; > > way, since that doesn't make me remember how many items are in each > record (well, it puts it off for a bit, at least : ) I was very impressed with the quality and depth of the responses Ryan got to his modest little question, and I learned a few things by reading them. Thanks to all who contributed! Go SPUG-list! -Tim ========================================================== | Tim Maher, Ph.D. Tel/Fax: (206) 781-UNIX | | SPUG Founder & Leader Email: spug@halcyon.com | | Seattle Perl Users Group HTTP: www.halcyon.com/spug | ========================================================== - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Richard.Anderson at seaslug.org Sat Aug 21 02:55:52 1999 From: Richard.Anderson at seaslug.org (Richard Anderson) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Looking for a good ISP Message-ID: <00b901beebe5$b1840510$3a233fce@adcom133> I need some ISP services that Halcyon has been unable to offer. Can anyone suggest a good ISP? Some of the things I need: dial-up account with unlimited connect time, web page with no extra charges up to about 200-500 MB/month, telnet access to a Unix server with Korn shell or pdksh, Apache web server with extensive Perl/CGI support including CGI.pm, HTTP.pm, LWP.pm, and EITHER Apache configured to run my CGI scripts as processes owned by my userid OR setuid CGI priviledges ... Any suggestions? Richard.Anderson@seaslug.org www.halcyon.com/starfire/home (personal) www.raycosoft.com (corporate) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From leary at nwlink.com Tue Aug 24 14:19:57 1999 From: leary at nwlink.com (Michael Leary) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? References: <37BD994B.D39F631D@webrocket.net> Message-ID: <37C2F05D.F907F6E2@nwlink.com> Anyone know a nifty way to undef a list of variables? I'm trying to keep my package namespace clean between method calls. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From jimfl at colltech.com Tue Aug 24 16:32:36 1999 From: jimfl at colltech.com (jimfl) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? In-Reply-To: <37C2F05D.F907F6E2@nwlink.com> Message-ID: <1092855.3144493956@erdos.nwest.attws.com> --On Tue, Aug 24, 1999 12:19 PM -0700 Michael Leary wrote: > Anyone know a nifty way to undef a list of variables? I'm trying to > keep my package namespace clean between method calls. Something like: @clean = (\$foo, \$bar, \$baz, \$ghoti); map {undef $$_} @clean; -- Jim Flanagan Collective Technologies jimfl@colltech.com http://www.colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From leary at nwlink.com Tue Aug 24 17:06:19 1999 From: leary at nwlink.com (Michael Leary) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? References: <1092855.3144493956@erdos.nwest.attws.com> Message-ID: <37C3175B.1706375E@nwlink.com> Thanks to all on the speedy replies; I shoulda mentioned that I've got references, hashes and arrays to deal with.... here's what I came up with: foreach my $foo (\(%Structs, %Seq_has, %Thing_look, %Thing_seen, $Lexer, @Real, $Num_seen, @Data_elements, $Data_index, $VAR1)) { if ( ref($foo) eq 'HASH' ) { undef %$foo; } elsif ( ref($foo) eq 'ARRAY' ) { undef @$foo; } else { undef $$foo; } } not slick, IMO, but it works (comments, please!) part of the reason for using "use varw qw($yada $blah)" for variables I didn't real want to have around after the method call in the first place had to do with warnings about variables becoming unshared in named subroutines. Anyone dealt with 'unshared' warnings when using 'my' variables and named subroutines within methods, and come up with something better? And, yes, I'm under 'use strict'. jimfl wrote: > --On Tue, Aug 24, 1999 12:19 PM -0700 Michael Leary > wrote: > > > Anyone know a nifty way to undef a list of variables? I'm trying to > > keep my package namespace clean between method calls. > > Something like: > > @clean = (\$foo, \$bar, \$baz, \$ghoti); > map {undef $$_} @clean; > > -- > Jim Flanagan Collective Technologies > jimfl@colltech.com http://www.colltech.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ > SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe > Email to majordomo@pm.org: ACTION spug-list your_address - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Tue Aug 24 17:25:50 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? In-Reply-To: <37C2F05D.F907F6E2@nwlink.com> References: <37BD994B.D39F631D@webrocket.net> <37C2F05D.F907F6E2@nwlink.com> Message-ID: <14275.7111.525254.280718@maakie.uswc.uswest.com> If you mean a list you can clear a list with '@list = ();'. You can also use undef on a list 'undef @list;' If you mean scalars in a list, you could put use a foreach loop and then undef each of them: ---------------------- for (@scalars_list) { undef $_ } --------------------- or ---------------------------------- for ($scalar1, $scalar2, $scalar3) { undef $_ } ---------------------------------- You can also assign undef to a variable '$_ = undef;' I'm not sure why you would want to do this between method calls on a blessed variable. Are you using the strict pragma? >>>>> On Tue XXIV Aug MCMXCIX XII:XIX:LVII, Michael Leary writes: Michael> Anyone know a nifty way to undef a list of variables? Michael> I'm trying to keep my package namespace clean between method calls. -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From dbitsef at uswest.com Tue Aug 24 17:55:48 1999 From: dbitsef at uswest.com (David Bitseff) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? In-Reply-To: <37C3175B.1706375E@nwlink.com> References: <1092855.3144493956@erdos.nwest.attws.com> <37C3175B.1706375E@nwlink.com> Message-ID: <14275.8742.607214.780731@maakie.uswc.uswest.com> You could turn warnings off in the area you are having problems with by locally scoping $^W. For example: #!/usr/bin/perl -w { # warnings are off here local $^W; print $a; } >>>>> On Tue XXIV Aug MCMXCIX XV:VI:XIX, Michael Leary writes: > part of the reason for using "use varw qw($yada $blah)" for variables I didn't > real want to have around after the method call in the first place had to do > with warnings about variables becoming unshared in named subroutines. > Anyone dealt with 'unshared' warnings when using 'my' variables and named > subroutines within methods, and come up with something better? -- David Bitseff U S WEST Creative Services dbitsef@uswest.com (206) 346-9279 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From andy at n2h2.com Thu Aug 26 01:27:11 1999 From: andy at n2h2.com (Andrew Sweger) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: undef a list of variables? In-Reply-To: <37C3175B.1706375E@nwlink.com> Message-ID: On 08/24/99 @ 15:06, the infamous Michael Leary wrote: :} part of the reason for using "use varw qw($yada $blah)" for variables I didn't :} real want to have around after the method call in the first place had to do :} with warnings about variables becoming unshared in named subroutines. :} :} Anyone dealt with 'unshared' warnings when using 'my' variables and named :} subroutines within methods, and come up with something better? There's no 'unshared' warning that I know of, but these are two that I occasionally encounter under mod_perl. Which of these two errors are you getting: Variable $yada may be unavailable or Variable $yada will not stay shared I'm guessing the latter if you're using named sub-subroutines as you suggest. Are you defining subroutines inside of subroutines or running stuff under mod_perl? Unless you're trying to work with closures (anonymous code refs can trigger 'em) or use any of Damian Conway's cool method encapsulation tricks, you shouldn't be running into this (blasted mod_perl being the exception). -- Andrew Sweger | N2H2, Incorporated v=206.336.2947 f=206.336.1541 | 900 Fourth Avenue, Suite 3400 "Intelligent Technologies For | Seattle WA 98164-1059 a Safe and Productive Internet" | http://www.n2h2.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From Richard.Anderson at seaslug.org Tue Aug 31 08:40:47 1999 From: Richard.Anderson at seaslug.org (Richard Anderson) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Differences between vers 5.003_07 and 5.005_03? Message-ID: <028701bef3b6$708e8b60$b2233fce@adcom133> I am adding some functionality to a large body of Perl code that runs under version 5.003_07 on Win32. The upgrade involves using the XML::Parser module, so we need to upgrade to version 5.005_03. I am assuming that the differences between these versions will have no impact on the code. Any reason to think I am wrong? The code is large, but does not have any particularly fancy Perl syntax. Richard.Anderson@seaslug.org www.halcyon.com/starfire/home (personal) www.raycosoft.com (corporate) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Tue Aug 31 12:22:47 1999 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Differences between vers 5.003_07 and 5.005_03? In-Reply-To: "Richard Anderson"'s message of "Tue, 31 Aug 1999 06:40:47 -0700" References: <028701bef3b6$708e8b60$b2233fce@adcom133> Message-ID: <87u2pfhnko.fsf@ralf.serv.net> "Richard Anderson" writes: | I am adding some functionality to a large body of Perl code that runs under | version 5.003_07 on Win32. The upgrade involves using the XML::Parser | module, so we need to upgrade to version 5.005_03. I am assuming that the | differences between these versions will have no impact on the code. Any | reason to think I am wrong? Without knowing your code in detail, it's hard to know for sure. However, I've had no problems between 5.003 and 5.005. Your best bet is to take a look at the release notes for 5.005 and see if anything is going to affect you. ---Ken - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From stuart_poulin at yahoo.com Tue Aug 31 13:56:23 1999 From: stuart_poulin at yahoo.com (Stuart Poulin) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Win32, use Cwd, and $ENV{PWD} Message-ID: <19990831185624.21801.rocketmail@web112.yahoomail.com> This is a shame. On Unix I use to use Cwd; and $ENV{PWD} to track the current directory. Doesn't seem to work on NT or Windows 98. #!perl # Windows 98 and NT use Cwd qw(chdir cwd); chdir('.'); chdir('D:\Perl'); print "PWD=$ENV{PWD}\n"; print "cwd='",cwd,"'\n\n"; chdir('D:\Perl'); print "PWD=$ENV{PWD}\n"; print "cwd='",cwd,"'\n\n"; __END__ PWD=D:/users/spoulin/tmp/D:\Perl cwd='D:/Perl' PWD=D:/Perl/D:\Perl cwd='D:/Perl' __________________________________________________ Do You Yahoo!? Bid and sell for free at http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address From mcglk at serv.net Tue Aug 31 16:31:54 1999 From: mcglk at serv.net (Ken McGlothlen) Date: Wed Aug 4 00:09:31 2004 Subject: SPUG: Win32, use Cwd, and $ENV{PWD} In-Reply-To: Stuart Poulin's message of "Tue, 31 Aug 1999 11:56:23 -0700 (PDT)" References: <19990831185624.21801.rocketmail@web112.yahoomail.com> Message-ID: <87d7w3hc1h.fsf@ralf.serv.net> Stuart Poulin writes: | This is a shame. On Unix I use to use Cwd; and $ENV{PWD} to track the | current directory. Doesn't seem to work on NT or Windows 98. No, it sure doesn't. However, you can use the following: #!/perl/bin/perl # Teeny code fragment. use Win32; local( $currentdir ) = Win32::GetCwd(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/ SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe Email to majordomo@pm.org: ACTION spug-list your_address