From tim at consultix-inc.com Sat Jan 5 12:58:33 2002 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: DB Task Downtown Seattle Message-ID: <20020105105833.A1237@timji.consultix.wa.com> Type: Independent contractor, 1099 tax status Start: Jan-2002 Duration: 1-2 weeks Description: Analyze legacy database access and management code, modify it to make it work in new database environment, and document code and processing functionality. Rate: Negotiable based on experience Skills: o Perl on Windows 2000 o 2-3 years professional programming experience o Perl objects and methods o SQL Server data access Placement: Work will be through company. Location: Downtown Seattle. Company: Retail sales and merchandise. Interested parties should send resume and salary requirements to: Norman Sooy ogapcllc@yahoo.com http://www.ogapc.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Mon Jan 7 16:47:53 2002 From: tim at consultix-inc.com (Tim Maher/CONSULTIX) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Jan 15 Mtg: Intro2Perl ; Ingy's YAML.pm Message-ID: <20020107144753.A9003@timji.consultix.wa.com> SPUGsters, Brian Ingerson tells me he'll be leaving for greener pastures on Jan. 16th, and he wants to say farewell to SPUG by telling us about his latest module. (Maybe it'll be another world-changing prize winner, like Inline.pm?) So come see him on the 15th before he makes his escape from the soggy Northwest. Also, in keeping with our policy of featuring Beginner-level topics periodically, I'll be giving an "Intro to Perl" talk for the first half of the meeting. I'll update the web-site shortly with all the meeting info, but in the meantime, here's the easy-to-pass-around text version. See you there! -Tim P.S. Anyone who would like to make a presentation of some kind at any of the upcoming meetings please post a message to the list voicing your ideas. ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= Seattle Perl Users Group January Meeting Topic #1: "Intro. to Perl" Speaker: Tim Maher, Consultix (http://www.consultix-inc.com) Topic #2: "YAML: Yet Another Markup Language" Speaker: Brian "Ingy" Ingerson, formerly of ActiveState Corp. Cost: Free! Time: January 15th, 2002, 7pm-9pm Location: Safeco Tower auditorium, University District, Seattle More Info: www.seattleperl.org Pre/Post Meeting: Big Time Brewery and Alehouse http://www.bigtimebrewery.com 4133 University Way NE, Seattle * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** Intro. to Perl ** Tim Maher, Consultix (tim@consultix-inc.com) Topics: + Perl as an outgrowth of the grep, sed, awk,and shell utilities of UNIX + Perl documentation + Perl culture and gatherings + Perl educational resources, online and otherwise + Elementary examples of simple Perl programs + What a module is, and where to look for free ones (viz., CPAN) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** YAML.pm: Yet Another Markup Language ** Brian "Ingy" Ingerson (ingy@cpan.org) YAML (Yet Another Markup Language; aka YAML Ain't Markup Language) is a generic data serialization language that is optimized for human readability. It can be used to express the data structures of most modern programming languages. (including Perl!!!) More information can be found at http://www.yaml.org/. Does your camel YAML? YAML is readable for people. It makes clear sense out of complex data structures. You should find that YAML is an exceptional data dump- ing tool. Structure is shown through indentation, YAML supports recursive data, and hash keys are sorted by default. In addition, YAML supports several styles of scalar formatting for different types of data. YAML is editable. YAML was designed from the ground up to be the ulti- mate syntax for configuration files. All almost all programs need configuration files, so why invent a new syntax for each one. And why subject users to the com- plexities of XML or native Perl code. YAML is multilingual Yes, YAML supports Unicode. But I'm actually referring to programming languages. YAML was designed to meet the serialization needs of Perl, Python, Tcl, PHP, Java. It was also designed to be interoperable between those languages. That means any YAML serialization produced by Perl can be processed by Python, and be guaranteed to return the data structure intact. (Even if it contained Perl specific structures like GLOBs) YAML is taint safe. Using modules like Data::Dumper for serialization is fine as long as you can be sure that nobody can tamper with your data files or transmissions. That's because you need to use Perl's "eval()" built-in to deserial- ize the data. Somebody could add a snippet of Perl to erase your files. Plus much more... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From thasone at yahoo.com Wed Jan 9 10:29:21 2002 From: thasone at yahoo.com (c k) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <20020107144753.A9003@timji.consultix.wa.com> Message-ID: <20020109162921.80908.qmail@web21002.mail.yahoo.com> Has anybody had success with this recruiter? Cazy Green Greythorn Inc. 40 Lake Bellevue Suite 100 Bellevue, WA 98005 cazy.green@... He's always looking for somebody with Perl skills on a particular job board, in fact in one of his ads he recently states, "I need 12 Perl GURU's". Yet, when I call him up, he use stalling tactics or doesn't even take your number to return your call, you have to call him. After calling him several times, I said f#$k this, he ain't looking for nobody. Someday, I'm thinking of just sending him a real hyped up resume, that has no value. Anyway, if anybody has dealt with this recruiter and has had success, please let me know, maybe I'm wrong about him. __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From wbrian2 at qwest.net Wed Jan 9 12:26:03 2002 From: wbrian2 at qwest.net (Brian Wisti) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <20020109162921.80908.qmail@web21002.mail.yahoo.com> References: <20020109162921.80908.qmail@web21002.mail.yahoo.com> Message-ID: <200201091826.g09IQ4903253@www.coolnamehere.com> Okay, so it's not just me. I got a mild rejection complex talking to this guy a few times. Not taking down numbers, telling me that the client company was on a hiring hold & could I call back tomorrow ... I'm curious if anybody has had luck as well. Brian Wisti On Wednesday 09 January 2002 08:29 am, you wrote: > Has anybody had success with this recruiter? > > Cazy Green > Greythorn Inc. > 40 Lake Bellevue > Suite 100 > Bellevue, WA 98005 > cazy.green@... > > He's always looking for somebody with Perl skills on a > particular job board, in fact in one of his ads he > recently states, "I need 12 Perl GURU's". Yet, when I > call him up, he use stalling tactics or doesn't even > take your number to return your call, you have to call > him. After calling him several times, I said f#$k > this, he ain't looking for nobody. > > Someday, I'm thinking of just sending him a real hyped > up resume, that has no value. > > Anyway, if anybody has dealt with this recruiter and > has had success, please let me know, maybe I'm wrong > about him. -- ------------------------------------------------------------ Visit http://www.coolnamehere.com/ It'll kill some time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jay at Scherrer.com Wed Jan 9 12:38:30 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <20020109162921.80908.qmail@web21002.mail.yahoo.com> References: <20020109162921.80908.qmail@web21002.mail.yahoo.com> Message-ID: <200201091838.g09IcV801827@localhost.localdomain> I was able to contact him, He's looking for a Perler to work up in Bellingham, so he said. Long commute Jay On Wednesday 09 January 2002 08:29 am, c k wrote: > Has anybody had success with this recruiter? > > Cazy Green > Greythorn Inc. > 40 Lake Bellevue > Suite 100 > Bellevue, WA 98005 > cazy.green@... > > He's always looking for somebody with Perl skills on a > particular job board, in fact in one of his ads he > recently states, "I need 12 Perl GURU's". Yet, when I > call him up, he use stalling tactics or doesn't even > take your number to return your call, you have to call > him. After calling him several times, I said f#$k > this, he ain't looking for nobody. > > Someday, I'm thinking of just sending him a real hyped > up resume, that has no value. > > Anyway, if anybody has dealt with this recruiter and > has had success, please let me know, maybe I'm wrong > about him. > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jay at Scherrer.com Wed Jan 9 14:16:21 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <200201091826.g09IQ4903253@www.coolnamehere.com> References: <20020109162921.80908.qmail@web21002.mail.yahoo.com> <200201091826.g09IQ4903253@www.coolnamehere.com> Message-ID: <200201092016.g09KGMb02311@localhost.localdomain> An idea, Taking advantage of all the Perl experience of the spug members. Wouldn't it be cool if we could create a localized listing of Perl programmers, some how connected to the spug site? What do you think? Jay On Wednesday 09 January 2002 10:26 am, Brian Wisti wrote: > Okay, so it's not just me. I got a mild rejection complex talking to this > guy a few times. Not taking down numbers, telling me that the client > company was on a hiring hold & could I call back tomorrow ... > > I'm curious if anybody has had luck as well. > > Brian Wisti > > On Wednesday 09 January 2002 08:29 am, you wrote: > > Has anybody had success with this recruiter? > > > > Cazy Green > > Greythorn Inc. > > 40 Lake Bellevue > > Suite 100 > > Bellevue, WA 98005 > > cazy.green@... > > > > He's always looking for somebody with Perl skills on a > > particular job board, in fact in one of his ads he > > recently states, "I need 12 Perl GURU's". Yet, when I > > call him up, he use stalling tactics or doesn't even > > take your number to return your call, you have to call > > him. After calling him several times, I said f#$k > > this, he ain't looking for nobody. > > > > Someday, I'm thinking of just sending him a real hyped > > up resume, that has no value. > > > > Anyway, if anybody has dealt with this recruiter and > > has had success, please let me know, maybe I'm wrong > > about him. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cjcollier at sinclair.net Wed Jan 9 15:01:44 2002 From: cjcollier at sinclair.net (C.J. Collier) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <200201092016.g09KGMb02311@localhost.localdomain> Message-ID: Sounds great. I'll throw some hours into a project like that. Anyone else interested? C.J. On Wed, 9 Jan 2002, Jay Scherrer wrote: > An idea, > Taking advantage of all the Perl experience of the spug members. > Wouldn't it be cool if we could create a localized listing of Perl > programmers, some how connected to the spug site? > What do you think? > Jay > On Wednesday 09 January 2002 10:26 am, Brian Wisti wrote: > > Okay, so it's not just me. I got a mild rejection complex talking to this > > guy a few times. Not taking down numbers, telling me that the client > > company was on a hiring hold & could I call back tomorrow ... > > > > I'm curious if anybody has had luck as well. > > > > Brian Wisti > > > > On Wednesday 09 January 2002 08:29 am, you wrote: > > > Has anybody had success with this recruiter? > > > > > > Cazy Green > > > Greythorn Inc. > > > 40 Lake Bellevue > > > Suite 100 > > > Bellevue, WA 98005 > > > cazy.green@... > > > > > > He's always looking for somebody with Perl skills on a > > > particular job board, in fact in one of his ads he > > > recently states, "I need 12 Perl GURU's". Yet, when I > > > call him up, he use stalling tactics or doesn't even > > > take your number to return your call, you have to call > > > him. After calling him several times, I said f#$k > > > this, he ain't looking for nobody. > > > > > > Someday, I'm thinking of just sending him a real hyped > > > up resume, that has no value. > > > > > > Anyway, if anybody has dealt with this recruiter and > > > has had success, please let me know, maybe I'm wrong > > > about him. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Wed Jan 9 16:10:45 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? Message-ID: <6D6F0541E2B1D411A75B0002A513016D0280015C@wacorpml03.wwireless.com> http://www.asynchrony.com uses an interesting method of pooling developers into projects, and splitting the cash out evenly. If SPUG were to have something similar (http://www.aspugrony.com :) and a few good sales people to push the new team, then SPUG could contend for the lion's share of Western Washington/South West Canada (and further if the client doesn't mind it) contract Perl or Perlish programming. -- Ryan -----Original Message----- From: C.J. Collier [mailto:cjcollier@sinclair.net] Sent: Wednesday, January 09, 2002 1:02 PM To: Jay Scherrer Cc: spug-list@pm.org Subject: Re: SPUG: Avoid this recruiter? Sounds great. I'll throw some hours into a project like that. Anyone else interested? C.J. On Wed, 9 Jan 2002, Jay Scherrer wrote: > An idea, > Taking advantage of all the Perl experience of the spug members. > Wouldn't it be cool if we could create a localized listing of Perl > programmers, some how connected to the spug site? What do you think? > Jay > On Wednesday 09 January 2002 10:26 am, Brian Wisti wrote: > > Okay, so it's not just me. I got a mild rejection complex talking > > to this guy a few times. Not taking down numbers, telling me that > > the client company was on a hiring hold & could I call back tomorrow > > ... > > > > I'm curious if anybody has had luck as well. > > > > Brian Wisti > > > > On Wednesday 09 January 2002 08:29 am, you wrote: > > > Has anybody had success with this recruiter? > > > > > > Cazy Green > > > Greythorn Inc. > > > 40 Lake Bellevue > > > Suite 100 > > > Bellevue, WA 98005 > > > cazy.green@... > > > > > > He's always looking for somebody with Perl skills on a particular > > > job board, in fact in one of his ads he recently states, "I need > > > 12 Perl GURU's". Yet, when I call him up, he use stalling tactics > > > or doesn't even take your number to return your call, you have to > > > call him. After calling him several times, I said f#$k > > > this, he ain't looking for nobody. > > > > > > Someday, I'm thinking of just sending him a real hyped > > > up resume, that has no value. > > > > > > Anyway, if anybody has dealt with this recruiter and > > > has had success, please let me know, maybe I'm wrong about him. > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From shamonsflame at hotmail.com Wed Jan 9 16:59:00 2002 From: shamonsflame at hotmail.com (garrett esperum) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: Hello all, I am using solaris 2.6 and perl 5.6.1. I have an external file that has multiple directory names listed in it. The directory names in this file are seperated by a tab. I want to read this external file and I want to test to see if each of these directories exists. If these directories don't exist I want to create them. If they do exist I don't want to do anything. How do I do this in PERL? How do I do the dir test? And how do I perform the loop? Thank You! -garrett _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From bjturner at mac.com Wed Jan 9 17:31:55 2002 From: bjturner at mac.com (Benjamin Turner) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create In-Reply-To: Message-ID: <1128D1CF-0559-11D6-83C5-003065552952@mac.com> On Wednesday, January 9, 2002, at 02:59 PM, garrett esperum wrote: > Hello all, > > I am using solaris 2.6 and perl 5.6.1. > I have an external file that has multiple directory names > listed in it. The directory names in this file are seperated by > a tab. I want to read this external file and I want to test to > see if each of these directories exists. If these directories > don't exist I want to create them. If they do exist I don't > want to do anything. > How do I do this in PERL? How do I do the dir test? And how do > I perform the loop? Something like this ought to do the trick (untested): my( $directory, $permissions ); local( $/ ) = "\t"; # read file as though tabs are line-endings $permissions = 0700; while ( defined( $directory = <> ) ) { chomp( $directory ); # remove tab from end of directory name, if it's present if ( not -d $directory ) { # check if directory exists (note: false if path points to a file) mkdir( $directory, $permissions ) or warn "Can't create directory '$directory': $!\n"; } } -- Benjamin John Turner | bjturner@bigfoot.com http://www.usfca.edu/turner/ | bjturner@whowhere.com "The happiest of people don't necessarily have the best of everything; they just make the most of everything that comes along their way." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From ced at carios2.ca.boeing.com Wed Jan 9 17:14:11 2002 From: ced at carios2.ca.boeing.com (ced@carios2.ca.boeing.com) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: <200201092314.PAA28382@carios2.ca.boeing.com> >I am using solaris 2.6 and perl 5.6.1. >I have an external file that has multiple directory names >listed in it. The directory names in this file are seperated >by a tab. I want to read this external file and I want to test >to see if each of these directories exists. If these directories >don't exist I want to create them. If they do exist I don't want >to do anything. How do I do this in PERL? How do I do the dir >test? And how do I perform the loop? A quick 'n dirty solution: perl -F\\t -lane '! -e $_ && mkdir $_ for @F' ext_file (slight mods needed for non-Unix) Rgds, -- Charles DeRykus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From BenB at ocentrix.com Wed Jan 9 17:48:45 2002 From: BenB at ocentrix.com (Ben Burnett) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: Hey Garret, Long time no see. Read through the comments in the attached script and then give it a try. --- Ben Burnett Information Architect Ocentrix 220 W Mercer St. #200 Seattle, Wa 98119 Phone: 206.625.9393 Direct: 206.691.7602 Fax: 206.625.1890 > -----Original Message----- > From: garrett esperum [mailto:shamonsflame@hotmail.com] > Sent: Wednesday, January 09, 2002 2:59 PM > To: spug-list@pm.org > Subject: SPUG: test directory and then create > > > Hello all, > > I am using solaris 2.6 and perl 5.6.1. > I have an external file that has multiple directory names > listed in it. The > directory names in this file are seperated by a tab. I want > to read this > external file and I want to test to see if each of these > directories exists. > If these directories don't exist I want to create them. If > they do exist I > don't want to do anything. > How do I do this in PERL? How do I do the dir test? And how > do I perform the > loop? > > Thank You! > > -garrett > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From BenB at ocentrix.com Wed Jan 9 17:51:46 2002 From: BenB at ocentrix.com (Ben Burnett) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: Sorry about the missing attachment. Hey Garret, Long time no see. Read through the comments in the attached script and then give it a try. --- Ben Burnett Information Architect Ocentrix 220 W Mercer St. #200 Seattle, Wa 98119 Phone: 206.625.9393 Direct: 206.691.7602 Fax: 206.625.1890 > -----Original Message----- > From: garrett esperum [mailto:shamonsflame@hotmail.com] > Sent: Wednesday, January 09, 2002 2:59 PM > To: spug-list@pm.org > Subject: SPUG: test directory and then create > > > Hello all, > > I am using solaris 2.6 and perl 5.6.1. > I have an external file that has multiple directory names > listed in it. The > directory names in this file are seperated by a tab. I want > to read this > external file and I want to test to see if each of these > directories exists. > If these directories don't exist I want to create them. If > they do exist I > don't want to do anything. > How do I do this in PERL? How do I do the dir test? And how > do I perform the > loop? > > Thank You! > > -garrett > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ -------------- next part -------------- A non-text attachment was scrubbed... Name: dirtester-maker.pl Type: application/octet-stream Size: 868 bytes Desc: dirtester-maker.pl Url : http://mail.pm.org/archives/spug-list/attachments/20020109/39b133dd/dirtester-maker.obj From shamonsflame at hotmail.com Wed Jan 9 18:06:49 2002 From: shamonsflame at hotmail.com (garrett esperum) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: Thanks For you help! I tried your example and it almost did the job. It successfully open and reads the external file. However it is not able to create any of the directories. This is the error message I recieve for the directory path one/two/three": "Can't create directory: 'one/two/three No such file or directory." -garrett >From: Benjamin Turner >Reply-To: Benjamin Turner >To: "garrett esperum" >CC: spug-list@pm.org >Subject: Re: SPUG: test directory and then create >Date: Wed, 9 Jan 2002 15:31:55 -0800 > > >On Wednesday, January 9, 2002, at 02:59 PM, garrett esperum wrote: > >>Hello all, >> >>I am using solaris 2.6 and perl 5.6.1. >>I have an external file that has multiple directory names >>listed in it. The directory names in this file are seperated by >>a tab. I want to read this external file and I want to test to >>see if each of these directories exists. If these directories >>don't exist I want to create them. If they do exist I don't >>want to do anything. >>How do I do this in PERL? How do I do the dir test? And how do >>I perform the loop? > > Something like this ought to do the trick (untested): > > >my( $directory, $permissions ); > >local( $/ ) = "\t"; # read file as >though tabs are line-endings > >$permissions = 0700; > >while ( defined( $directory = <> ) ) { > chomp( $directory ); # remove tab from end of >directory name, if it's present > if ( not -d $directory ) { # check if directory exists >(note: false if path points to a file) > mkdir( $directory, $permissions ) or warn "Can't >create directory '$directory': $!\n"; > } >} > > >-- >Benjamin John Turner | bjturner@bigfoot.com >http://www.usfca.edu/turner/ | bjturner@whowhere.com > >"The happiest of people don't necessarily have the best of >everything; they just make the most of everything that comes >along their way." > _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Daniel.Pommert at verizonwireless.com Wed Jan 9 18:25:59 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create Message-ID: <9B30436F511ED5118EDF0002A55C31800119D84C@cairvexmb03.la.airtouch.com> Try: perl -MFile::Path -ane 'mkpath($_, 0, 0755) foreach @F' < list_of_directories -----Original Message----- From: garrett esperum [mailto:shamonsflame@hotmail.com] Sent: Wednesday, January 09, 2002 2:59 PM To: Subject: SPUG: test directory and then create Hello all, I am using solaris 2.6 and perl 5.6.1. I have an external file that has multiple directory names listed in it. The directory names in this file are seperated by a tab. I want to read this external file and I want to test to see if each of these directories exists. If these directories don't exist I want to create them. If they do exist I don't want to do anything. How do I do this in PERL? How do I do the dir test? And how do I perform the loop? Thank You! -garrett _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cjcollier at sinclair.net Wed Jan 9 18:46:31 2002 From: cjcollier at sinclair.net (C.J. Collier) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create In-Reply-To: Message-ID: #I'm assuming this format for the file. #(No newlines, just directories separated by tabs) #---- Example File ---- thisdir/thisfile thatfile theotherdir/andfile yad/yaf stillanother/stillanother Andonemore #---- End Example File ---- #-- start perl code -- #!/usr/bin/perl -w use strict; #open the file and associate a file handle with it open DIRLIST, "external_file.txt"; #get a line from the filehandle and stick it in the $dirs scalar my $dirs = #split the directory list string on tabs and stick it in the @dir array my @dir = split(/\t/, $dirs); #iterate over the directories in the list and try to create them foreach my $dir (@dir){ #test $dir to see if it's a directory if(-d $dir){ print "Directory $dir already exists. Not creating.\n"; }else{ if(mkdir($dir)){ print "Created directory $dir\n"; }else{ print "Could not create directory $dir: $!\n"; } } } #-- end perl code -- For questions like this, I suggest talking to the perl beginners' list (beginners@perl.org), although I always love writing up this kind of thing. IRC is also a good place. #perl on irc.openprojects.net is a friendly environment for beginners. Cheers, C.J. On Wed, 9 Jan 2002, garrett esperum wrote: > Hello all, > > I am using solaris 2.6 and perl 5.6.1. > I have an external file that has multiple directory names listed in it. The > directory names in this file are seperated by a tab. I want to read this > external file and I want to test to see if each of these directories exists. > If these directories don't exist I want to create them. If they do exist I > don't want to do anything. > How do I do this in PERL? How do I do the dir test? And how do I perform the > loop? > > Thank You! > > -garrett > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From MichaelRunningWolf at att.net Wed Jan 9 19:13:44 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D0280015C@wacorpml03.wwireless.com> References: <6D6F0541E2B1D411A75B0002A513016D0280015C@wacorpml03.wwireless.com> Message-ID: "Parr, Ryan" writes: > If SPUG were to have something similar > (http://www.aspugrony.com :) and a few good sales people ^^^^^^^^^ I'm sure the marketing department will have to approve this!!! Sounds like an illegal act. You want to get _paid_ for it? Hey, dreams are free!!! 8-) -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Wed Jan 9 19:27:37 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: test directory and then create In-Reply-To: References: Message-ID: <53220000.1010626057@benzene> -- garrett esperum spake thusly: > Thanks For you help! I tried your example and it almost did the job. > It successfully open and reads the external file. However it is not > able to create any of the directories. This is the error message I > recieve for the directory path one/two/three": > > "Can't create directory: 'one/two/three No such file or directory." This is because mkdir won't create parent directories. mkpath (from File::Path), however, will. So you need a 'use File::Path' at the top, and you need to change that mkdir to mkpath. Actually, you should change it to 'mkpath $directory, undef, 0777 ^ umask', and get rid of the $permissions variable. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020109/8535255b/attachment.bin From humbaba9 at yahoo.com Thu Jan 10 00:23:42 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: <20020109162921.80908.qmail@web21002.mail.yahoo.com> Message-ID: <20020110062342.79792.qmail@web12802.mail.yahoo.com> 1/9/02 Ha ha ha, yep, he's got me too! I responded to an ad way back in the beginning of November (or was it mid-October?). Each week asked me to phone next week when he would have an interview date for me. Each week I called. IF, I could reach him, he would say, "I'll try to get in touch with my client. If I don't call you back later today, call me next week." In Mid-December he told me that the positions were being postponed till January. On January 3rd HE called ME!!!! Same story. I've had to call several times before I reach him and it's always "If I don't call you back later today, call me again next week." I've left messages twice this week. Meryll Larkin (desperate) Web Developer - Perl Programmer http://www.alwanza.com --- c k wrote: > Has anybody had success with this recruiter? > > Cazy Green > Greythorn Inc. > 40 Lake Bellevue > Suite 100 > Bellevue, WA 98005 > cazy.green@... > > He's always looking for somebody with Perl skills on > a > particular job board, in fact in one of his ads he > recently states, "I need 12 Perl GURU's". Yet, when > I > call him up, he use stalling tactics or doesn't even > take your number to return your call, you have to > call > him. After calling him several times, I said f#$k > this, he ain't looking for nobody. > > Someday, I'm thinking of just sending him a real > hyped > up resume, that has no value. > > Anyway, if anybody has dealt with this recruiter and > has had success, please let me know, maybe I'm wrong > about him. > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From otter101 at hotmail.com Thu Jan 10 08:22:20 2002 From: otter101 at hotmail.com (Steve Cartoon) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? Message-ID: G'day! I was able to contact this guy yesterday. He told me the location of the jobs were in Seattle and BALLARD, not BELLINGHAM. Sheesh. Perl/Web development jobs (or indeed any sort of computing jobs) are apparently non-existent in Skagit or Whatcom Counties, so this lead turned out to be a really big disappointment. But giving out disappointment would appear to be this guy's main pleasure...I really hate 'technical recruiters'...most of them don't have a fraction of our knowledge and probably use O'Reilly books to prop up their tables or boost up their flowerpots... Anyways, just wanted to let you lot know that he gave me a different job location area... Be seeing you... Steve Cartoon Concrete, WA >From: Meryll Larkin >To: c k , spug-list@pm.org >Subject: Re: SPUG: Avoid this recruiter? >Date: Wed, 9 Jan 2002 22:23:42 -0800 (PST) > >1/9/02 > >Ha ha ha, yep, he's got me too! I responded to an ad >way back in the beginning of November (or was it >mid-October?). Each week asked me to phone next week >when he would have an interview date for me. Each >week I called. IF, I could reach him, he would say, >"I'll try to get in touch with my client. If I don't >call you back later today, call me next week." In >Mid-December he told me that the positions were being >postponed till January. > >On January 3rd HE called ME!!!! Same story. I've had >to call several times before I reach him and it's >always "If I don't call you back later today, call me >again next week." I've left messages twice this week. > >Meryll Larkin >(desperate) Web Developer - Perl Programmer >http://www.alwanza.com > >--- c k wrote: > > Has anybody had success with this recruiter? > > > > Cazy Green > > Greythorn Inc. > > 40 Lake Bellevue > > Suite 100 > > Bellevue, WA 98005 > > cazy.green@... > > > > He's always looking for somebody with Perl skills on > > a > > particular job board, in fact in one of his ads he > > recently states, "I need 12 Perl GURU's". Yet, when > > I > > call him up, he use stalling tactics or doesn't even > > take your number to return your call, you have to > > call > > him. After calling him several times, I said f#$k > > this, he ain't looking for nobody. > > > > Someday, I'm thinking of just sending him a real > > hyped > > up resume, that has no value. > > > > Anyway, if anybody has dealt with this recruiter and > > has had success, please let me know, maybe I'm wrong > > about him. > > > > __________________________________________________ > > Do You Yahoo!? > > Send FREE video emails in Yahoo! Mail! > > http://promo.yahoo.com/videomail/ > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: > > ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL > > by your Email-address > > For daily traffic, use spug-list for LIST ; for > > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > > http://zipcon.net/spug/ > > > > > > >__________________________________________________ >Do You Yahoo!? >Send FREE video emails in Yahoo! Mail! >http://promo.yahoo.com/videomail/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > "Where am I?" "Well, you can't get there from here." "But I'm looking for the same old place!" "Oh, you must mean the old Same place. It's right out back." _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From MichaelRunningWolf at att.net Thu Jan 10 11:24:21 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: complementary skills [was: Avoid this recruiter?] In-Reply-To: References: Message-ID: "Steve Cartoon" writes: [...] > most of them don't have a fraction of our knowledge and > probably use O'Reilly books to prop up their tables or > boost up their flowerpots... Be fair! Knowledge is not 1-dimensional. There are many kinds of knowledge, many kinds of skills. It's no more necessary for a poultry farmer to lay an egg than it is for a technical recruiter to optomize recursive decent parsers. Of course the farmer needs to know *about* eggs and the recruiter needs to know *about* software. The important point is that the farmer or recruiter be able to work with the other members of the team to produce the desired result. It's a symbiotic, complementary relationship. Developer skills should complement recruiter skills. If they're identical, one of them is redundant (and probably unnecessary unless it's a fault-tolerant system). -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From andrew at sweger.net Thu Jan 10 12:13:31 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Avoid this recruiter? In-Reply-To: Message-ID: Gee. I hope there aren't any technical recruiters subscribed to this list (for any prospective employers you may be considering). (Well, in fact, there are. Surprisingly savvy ones at that. But we won't name names. :) On Thu, 10 Jan 2002, Steve Cartoon wrote: > G'day! > I was able to contact this guy yesterday. He told me the location of the > jobs were in Seattle and BALLARD, not BELLINGHAM. > Sheesh. Perl/Web development jobs (or indeed any sort of computing jobs) > are apparently non-existent in Skagit or Whatcom Counties, so this lead > turned out to be a really big disappointment. > But giving out disappointment would appear to be this guy's main > pleasure...I really hate 'technical recruiters'...most of them don't have a > fraction of our knowledge and probably use O'Reilly books to prop up their > tables or boost up their flowerpots... > Anyways, just wanted to let you lot know that he gave me a different job > location area... -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From shamonsflame at hotmail.com Thu Jan 10 13:42:29 2002 From: shamonsflame at hotmail.com (garrett esperum) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: A more complicated question Message-ID: Ok, here is a little harder question. My environment: solaris 2.6 perl 5.6.1 Descriptions of the files I am working with: 1) a meta-data text file 2) a creation.pl file The meta-data file contains information about multiple data files. There are hundreds of rows with six columns each in the meta-data file. Each file has it's own row of meta information. A rows column is as follows: Column 1 = file name Column 2 = file type Column 3 = file location Column 4 = file owner Column 5 = file permissions Column 6 = currently unused optional column These columns are seperated by a single tab. Example row: foo.html html /one/two/three/four haxor 0755 I want to execute the creation.pl file to read the meta-data file and create a "mirrored file environment" from the meta-data information. I need help with the following tasks: 1) How do I process each column of every row? How do I grab one row, split it up at every tab, and copy the correct file into it's correct directory with its correct permissions? 2) How do I create variables for each piece of the split row? Like how do I create a variable for the directory path column and then go and create that directory path from that variable if it doesn't already exist? You all have been very helpful! Thank You! -garrett _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Daniel.Pommert at verizonwireless.com Thu Jan 10 16:22:26 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: A more complicated question Message-ID: <9B30436F511ED5118EDF0002A55C31800119D851@cairvexmb03.la.airtouch.com> This is still simple enough that I would just do a one-liner: perl -MFile::Path -MFile::Copy -F/\t/ -ane 'BEGIN{$FROM="/here";$TO="/there"} mkpath("$TO/$F[2]", 0, $F[4]); copy("$FROM/$F[2]/$F[0]", "$TO/$F[2]/$F[0]")' < meta_data OK. This is getting a little ugly for on line. The equivalent Perl program is: #!/usr/local/bin/perl -w use strict; use "File::Path"; use "File::Copy"; my $FROM="/here"; my $TO="/there"; while(<>){ @F = split(/\t/); mkpath("$TO/$F[2], 0, $F[4]); copy("$FROM/$F[2]/$F[0]", "$TO/$F[2]/$F[0]"); } Of course, change "/here" and "/there" appropriately. -- Daniel Pommert -----Original Message----- From: garrett esperum [mailto:shamonsflame@hotmail.com] Sent: Thursday, January 10, 2002 11:42 AM To: spug-list@pm.org Subject: SPUG: A more complicated question Ok, here is a little harder question. My environment: solaris 2.6 perl 5.6.1 Descriptions of the files I am working with: 1) a meta-data text file 2) a creation.pl file The meta-data file contains information about multiple data files. There are hundreds of rows with six columns each in the meta-data file. Each file has it's own row of meta information. A rows column is as follows: Column 1 = file name Column 2 = file type Column 3 = file location Column 4 = file owner Column 5 = file permissions Column 6 = currently unused optional column These columns are seperated by a single tab. Example row: foo.html html /one/two/three/four haxor 0755 I want to execute the creation.pl file to read the meta-data file and create a "mirrored file environment" from the meta-data information. I need help with the following tasks: 1) How do I process each column of every row? How do I grab one row, split it up at every tab, and copy the correct file into it's correct directory with its correct permissions? 2) How do I create variables for each piece of the split row? Like how do I create a variable for the directory path column and then go and create that directory path from that variable if it doesn't already exist? You all have been very helpful! Thank You! -garrett _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mcglk at artlogix.com Thu Jan 10 18:02:40 2002 From: mcglk at artlogix.com (Ken McGlothlen) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: A more complicated question In-Reply-To: References: Message-ID: <87sn9dzrdr.fsf@ralf.artlogix.com> "garrett esperum" writes: | The meta-data file contains information about multiple data files. There are | hundreds of rows with six columns each in the meta-data file. Each file has | it's own row of meta information. A rows column is as follows: | | Column 1 = file name | Column 2 = file type | Column 3 = file location | Column 4 = file owner | Column 5 = file permissions | Column 6 = currently unused optional column | | These columns are seperated by a single tab. [...] | I want to execute the creation.pl file to read the meta-data file and create | a "mirrored file environment" from the meta-data information. I need help | with the following tasks: | | 1) How do I process each column of every row? How do I grab one row, split it | up at every tab, and copy the correct file into it's correct directory with | its correct permissions? use File::Copy; open( F, "metadata.yabble" ); while( ) { chomp; my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); copy( $fn, $floc ); chmod( $fperm, "$floc/$fn" ); } close( F ); | 2) How do I create variables for each piece of the split row? Already answered above. | Like how do I create a variable for the directory path column and then go and | create that directory path from that variable if it doesn't already exist? use File::Copy; use File::Path; open( F, "metadata.yabble" ); while( ) { chomp; my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); mkpath( $floc ) unless( -d $floc ); copy( $fn, $floc ); chmod( $fperm, "$floc/$fn" ); } close( F ); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From asimjalis at yahoo.com Thu Jan 10 19:30:02 2002 From: asimjalis at yahoo.com (Asim Jalis) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Question About YAML In-Reply-To: Message-ID: <20020111013002.1136.qmail@web14206.mail.yahoo.com> Is there a Python implementation of YAML? Are there other similar non-XML data representation languages? Asim __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From wardk at wardk.org Thu Jan 10 20:37:54 2002 From: wardk at wardk.org (Ward Kaatz) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: A more complicated question In-Reply-To: <87sn9dzrdr.fsf@ralf.artlogix.com>; from mcglk@artlogix.com on Thu, Jan 10, 2002 at 04:02:40PM -0800 References: <87sn9dzrdr.fsf@ralf.artlogix.com> Message-ID: <20020110183754.A51887@wardk.org> Randal Schwartz also solved this problem in the Linux Magazine I picked up last night (Jan 2002). I am pretty sure his homepage has links to all the articles and code that he publishes on paper. worth a look. stonehenge.com On Thu, Jan 10, 2002 at 04:02:40PM -0800, Ken McGlothlen wrote: > "garrett esperum" writes: > > | The meta-data file contains information about multiple data files. There are > | hundreds of rows with six columns each in the meta-data file. Each file has > | it's own row of meta information. A rows column is as follows: > | > | Column 1 = file name > | Column 2 = file type > | Column 3 = file location > | Column 4 = file owner > | Column 5 = file permissions > | Column 6 = currently unused optional column > | > | These columns are seperated by a single tab. [...] > | I want to execute the creation.pl file to read the meta-data file and create > | a "mirrored file environment" from the meta-data information. I need help > | with the following tasks: > | > | 1) How do I process each column of every row? How do I grab one row, split it > | up at every tab, and copy the correct file into it's correct directory with > | its correct permissions? > > use File::Copy; > > open( F, "metadata.yabble" ); > while( ) { > chomp; > my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); > copy( $fn, $floc ); > chmod( $fperm, "$floc/$fn" ); > } > close( F ); > > | 2) How do I create variables for each piece of the split row? > > Already answered above. > > | Like how do I create a variable for the directory path column and then go and > | create that directory path from that variable if it doesn't already exist? > > use File::Copy; > use File::Path; > > open( F, "metadata.yabble" ); > while( ) { > chomp; > my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); > mkpath( $floc ) unless( -d $floc ); > copy( $fn, $floc ); > chmod( $fperm, "$floc/$fn" ); > } > close( F ); > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Daniel.Pommert at verizonwireless.com Fri Jan 11 10:39:19 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: A more complicated question Message-ID: <9B30436F511ED5118EDF0002A55C31800119D855@cairvexmb03.la.airtouch.com> Ken is right. My solution, posted earlier, lacked the chmod command on the file. (It also lacked a closing quote, but that was obvious...) Also, I should have made a better choice about directory permissions than using the file's permission. Garrett, this is a point in which your problem is under-specified. Your meta-data file does not say what the directory permissions should be. Perhaps your umask() is the best choice. -- Daniel Pommert Verizon Wireless -----Original Message----- From: Ken McGlothlen [mailto:mcglk@artlogix.com] Sent: Thursday, January 10, 2002 4:03 PM To: garrett esperum Cc: spug-list@pm.org Subject: Re: SPUG: A more complicated question "garrett esperum" writes: | The meta-data file contains information about multiple data files. There are | hundreds of rows with six columns each in the meta-data file. Each file has | it's own row of meta information. A rows column is as follows: | | Column 1 = file name | Column 2 = file type | Column 3 = file location | Column 4 = file owner | Column 5 = file permissions | Column 6 = currently unused optional column | | These columns are seperated by a single tab. [...] | I want to execute the creation.pl file to read the meta-data file and create | a "mirrored file environment" from the meta-data information. I need help | with the following tasks: | | 1) How do I process each column of every row? How do I grab one row, split it | up at every tab, and copy the correct file into it's correct directory with | its correct permissions? use File::Copy; open( F, "metadata.yabble" ); while( ) { chomp; my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); copy( $fn, $floc ); chmod( $fperm, "$floc/$fn" ); } close( F ); | 2) How do I create variables for each piece of the split row? Already answered above. | Like how do I create a variable for the directory path column and then go and | create that directory path from that variable if it doesn't already exist? use File::Copy; use File::Path; open( F, "metadata.yabble" ); while( ) { chomp; my( $fn, $ftype, $floc, $fown, $fperm, $optional ) = split( /\t/ ); mkpath( $floc ) unless( -d $floc ); copy( $fn, $floc ); chmod( $fperm, "$floc/$fn" ); } close( F ); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Samantha at evolvingearth.org Fri Jan 11 16:14:05 2002 From: Samantha at evolvingearth.org (Samantha) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems Message-ID: Hi there - I am posting this question for a new member that keeps getting her e-mail bounced back. Hopefully this will work. Please reply to her and not me. :) Thanks, Samantha Message: I'm new to the group here (actually I think I belonged some time ago) and wanted to first say hello. My question is this - I have a script that utilizes a mysql database for variables. Based on certain criteria, variables are picked and then placed into a url. My next step is to figure out how to make my script "invisibly" go to that generated url then grab and save the resulting page. What sort of coding do I use for this sort of thing? I confess to being perl stupid :) and appreciate any help that I can get. Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Fri Jan 11 16:51:40 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:32 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: References: Message-ID: <20020111145139.A11974@hobart.helvella.org> Hi Susanne, On Fri, Jan 11, 2002 at 02:14:05PM -0800, Samantha wrote: > I'm new to the group here (actually I think I belonged some time ago) and > wanted to first say hello. > > My question is this - I have a script that utilizes a mysql database for > variables. Based on certain criteria, variables are picked and then placed > into a url. My next step is to figure out how to make my script "invisibly" > go to that generated url then grab and save the resulting page. What sort > of coding do I use for this sort of thing? Assuming that you are using CGI.pm and have the resulting generated url stored in a variable called $url, then redirecting the browser is as simple as: # $cgi contains the CGI query object # this should come before you have printed anything out print $cgi->redirect($url); > > I confess to being perl stupid :) and appreciate any help that I can get. If you are writing your own code and have figured out how to read values for variables from mysql, that is quite a task. If you are modifying some existing code to fit your needs, that is a great way to learn also. It is often easier to help out if you post an excerpt of the code you are working on. Have fun, -C. > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Fri Jan 11 16:54:44 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: <20020111145139.A11974@hobart.helvella.org> Message-ID: what do you mean by ""invisibly" go to that url and grab and save the resulting page"? Colin's solution would just send the user (assuming it's a cgi script, and there is a user) to that generated url. If you're just trying to fetch the url from your script and save it somewhere, use LWP. see the perldoc for how to use it, it's pretty easy. On Fri, 11 Jan 2002, Colin Meyer wrote: > Hi Susanne, > > On Fri, Jan 11, 2002 at 02:14:05PM -0800, Samantha wrote: > > I'm new to the group here (actually I think I belonged some time ago) and > > wanted to first say hello. > > > > My question is this - I have a script that utilizes a mysql database for > > variables. Based on certain criteria, variables are picked and then placed > > into a url. My next step is to figure out how to make my script "invisibly" > > go to that generated url then grab and save the resulting page. What sort > > of coding do I use for this sort of thing? > > Assuming that you are using CGI.pm and have the resulting generated url > stored in a variable called $url, then redirecting the browser is as > simple as: > > # $cgi contains the CGI query object > > # this should come before you have printed anything out > print $cgi->redirect($url); > > > > > > I confess to being perl stupid :) and appreciate any help that I can get. > > If you are writing your own code and have figured out how to read values > for variables from mysql, that is quite a task. If you are modifying > some existing code to fit your needs, that is a great way to learn also. > > It is often easier to help out if you post an excerpt of the code you are > working on. > > Have fun, > -C. > > > > > Susanne Bullo - Sweet Homes > > > > DirectTV DSL > > Get Paid to Read Email! > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mcglk at artlogix.com Fri Jan 11 17:00:53 2002 From: mcglk at artlogix.com (Ken McGlothlen) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: A more complicated question In-Reply-To: <9B30436F511ED5118EDF0002A55C31800119D855@cairvexmb03.la.airtouch.com> References: <9B30436F511ED5118EDF0002A55C31800119D855@cairvexmb03.la.airtouch.com> Message-ID: <87bsg0wl0a.fsf@ralf.artlogix.com> "Pommert, Daniel" writes: | Ken is right. Ooo. Say that again. I hear it so rarely. :) | Also, I should have made a better choice about directory permissions than | using the file's permission. Garrett, this is a point in which your problem | is under-specified. Your meta-data file does not say what the directory | permissions should be. Perhaps your umask() is the best choice. Yeah, there is that. I'd considered adding something like my $dirperm = $fperm | 0111; but that was outside the scope of the original problem. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Fri Jan 11 17:47:52 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: Message-ID: Ok, thanks to you all I am using LWP::UserAgent and have it almost working :) Here's the error I see when I try testing it: Can't locate object method "method" via package "http://www.howto-workathome.com/cgi-bin/safelist/members.cgi?action=Send This Message&username=rocksolid&password=onesite&subject=This is a fifth test&message=www.sweethomes.com www.sweethome s.com www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com " at /usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line 163. Issuing rollback() for database handle being DESTROY'd without explicit disconnect(). Here is what I have for my code (don't laugh, it's my first official conglomeration for a script): #!/usr/bin/perl use Time::Local; use POSIX qw(mktime); use DBI; use LWP::UserAgent; &get_date; sub get_date { @days = ('Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d",$hour,$min); if ($year < 50){ $year += 2000; } else { $year += 1900; } $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = $mon + 1; $date2 = "$mon2/$mday/$year"; } my $buffer = ''; my $buffer2 = ''; my $buffer3 = ''; my $buffer4 = ''; my $buffer5 = ''; my $host = 'localhost'; my $database = 'safelist'; my $username = 'admin'; my $password = 'srb6653'; my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die "Failed DBI connect(): $!\n"; my $query = "SELECT safelists.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, safelists.uid, members.email from safelists, schedule, email_txt, members where email_txt.id = schedule.SUN and schedule.system_name = safelists.system_name and members.id = safelists.uid and email_txt.email_subject != ''"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u id,$email) = $sth->fetchrow_array) { $ua = new LWP::UserAgent; my $url = "http://$email_to?action=Send This Message&username=$username&password=$password&subject=$email_subject&message =$email_text"; my $file_path = './members/data/$username.$date.$time.txt'; $ua->request($url, $file_path); my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, schedule where schedule.system_name = safelists.system_name and schedule.SUN != '0'"; $buffer2 .= "===> Executing Query: $query2\n\n"; my $sth = $dbh->prepare($query2); my $rc = $sth->execute(); while (my($uid,$system_name) = $sth->fetchrow_array) { my $datestamp = $date2; my $timestamp = $time; my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; $buffer3 .= "===> Executing Query: $query3\n\n"; my $sth = $dbh->prepare($query3); my $rc = $sth->execute(); } } $dbh->disconnect; 0; Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From nelson at vericel.com Fri Jan 11 18:01:48 2002 From: nelson at vericel.com (Nelson G. Arzola) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: Message-ID: Samantha, You want to look at the LWP modules. There is an Agent and a Robot subclass that will do what you want. Nelson On Fri, 11 Jan 2002, Samantha wrote: > Date: Fri, 11 Jan 2002 14:14:05 -0800 > From: Samantha > To: spug-list@pm.org > Cc: sweetsue@sweethomes.com > Subject: SPUG: Posting a question for someone with e-mail bounce problems > > Hi there - > > I am posting this question for a new member that keeps getting her e-mail > bounced back. Hopefully this will work. Please reply to her and not me. :) > > Thanks, Samantha > > > > Message: > > I'm new to the group here (actually I think I belonged some time ago) and > wanted to first say hello. > > My question is this - I have a script that utilizes a mysql database for > variables. Based on certain criteria, variables are picked and then placed > into a url. My next step is to figure out how to make my script "invisibly" > go to that generated url then grab and save the resulting page. What sort > of coding do I use for this sort of thing? > > I confess to being perl stupid :) and appreciate any help that I can get. > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From dcd at tc.fluke.com Fri Jan 11 18:23:19 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: Message-ID: On Fri, 11 Jan 2002 at 15:47 -0800, Susanne Bullo ...: > Can't locate object method "method" via package > "http://www.howto-workathome.com/cgi-bin/safelist/members.cgi?action=Send > This Message&username=rocksolid&password=onesite&subject=This is a fifth > test&message=www.sweethomes.com www.sweethome > s.com www.sweethomes.com www.sweethomes.com www.sweethomes.com > www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com > www.sweethomes.com " at /usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line > 163. Well, there is an lwp mailing list libwww@perl.org Did you ask there yet? Second, I'd ask about the class name that is being printed as the package - looks suspicious to me are you sure you are calling it with the right parameters? It looks like you are calling $ua->request($url, $file_path); where $ua = new LWP::UserAgent; from LWP::UserAgent: The C<$request> should be a reference to a C object with values defined for at least the method() and uri() attributes. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Fri Jan 11 18:40:15 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: Message-ID: like anything in perl, there's a bunch of ways to go about doing this, but closest to what you're trying to do right now, would be to change what you have to reflect the below.. # you need these modules use LWP::UserAgent; use HTTP::Request; use HTTP::Response; # You should create your user agent outside of the loop and reuse it. my $ua = new LWP::UserAgent(); # your loop while (whatever) { # create the request with your pre-built url my $req = HTTP::Request->new(GET=>$theurl); # do the request and get the response my $resp = $ua->request($req); # make sure you got an okay response from the server if ($resp->is_success()) { my $content = $resp->content; # do whatever you want with the content } else { # there was a server error } } On Fri, 11 Jan 2002, Susanne Bullo wrote: > Ok, thanks to you all I am using LWP::UserAgent and have it almost working > :) Here's the error I see when I try testing it: > > Can't locate object method "method" via package > "http://www.howto-workathome.com/cgi-bin/safelist/members.cgi?action=Send > This Message&username=rocksolid&password=onesite&subject=This is a fifth > test&message=www.sweethomes.com www.sweethome > s.com www.sweethomes.com www.sweethomes.com www.sweethomes.com > www.sweethomes.com www.sweethomes.com www.sweethomes.com www.sweethomes.com > www.sweethomes.com " at /usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line > 163. > Issuing rollback() for database handle being DESTROY'd without explicit > disconnect(). > > Here is what I have for my code (don't laugh, it's my first official > conglomeration for a script): > > #!/usr/bin/perl > use Time::Local; > use POSIX qw(mktime); > use DBI; > use LWP::UserAgent; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > 'Thursday','Friday','Saturday'); > @months = ('January','February','March','April','May','June','July', > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > $year += 2000; > } > else { > $year += 1900; > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > $mon2 = $mon + 1; > $date2 = "$mon2/$mday/$year"; > } > > my $buffer = ''; > my $buffer2 = ''; > my $buffer3 = ''; > my $buffer4 = ''; > my $buffer5 = ''; > my $host = 'localhost'; > my $database = 'safelist'; > my $username = 'admin'; > my $password = 'srb6653'; > > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > safelists.password, email_txt.email_subject, email_txt.email_text, > safelists.uid, members.email from safelists, schedule, email_txt, members > where email_txt.id = schedule.SUN and schedule.system_name = > safelists.system_name and members.id = safelists.uid and > email_txt.email_subject != ''"; > $buffer .= "===> Executing Query: $query\n\n"; > my $sth = $dbh->prepare($query); > my $rc = $sth->execute(); > > while > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > id,$email) = $sth->fetchrow_array) { > > $ua = new LWP::UserAgent; > > my $url = "http://$email_to?action=Send This > Message&username=$username&password=$password&subject=$email_subject&message > =$email_text"; > my $file_path = './members/data/$username.$date.$time.txt'; > $ua->request($url, $file_path); > > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > schedule where schedule.system_name = safelists.system_name and schedule.SUN > != '0'"; > $buffer2 .= "===> Executing Query: $query2\n\n"; > my $sth = $dbh->prepare($query2); > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > my $timestamp = $time; > > my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) > values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; > $buffer3 .= "===> Executing Query: $query3\n\n"; > my $sth = $dbh->prepare($query3); > my $rc = $sth->execute(); > > } > } > > $dbh->disconnect; > 0; > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Fri Jan 11 19:17:29 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Posting a question for someone with e-mail bounce problems In-Reply-To: Message-ID: This did the trick! Thank you so much. This group is great and I have no clue why I left it to begin with :) Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! -----Original Message----- From: Daryn Nakhuda [mailto:daryn@marinated.org] Sent: Friday, January 11, 2002 4:40 PM To: Susanne Bullo Cc: spug-list@pm.org Subject: RE: SPUG: Posting a question for someone with e-mail bounce problems like anything in perl, there's a bunch of ways to go about doing this, but closest to what you're trying to do right now, would be to change what you have to reflect the below.. # you need these modules use LWP::UserAgent; use HTTP::Request; use HTTP::Response; # You should create your user agent outside of the loop and reuse it. my $ua = new LWP::UserAgent(); # your loop while (whatever) { # create the request with your pre-built url my $req = HTTP::Request->new(GET=>$theurl); # do the request and get the response my $resp = $ua->request($req); # make sure you got an okay response from the server if ($resp->is_success()) { my $content = $resp->content; # do whatever you want with the content } else { # there was a server error } } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From iwebmaster at iwww.net Sat Jan 12 03:57:44 2002 From: iwebmaster at iwww.net (=?ks_c_5601-1987?B?vsbAzLX7tfu1+w==?=) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: =?ks_c_5601-1987?B?W8irurhdILPXxrzB8MDMILi4tecgsMu79r+jwfggvsbAzLX7tfu1+8DUtM+02S4=?= Message-ID: <200201120959.g0C9xA608459@mail.pm.org> ???? ????? ????? ?? ??? ? ??? ???? ????? ????. ??? ?????? ??? ?? ??? ??? ?? ?? ??? ??? ??? ?? ??? ??? ???? ??? ???? ????. ??? ?? ? ?? ?? ?? ??????? ??? ?? ??? ???? ??? ?????. ???? ??? ?? ??? ??? ??? ? ??? ???? ?? ?? ???? ?? ???, ? ??? ?? ???? ??,??,?? ????? ???. ?????? ?? ???? ???? ???? ? ??? ???????. ? ???? ?? ??? ?? ??? ???? ???? ?????????? ?????? ????? ???? ???? ?? ? ????. ???? ??? ??? ?????? ?? 1?? ???? ??? pop3 e-mail ??? ????. ("?" abc@iwww.net") ??,? ????? ??? ? ?? ??? ?? ????? ??? ???? ?????. (????? ??? ?????? login ??? ????? ?? ???? ? ????.) ????? ??? ??? ??? ? ????? ?? 1?? ???? ????. ???? ???? ???? ?????? ???? ??? ?????! http://iwww.net (?????)? ??? ??? ?????? ??? ?? ???? ???? ??? ??? ?? ???? ??? ?????? ????????. ????? ?????? ? ??? ????? ??????. ? ????? ?????~~~?????. 1? ?? ?? 774,500 hit(2002.01.07) ??? ?? ???? 745 ? ?? ????? ??? ????! ======>http://iwww.net??? ????? ????? ?????? ?????????. ( ????? = iwww ) ??? ??? ?? ???? ??? ????. ??? ??? ????? ???? ?????? ??? ??? ??? ???? ????. ????? ???,????,?????? ? ??? ???? ??????. ?????? ??? ??? ???? ??? ??? ??? ??? ???? ? ????. ????? ????? ????? ????? ?? ? ????. ???? ?? ???? ??? ???? ?????? ??????.???? ?? ??? ??? ?? ??? ?? ????? ??????!???? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020112/aa76e489/attachment.htm From sweetsue at sweethomes.com Sat Jan 12 11:24:20 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Looping problem Message-ID: Ok, so my initial problem is all figured out. Now, I believe I need a loop inside of this: my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die "Failed DBI connect(): $!\n"; my $query = "SELECT safelists.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, safelists.uid, members.email from safelists, schedule, email_txt, members where email_txt.id = schedule.SAT and schedule.system_name = safelists.system_name and members.id = safelists.uid and email_txt.email_subject != ''"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u id,$email) = $sth->fetchrow_array) { my $url = "http://$email_to?action=Send This Message&username=$username&password=$password&subject=$email_subject&message =$email_text"; $email_text =~ s/\\//g; my $req = HTTP::Request->new(GET=>$url); my $file_path = "members/data/$username/$system_name/$date3.txt"; my $resp = $ua->request($req, $file_path); my $sec_file_path = "members/data/$username"; my $outfile = "index.html"; my $filename = $sec_file_path/$outfile; open (FILE,">>$filename"); print FILE "Problem on $date3"; close (FILE); } I need a loop that will take all $system_name variables that are returned and cycle through them. I have found this: Perl While Loop Example If your SQL query will return more than one record, you will need to place the fetchrow() call in a while loop. my (@telephone); my $i = 0; my $count; while (@aRow = $sth->fetchrow()) { $telephone[$i] = @aRow[0]; $i++; } $count = $i; # @telephone can now be used to build an html table # to display all the telephone numbers in the "518" # area code. But it is a bit confusing as I'm not certain about the syntax. Thanks for putting up with me! One of these times I might be able to attend a meeting - I have three small children at home and both myself and my husband are work-a-holics so it's a bit difficult. Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020112/43fed255/attachment.htm From iwebmaster at iwww.net Mon Jan 14 08:27:26 2002 From: iwebmaster at iwww.net (=?ks_c_5601-1987?B?vsbAzLX7tfu1+w==?=) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: =?ks_c_5601-1987?B?W8irurhdILPXxrzB8MDMILi4tecgsMu79r+jwfggvsbAzLX7tfu1+8DUtM+02S4=?= Message-ID: <200201141428.g0EESV603148@mail.pm.org> ???? ????? ????? ?? ??? ? ??? ???? ????? ????. ??? ?????? ??? ?? ??? ??? ?? ?? ??? ??? ??? ?? ??? ??? ???? ??? ???? ????. ??? ?? ? ?? ?? ?? ??????? ??? ?? ??? ???? ??? ?????. ???? ??? ?? ??? ??? ??? ? ??? ???? ?? ?? ???? ?? ???, ? ??? ?? ???? ??,??,?? ????? ???. ?????? ?? ???? ???? ???? ? ??? ???????. ? ???? ?? ??? ?? ??? ???? ???? ?????????? ?????? ????? ???? ???? ?? ? ????. ???? ??? ??? ?????? ?? 1?? ???? ??? pop3 e-mail ??? ????. ("?" abc@iwww.net") ??,? ????? ??? ? ?? ??? ?? ????? ??? ???? ?????. (????? ??? ?????? login ??? ????? ?? ???? ? ????.) ????? ??? ??? ??? ? ????? ?? 1?? ???? ????. ???? ???? ???? ?????? ???? ??? ?????! http://iwww.net (?????)? ??? ??? ?????? ??? ?? ???? ???? ??? ??? ?? ???? ??? ?????? ????????. ????? ?????? ? ??? ????? ??????. ? ????? ?????~~~?????. 1? ?? ?? 774,500 hit(2002.01.13) ???? 156,550 (2002.01.13) ??? ?? ???? 785 ? ?? ????? ??? ????! ======>http://iwww.net??? ????? ????? ?????? ?????????. ( ????? = iwww ) ??? ??? ?? ???? ??? ????. ??? ??? ????? ???? ?????? ??? ??? ??? ???? ????. ????? ???,????,?????? ? ??? ???? ??????. ?????? ??? ??? ???? ??? ??? ??? ??? ???? ? ????. ????? ????? ????? ????? ?? ? ????. ???? ?? ???? ??? ???? ?????? ??????.???? ?? ??? ??? ?? ??? ?? ????? ??????!???? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020114/130003ed/attachment.htm From thasone at yahoo.com Mon Jan 14 16:24:15 2002 From: thasone at yahoo.com (c k) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: Message-ID: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Is there a way to deal with same name packages/modules/classes/objects in perl? I created a Link.pm and used that with LWP in a main script (e.g., put use Link; and use LWP; near the top). I believe my Link.pm is clashing with another module named Link.pm in LWP, because when I change my Link.pm to Lynk.pm things work fine. Besides changing my module name from Link.pm to Lynk.pm, is there another way to deal with same name packages in Perl? For example, in C you can do this, #if !defined LinkH #define LinkH some stuff ... #endif Can I do that in Perl? Is there a technique for doing that? Thanks! __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Mon Jan 14 17:05:35 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114222415.55220.qmail@web21001.mail.yahoo.com> References: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Message-ID: <20020114150535.L11974@hobart.helvella.org> On Mon, Jan 14, 2002 at 02:24:15PM -0800, c k wrote: > Is there a way to deal with same name > packages/modules/classes/objects in perl? > > I created a Link.pm and used that with LWP in a main > script (e.g., put use Link; and use LWP; near the > top). I believe my Link.pm is clashing with another > module named Link.pm in LWP, because when I change my > Link.pm to Lynk.pm things work fine. > > Besides changing my module name from Link.pm to > Lynk.pm, is there another way to deal with same name > packages in Perl? For example, in C you can do this, When using generic names for modules, I like to prefix the name with another namespace. If your module is for personal use, then you might use CK::Link. That keeps your module clear of interference from anyone else who might like the desirable name of 'Link'. (Think: HTML::Parser, XML::Parser, YAML::Parser, Perl6::Parser, CMEYER::SuperBogus::Parser). Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Mon Jan 14 17:13:45 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114222415.55220.qmail@web21001.mail.yahoo.com> References: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Message-ID: <198470000.1011050024@benzene> -- c k spake thusly: > Is there a way to deal with same name > packages/modules/classes/objects in perl? > > I created a Link.pm and used that with LWP in a main > script (e.g., put use Link; and use LWP; near the > top). I believe my Link.pm is clashing with another > module named Link.pm in LWP, because when I change my > Link.pm to Lynk.pm things work fine. > > Besides changing my module name from Link.pm to > Lynk.pm, is there another way to deal with same name > packages in Perl? For example, in C you can do this, > ># if !defined LinkH ># define LinkH > > some stuff ... > ># endif > > Can I do that in Perl? Is there a technique for doing > that? The best way to do this is just give it a different name. Fortunately, namespaces in Perl include the path, so 'package Link' is not the same as 'package LWP::Link' or 'package HTTP::URL::Link' (not that said packages exist). Just out of curiosity, is it possible that you're not putting a package declaration in your Link.pm? Does it make a difference if you switch the order of the use statements? It also might help if you gave actual error messages and code snippets. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020114/575de685/attachment.bin From cjcollier at sinclair.net Mon Jan 14 17:34:51 2002 From: cjcollier at sinclair.net (C.J. Collier) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Message-ID: You might consider calling it kc::Link (giving yourself a namespace "kc") On Mon, 14 Jan 2002, c k wrote: > Is there a way to deal with same name > packages/modules/classes/objects in perl? > > I created a Link.pm and used that with LWP in a main > script (e.g., put use Link; and use LWP; near the > top). I believe my Link.pm is clashing with another > module named Link.pm in LWP, because when I change my > Link.pm to Lynk.pm things work fine. > > Besides changing my module name from Link.pm to > Lynk.pm, is there another way to deal with same name > packages in Perl? For example, in C you can do this, > > #if !defined LinkH > #define LinkH > > some stuff ... > > #endif > > Can I do that in Perl? Is there a technique for doing > that? > > Thanks! > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From dcd at tc.fluke.com Mon Jan 14 17:29:57 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Message-ID: I asked cpan for the Link module that you guessed might be conflicting with yours. cpan> look Link Warning: Cannot look Link, don't know what it is. Try the command i /Link/ It reports that there is no Link module (there are thinks link WWW::Link, but that has a different name. Does your code try to extract the name of the class by using ref()? You also may want to start up you code in the perl debugger and type the command x \%INC and x \@INC to determine which modules are being loaded. On Mon, 14 Jan 2002 at 14:24 -0800, c k wrote: > Is there a way to deal with same name > packages/modules/classes/objects in perl? > > I created a Link.pm and used that with LWP in a main > script (e.g., put use Link; and use LWP; near the > top). I believe my Link.pm is clashing with another > module named Link.pm in LWP, because when I change my > Link.pm to Lynk.pm things work fine. > > Besides changing my module name from Link.pm to > Lynk.pm, is there another way to deal with same name > packages in Perl? For example, in C you can do this, > > #if !defined LinkH > #define LinkH > > some stuff ... > > #endif > > Can I do that in Perl? Is there a technique for doing > that? perl comes with a tool call h2ph (It may not do what you think you want, but it does defer execution via eval) if you give it input like: #if !defined LinkH #define LinkH some stuff ... #endif It creates a file like this: require '_h2ph_pre.ph'; if(!defined (defined(&LinkH) ? &LinkH : 0)) { eval 'sub LinkH () {1;}' unless defined(&LinkH); } 1; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From andrew at sweger.net Mon Jan 14 17:46:08 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114222415.55220.qmail@web21001.mail.yahoo.com> Message-ID: Well, if there is, it's not obvious. There doesn't appear to be a package name-space called 'Link' involved when using the LWP modules (nor any other modules in my base systems). Can you show us your sequence of use statements (all of them) that trigger problems and tell us what symptoms caused you to believe the modules are clashing? To answer the question on a way to deal with clashing names? Yes, there is. It's the same answer my doctor gives me when I complain about the pain of certain knee motions: don't do it. Tools to help track problems down: Data::Dumper ------------ perl -MLWP -MData::Dumper -e 'print Dumper \%INC' will give a quick list of what modules are loaded. More information can be found in perldoc Data::Dumper. Not very deep, but handy. Even more useful when combined with the following, The Perl Debugger ----------------- The 'V' command can be used to see what package variables are available in any particular name space. perl -d somescript ... DB<1> V packagename ......... You can read (and read, and read) about the Perl debugger in perldoc perldebug. Taking the time to learn and use the Perl debugger will pay dividends. There are a few front-ends for the Perl debugger that can make it a little sweeter to use, but please consider learning the real thing. Sprinkling print statements throughout a script will only take you so far when tracking down a problem, *especially* when dealing with "3rd party" modules. Being able to step into things like LWP and DBI has helped nail some of the more freaky problems in my life. Well, that and a good length of sucker rod for when you find the offending party. :) To all of you _still_ using debugging print statements, I urge you to give the Perl debugger a try. I will never go back to print statements. If you tried the Perl debugger and went back to print statements, speak up. I'd be curious to know what problems folks ran into (reasons other than not actually learning how to use the debugger). I already realize that learning the Perl debugger is hard work. It is worth it! I shouldn't say any more for fear I'll be recruited for a SPUG session on the Perl debugger. On Mon, 14 Jan 2002, c k wrote: > Is there a way to deal with same name packages/modules/classes/objects > in perl? -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From andy at sweger.net Mon Jan 14 17:57:57 2002 From: andy at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: Message-ID: On Mon, 14 Jan 2002, Colin Meyer wrote: > When using generic names for modules, I like to prefix the name with > another namespace. If your module is for personal use, then you might > use CK::Link. That keeps your module clear of interference from anyone > else who might like the desirable name of 'Link'. (Think: HTML::Parser, > XML::Parser, YAML::Parser, Perl6::Parser, CMEYER::SuperBogus::Parser). On Mon, 14 Jan 2002, C.J. Collier wrote: > You might consider calling it kc::Link (giving yourself a namespace > "kc") Sure, take the easy way out, guys. :) -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Mon Jan 14 20:14:17 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: References: Message-ID: <23490000.1011060856@flashingchance> -- Andrew Sweger spake thusly: > To all of you _still_ using debugging print statements, I urge you to > give the Perl debugger a try. I will never go back to print > statements. If you tried the Perl debugger and went back to print > statements, speak up. I'd be curious to know what problems folks ran > into (reasons other than not actually learning how to use the > debugger). I already realize that learning the Perl debugger is hard > work. It is worth it! > > I shouldn't say any more for fear I'll be recruited for a SPUG > session on the Perl debugger. The primary reason I still use print statements (essentially) rather than the debugger is that I can't find a good way to get the debugger to interact with a script running in a CGI session. Since a lot of what I have to work with is so state-dependent (using cookies, etc.), it's difficult to just run the script on the command-line. I'd been messing around for a bit with an attempt to get the CGI script to open an xterm on my box (over ssh) with a perl debugger session connected to the script, but never quite got it working. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020114/6a62bd72/attachment.bin From andrew at sweger.net Mon Jan 14 20:20:53 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <200201150205.g0F25Nx15349@phineas.chriskate.net> Message-ID: For plain old CGI's, I usually run them on the command line feeding them the CGI environment. I vaguely recall the CGI module (at one time) detecting when it was talking to a terminal and prompting for input. It would probably be better to harness the CGI to be able to (alternately) take input from a file containing the test input while running under the debugger. This way you can keep using the same test cases. Kinda like QA or something equally unfamiliar to me. ;) mod_perl? Beyond me. That sounds like a tough one. But I *know* there's at least one very busy individual that should know the answer to this. Skimming perl.apache.org didn't give any obvious answers, but I'm sure there are hints there. On Mon, 14 Jan 2002, Chris Sutton wrote: > OK, i'll bite. I have started to learn the perl debugger several times and > each time I run into this problem: > > How do you run the debugger inside a CGI (or more importantly a mod_perl) > environment. About 90% of what I do in perl runs behind apache in mod_perl > and can't get very far past > > sub handler { > my $r = shift; > my $s = $r->server; > > debugger complains "Can't call method "server" on an undefined blah blah... > > I know I've seen this somewhere before where you run the debugger inside some > sort of apache environment or something. > > Help, I really want to stop using print STDERR! Can I make database > connections in the debugger? > > On Monday 14 January 2002 03:46 pm, Andrew Sweger wrote: > > To all of you _still_ using debugging print statements, I urge you to give > > the Perl debugger a try. I will never go back to print statements. If you > > tried the Perl debugger and went back to print statements, speak up. I'd > > be curious to know what problems folks ran into (reasons other than not > > actually learning how to use the debugger). I already realize that > > learning the Perl debugger is hard work. It is worth it! > -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From morton at speakeasy.org Mon Jan 14 20:41:13 2002 From: morton at speakeasy.org (Sanford M Morton Jr.) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <23490000.1011060856@flashingchance> Message-ID: I was able to do this a few years ago, though not with ssh. See cgidebug.pm at http://www.speakeasy.org/~cgires/modules/ --Sandy On Mon, 14 Jan 2002, Matt Tucker wrote: > > I'd been messing around for a bit with an attempt to get the CGI script > to open an xterm on my box (over ssh) with a perl debugger session > connected to the script, but never quite got it working. > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Mon Jan 14 20:54:39 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: References: <200201150205.g0F25Nx15349@phineas.chriskate.net> Message-ID: <20020114185439.A21036@hobart.helvella.org> On Mon, Jan 14, 2002 at 06:20:53PM -0800, Andrew Sweger wrote: > mod_perl? Beyond me. That sounds like a tough one. But I *know* there's at > least one very busy individual that should know the answer to this. > Skimming perl.apache.org didn't give any obvious answers, but I'm sure > there are hints there. http://perl.apache.org/guide/debug.html#Interactive_mod_perl_Debugging ;-) > > > > Help, I really want to stop using print STDERR! Can I make database > > connections in the debugger? Very certainly. > > > > On Monday 14 January 2002 03:46 pm, Andrew Sweger wrote: > > > To all of you _still_ using debugging print statements, I urge you to give > > > the Perl debugger a try. I will never go back to print statements. If you > > > tried the Perl debugger and went back to print statements, speak up. I'd > > > be curious to know what problems folks ran into (reasons other than not > > > actually learning how to use the debugger). I already realize that > > > learning the Perl debugger is hard work. It is worth it! I tend to rely on a combination of print statements, logfiles and perl -d. For edit, run, edit style coding (short scripts), the following is so convenient that I'll never give it up: print STDERR "value: $value\n" if $DEBUG; # actually I typically code a sub and just: # debug("value: $value"); For large projects, I use a central logfile for tracing data as it is aquired, filtered, convolved and passed along between bits of the system. Entities logging to the file identify the date, themselves, the data, and what they are up to. This makes it easy to pick out which section in 10k lines of code that is doubling lines of output. (anybody use a cpan module for syslog style application logging?) Both of these need the help of perl -d to unwind hairy problems. The ease examining data and being able to tweak things, single step through code, set conditional breakpoints, etc is simply the best for digging deep. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Mon Jan 14 21:00:14 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages Message-ID: <20020114190014.B9877@timji.consultix.wa.com> NOTE: The word "sud", except with a B for the D, is not allowed in messages, because MajorDomo thinks somebody is trying to Zubscribe/Unzubscribe. So we use Z for s in such cases! -Tim ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= OK, i'll bite. I have started to learn the perl debugger several times and each time I run into this problem: How do you run the debugger inside a CGI (or more importantly a mod_perl) environment. About 90% of what I do in perl runs behind apache in mod_perl and can't get very far past Zub handler { my $r = shift; my $s = $r->server; debugger complains "Can't call method "server" on an undefined blah blah... I know I've seen this somewhere before where you run the debugger inside some sort of apache environment or something. Help, I really want to stop using print STDERR! Can I make database connections in the debugger? On Monday 14 January 2002 03:46 pm, Andrew Sweger wrote: > To all of you _still_ using debugging print statements, I urge you to give > the Perl debugger a try. I will never go back to print statements. If you > tried the Perl debugger and went back to print statements, speak up. I'd > be curious to know what problems folks ran into (reasons other than not > actually learning how to use the debugger). I already realize that > learning the Perl debugger is hard work. It is worth it! ----- End forwarded message ----- -- *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Mon Jan 14 22:03:20 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114185439.A21036@hobart.helvella.org> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> Message-ID: <219880000.1011067399@benzene> -- Colin Meyer spake thusly: > For edit, run, edit style coding (short scripts), the following is so > convenient that I'll never give it up: > > print STDERR "value: $value\n" if $DEBUG; > # actually I typically code a sub and just: > # debug("value: $value"); We've actually done something similar here but in a different direction. All debug messages are written to a single debug object which is shared across all modules. (When running anywhere but the dev environment, writing to the debug object is essentially a no-op.) In addition to holding debug messages, it also traps all STDERR output. All messages are stored and then dumped out at the end of any html produced. I find it's a lot easier to actually see debug messages in the page than to use a separate window which tails the error log. It also allows for one to dump quite a bit more data without feeling overloaded, and gives the added benefit of being able to easily search the output (although one could presumably get the same by using less). Since the output comes at the end of the page, it's reasonably unobtrusive. It can also be turned off reasonably easily with a url parameter or a cookie. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020114/311b65a6/attachment.bin From andrew at sweger.net Mon Jan 14 22:28:38 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with /su[b]/ on this mail list In-Reply-To: <20020114190014.B9877@timji.consultix.wa.com> Message-ID: Would that be /\bsu[b]\b/ or /su[b]/? (yeah, I know, it was on purpose) Since this a Perl Monger's mailing list, I wonder if the powers that be would be willing to make an exception in the case of /\bsu[b]\b/. It comes in handy when discussing Perl. On Mon, 14 Jan 2002, Tim Maher wrote: > NOTE: The word "sud", except with a B for the D, is not allowed in messages, > because MajorDomo thinks somebody is trying to Zubscribe/Unzubscribe. So > we use Z for s in such cases! -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From chris at chriskate.net Tue Jan 15 00:04:22 2002 From: chris at chriskate.net (Chris Sutton) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114185439.A21036@hobart.helvella.org> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> Message-ID: <200201150604.g0F64N917681@phineas.chriskate.net> > http://perl.apache.org/guide/debug.html#Interactive_mod_perl_Debugging > > ;-) I'm hooked. A couple of things to share with others who may be just discovering this. In these docs they say run httpd -X -D PERLDB I found you also need to specify -D HAVE_PERL or mod_perl doesn't even load (and you cant use the debugger). httpd -X -D HAVE_PERL -D PERLDB To kick off the debugger you then have to send a request to apache with a browser (or other means) to the location which you want to debug and then the debugger will start. Unlike normal perl debugging, it doesn't look like you can "R"estart from the beginning. Also, I got frustrated in the debugger because "X" didn't seem to dump any of my variables. Let say I had a local hash (my %hash). To see the contents you have to say "x %hash" X seems to just print any global shared vars. I'm over the hump now. Thanks for the pointers. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From richard at richard-anderson.org Tue Jan 15 00:08:53 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> Message-ID: <009401c19d8b$26e59680$3d88ddd1@aciwin> I use both the debugger and optional print statements controlled by a multi-level debug flag. My feeling is that if you go to the trouble of inserting debugging print statements, leave them in but make them run-time optional. Someone (most likely yourself) may want to turn them on again in the future. Whoever does maintenance on the code will probably thank you. (Don't forget to document how to use your debug flag.) Callers of my modules can activate debug messages using a class variable Debug: use MyClass; $MyClass::Debug = 1; # or 2 or 3 $MyClass::DoSomething(); and in MyClass: if (Debug > 0) { print (whatever) } I usually have two or three debug levels of varying verbosity. The debug messages are written to standard out or the Apache error log for mod_perl apps. The performance impact of checking $Debug is trivial compared to the benefits. Richard Anderson 206.547.6903 richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Colin Meyer" To: "Andrew Sweger" Cc: "Chris Sutton" ; "Seattle Perl User's Group" Sent: Monday, January 14, 2002 6:54 PM Subject: Re: SPUG: How to deal with same name packages? > On Mon, Jan 14, 2002 at 06:20:53PM -0800, Andrew Sweger wrote: > > mod_perl? Beyond me. That sounds like a tough one. But I *know* there's at > > least one very busy individual that should know the answer to this. > > Skimming perl.apache.org didn't give any obvious answers, but I'm sure > > there are hints there. > > http://perl.apache.org/guide/debug.html#Interactive_mod_perl_Debugging > > ;-) > > > > > > > Help, I really want to stop using print STDERR! Can I make database > > > connections in the debugger? > > Very certainly. > > > > > > > On Monday 14 January 2002 03:46 pm, Andrew Sweger wrote: > > > > To all of you _still_ using debugging print statements, I urge you to give > > > > the Perl debugger a try. I will never go back to print statements. If you > > > > tried the Perl debugger and went back to print statements, speak up. I'd > > > > be curious to know what problems folks ran into (reasons other than not > > > > actually learning how to use the debugger). I already realize that > > > > learning the Perl debugger is hard work. It is worth it! > > I tend to rely on a combination of print statements, logfiles and perl -d. > > For edit, run, edit style coding (short scripts), the following is so > convenient that I'll never give it up: > > print STDERR "value: $value\n" if $DEBUG; > # actually I typically code a sub and just: > # debug("value: $value"); > > For large projects, I use a central logfile for tracing data as it is > aquired, filtered, convolved and passed along between bits of the > system. Entities logging to the file identify the date, themselves, the > data, and what they are up to. This makes it easy to pick out which > section in 10k lines of code that is doubling lines of output. (anybody > use a cpan module for syslog style application logging?) > > Both of these need the help of perl -d to unwind hairy problems. The > ease examining data and being able to tweak things, single step through > code, set conditional breakpoints, etc is simply the best for digging > deep. > > Have fun, > -C. > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 00:56:46 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <200201150604.g0F64N917681@phineas.chriskate.net> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <200201150604.g0F64N917681@phineas.chriskate.net> Message-ID: <20020114225646.B21036@hobart.helvella.org> On Mon, Jan 14, 2002 at 10:04:22PM -0800, Chris Sutton wrote: > > http://perl.apache.org/guide/debug.html#Interactive_mod_perl_Debugging > > > > ;-) > > I'm hooked. A couple of things to share with others who may be just > discovering this. In these docs they say run > > httpd -X -D PERLDB > > I found you also need to specify -D HAVE_PERL or mod_perl doesn't even load > (and you cant use the debugger). > > httpd -X -D HAVE_PERL -D PERLDB Do you have mod_perl compiled as a dso module (dynamically loadable into the httpd binary)? Examples in the guide tend to assume that you have mod_perl statically compiled into apache, as that is still recommended for production systems. I understand that the module as a dso behaves much better now than it did a year ago or so. > Also, I got frustrated in the debugger because "X" didn't seem to dump > any of my variables. > > Let say I had a local hash (my %hash). To see the contents you have to > say "x %hash" X seems to just print any global shared vars. The 'X' debugger command only dumps globals. The 'x' command dumps the results of any expression, which can be the value of a global or lexical variable, or any other code snippet. Hmm, I don't think that there is any way, save XS code, to dump names and values of all lexicals. There's no symbol table for them, unlike package variables and friends. (Try comparing the output of 'X' to 'x %::'). > > I'm over the hump now. Thanks for the pointers. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 01:22:30 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <200201150604.g0F64N917681@phineas.chriskate.net> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <200201150604.g0F64N917681@phineas.chriskate.net> Message-ID: <20020114232230.C21036@hobart.helvella.org> On Mon, Jan 14, 2002 at 10:04:22PM -0800, Chris Sutton wrote: > Let say I had a local hash (my %hash). To see the contents you have to say ^^^^^ Maybe I'm feeling overly pedantic, but: The code 'my %hash' declares a *lexical* hash. This is distinctly different from 'local %hash', which declares the contents of %hash to be local to the containing code block (dynamically scoped). If this all makes perfect sense then fine. The meaning of the word 'local', due to its unfortunate historical use means not local, but dynamic. I'd almost with the way you used the word, save for that vestigial perl4 programmer in me. ;-) Otherwise you may enjoy reviewing the section on 'Scoped Declarations' in the Camel, and learn the details of the global, lexical and dynamic scopes of Perl. (p. 129 v3, or p.107 v2) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cwilkes-spug at ladro.com Tue Jan 15 02:46:13 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <009401c19d8b$26e59680$3d88ddd1@aciwin>; from richard@richard-anderson.org on Mon, Jan 14, 2002 at 10:08:53PM -0800 References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> Message-ID: <20020115004613.A40924@www.ladro.com> On Mon, Jan 14, 2002 at 10:08:53PM -0800, Richard Anderson wrote: > > Callers of my modules can activate debug messages using a class variable > Debug: > > use MyClass; > $MyClass::Debug = 1; # or 2 or 3 > $MyClass::DoSomething(); > > and in MyClass: > > if (Debug > 0) { > print (whatever) > } > > I usually have two or three debug levels of varying verbosity. The debug > messages are written to standard out or the Apache error log for mod_perl > apps. The performance impact of checking $Debug is trivial compared to the > benefits. If you made Debug a constant then there wouldn't be a performance hit as it would get optimized away at run/compile time, if my memory of a recent TPJ article by Sean Burke is correct. With DEBUG => 3 then you'll have "If (3 > 0) { print }" which will get optimized to just "print" Likewise if you had DEBUG => 0 the whole "if ( 0 > 0 ) {}" will get thrown out. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Tue Jan 15 06:45:59 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:33 2004 Subject: SPUG: How to deal with same name packages? In-Reply-To: <20020114225646.B21036@hobart.helvella.org> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <200201150604.g0F64N917681@phineas.chriskate.net> <20020114225646.B21036@hobart.helvella.org> Message-ID: <25430000.1011098758@flashingchance> -- Colin Meyer spake thusly: >> I'm hooked. A couple of things to share with others who may be just >> discovering this. In these docs they say run >> >> httpd -X -D PERLDB >> >> I found you also need to specify -D HAVE_PERL or mod_perl doesn't >> even load (and you cant use the debugger). >> >> httpd -X -D HAVE_PERL -D PERLDB > > Do you have mod_perl compiled as a dso module (dynamically loadable > into the httpd binary)? Examples in the guide tend to assume that > you have mod_perl statically compiled into apache, as that is still > recommended for production systems. I understand that the module as > a dso behaves much better now than it did a year ago or so. The '-D HAVE_PERL' is most likely specific to your particular installation, and is probably made use of in the httpd.conf file with something like: Alias /perl/ /var/www/perl/ SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On Options +ExecCGI I've noticed that Mandrake has been doing something along these lines which involves splitting Apache into two binaries: one which runs mod_perl, and another which proxies all requests to it as well as handling straight file requests and CGI's. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020115/e9b1e21c/attachment.bin From richard at richard-anderson.org Tue Jan 15 08:29:11 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020115004613.A40924@www.ladro.com> Message-ID: <00d101c19dd1$016c1230$3d88ddd1@aciwin> The performance hit is negligible, especially when you compare the millisecond lost per run to the minutes, hours or days of human time lost to debugging or incorrect results. The advantage of having a variable is that the user of the module can activate debugging at run time without modifying the source code. In many cases the user of the module will not be able to modify the module source code without getting administrative privileges. In large organizations it is simply not feasible for a maintenance programmer to modify production code while debugging because the bits have been stamped as tested by the test group and installed by the release group. To repeat what all the books say about optimization: don't twiddle code to optimize until (1) you have working, debugged code, (2) you have profiled the code, and (3) you have optimized the algorithms and data structures underlying the code. Minor gains in performance at the expensive of code flexibility or readability are not cost-effective. Bugs are extremely expensive to fix; computer time on the order of milliseconds is cheap by comparison. Richard Anderson 206.547.6903 richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Chris Wilkes" To: Sent: Tuesday, January 15, 2002 12:46 AM Subject: Re: SPUG: Debugging methodology (was: How to deal with same name packages?) > On Mon, Jan 14, 2002 at 10:08:53PM -0800, Richard Anderson wrote: > > > > Callers of my modules can activate debug messages using a class variable > > Debug: > > > > use MyClass; > > $MyClass::Debug = 1; # or 2 or 3 > > $MyClass::DoSomething(); > > > > and in MyClass: > > > > if (Debug > 0) { > > print (whatever) > > } > > > > I usually have two or three debug levels of varying verbosity. The debug > > messages are written to standard out or the Apache error log for mod_perl > > apps. The performance impact of checking $Debug is trivial compared to the > > benefits. > > If you made Debug a constant then there wouldn't be a performance hit as > it would get optimized away at run/compile time, if my memory of a > recent TPJ article by Sean Burke is correct. > > With DEBUG => 3 then you'll have "If (3 > 0) { print }" which will get > optimized to just "print" Likewise if you had DEBUG => 0 the whole "if > ( 0 > 0 ) {}" will get thrown out. > > Chris > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mathin at mathin.com Tue Jan 15 10:07:08 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: How to deal with /su[b]/ on this mail list In-Reply-To: Message-ID: Hmmm ... I wonder .... do naval-related groups have to discuss 'boats that go under water' or magazine lists 'signing up for once-a-month delevery' ? Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Mon, 14 Jan 2002, Andrew Sweger wrote: > Would that be /\bsu[b]\b/ or /su[b]/? (yeah, I know, it was on purpose) > > Since this a Perl Monger's mailing list, I wonder if the powers that be > would be willing to make an exception in the case of /\bsu[b]\b/. It comes > in handy when discussing Perl. > > On Mon, 14 Jan 2002, Tim Maher wrote: > > > NOTE: The word "sud", except with a B for the D, is not allowed in messages, > > because MajorDomo thinks somebody is trying to Zubscribe/Unzubscribe. So > > we use Z for s in such cases! > > -- > Andrew B. Sweger -- The great thing about multitasking is that several > things can go wrong at once. > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 11:25:49 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out Message-ID: Being new, I still haven't a complete clue as to what I'm doing. The listed program is giving the following two errors: print on closed filehandle main::FILE at sunday line 61. DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday line 79. I'm at a loss as to what the first one is. The second one I'm thinking has to do with number assigning within the database but I'm not completely sure (there is an id of 127 within the database but that is under id and not under uid which seems to be what "key 1" is referencing). If anyone has a soft spot for a newbie and wants to help me out, I'd appreciate it! #!/usr/bin/perl -w use Time::Local; use POSIX qw(mktime); use DBI; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; &get_date; sub get_date { @days = ('Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d",$hour,$min); if ($year < 50){ $year += 2000; } else { $year += 1900; } $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = $mon + 1; $date2 = "$mon2/$mday/$year"; $date3 = "$mon2.$mday.$year"; } my $buffer = ''; my $buffer2 = ''; my $buffer3 = ''; my $host = 'localhost'; my $database = 'safelist'; my $username = 'admin'; my $password = 'srb6653'; my $ua = new LWP::UserAgent(); my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die "Failed DBI connect(): $!\n"; my $query = "SELECT safelists.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, safelists.uid, members.email from safelists, schedule, email_txt, members where email_txt.id = schedule.SUN and schedule.system_name = safelists.system_name and members.id = safelists.uid and email_txt.email_subject != ''"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u id,$email) = $sth->fetchrow_array) { my $url = "http://$email_to?action=Send This Message&username=$username&password=$password&subject=$email_subject&message =$email_text"; $email_text =~ s/\\//g; my $req = HTTP::Request->new(GET=>$url); my $file_path = "./members/data/$username/$system_name/$date3.txt"; my $resp = $ua->request($req, $file_path); my $sec_file_path = "members/data/$username"; my $outfile = "index.html"; my $filename = "$sec_file_path/$outfile"; open (FILE,">>$filename"); Line 61 -->{ print FILE "Problem on $date3"; } close (FILE); } my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, schedule where schedule.system_name = safelists.system_name and schedule.SUN != '0'"; $buffer2 .= "===> Executing Query: $query2\n\n"; my $sth = $dbh->prepare($query2); my $rc = $sth->execute(); while (my($uid,$system_name) = $sth->fetchrow_array) { my $datestamp = $date2; my $timestamp = $time; my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; $buffer3 .= "===> Executing Query: $query3\n\n"; my $sth = $dbh->prepare($query3); Line 79 -->my $rc = $sth->execute(); } undef $sth; $dbh->disconnect; 0; Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020115/d7fc129b/attachment.htm From brianmaddux at yahoo.com Tue Jan 15 11:30:24 2002 From: brianmaddux at yahoo.com (Brian Maddux) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <00d101c19dd1$016c1230$3d88ddd1@aciwin> Message-ID: <20020115173024.30914.qmail@web13008.mail.yahoo.com> You mention "you have profiled the code". Are there tools for doing this? I do the other 2 tasks, but not this one.... Thanks, Brian --- Richard Anderson wrote: > The performance hit is negligible, especially when > you compare the > millisecond lost per run to the minutes, hours or > days of human time lost to > debugging or incorrect results. The advantage of > having a variable is that > the user of the module can activate debugging at run > time without modifying > the source code. In many cases the user of the > module will not be able to > modify the module source code without getting > administrative privileges. In > large organizations it is simply not feasible for a > maintenance programmer > to modify production code while debugging because > the bits have been stamped > as tested by the test group and installed by the > release group. > > To repeat what all the books say about optimization: > don't twiddle code to > optimize until (1) you have working, debugged code, > (2) you have profiled > the code, and (3) you have optimized the algorithms > and data structures > underlying the code. Minor gains in performance at > the expensive of code > flexibility or readability are not cost-effective. > Bugs are extremely > expensive to fix; computer time on the order of > milliseconds is cheap by > comparison. > > Richard Anderson > 206.547.6903 > richard@richard-anderson.org > www.richard-anderson.org > ----- Original Message ----- > From: "Chris Wilkes" > To: > Sent: Tuesday, January 15, 2002 12:46 AM > Subject: Re: SPUG: Debugging methodology (was: How > to deal with same name > packages?) > > > > On Mon, Jan 14, 2002 at 10:08:53PM -0800, Richard > Anderson wrote: > > > > > > Callers of my modules can activate debug > messages using a class variable > > > Debug: > > > > > > use MyClass; > > > $MyClass::Debug = 1; # or 2 or 3 > > > $MyClass::DoSomething(); > > > > > > and in MyClass: > > > > > > if (Debug > 0) { > > > print (whatever) > > > } > > > > > > I usually have two or three debug levels of > varying verbosity. The > debug > > > messages are written to standard out or the > Apache error log for > mod_perl > > > apps. The performance impact of checking > $Debug is trivial compared to > the > > > benefits. > > > > If you made Debug a constant then there wouldn't > be a performance hit as > > it would get optimized away at run/compile time, > if my memory of a > > recent TPJ article by Sean Burke is correct. > > > > With DEBUG => 3 then you'll have "If (3 > 0) { > print }" which will get > > optimized to just "print" Likewise if you had > DEBUG => 0 the whole "if > > ( 0 > 0 ) {}" will get thrown out. > > > > Chris > > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, > EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > ===== Brian Maddux Whidbey Island, WA brianmaddux@yahoo.com http://www.geocities.com/SiliconValley/5308 ** Please DO NOT mail to brian_maddux@bigfoot.com. ** ** That address WILL NOT WORK starting sometime in ** ** August 2001. Thanks. ** __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From dcd at tc.fluke.com Tue Jan 15 12:04:06 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: On Tue, 15 Jan 2002 at 09:25 -0800, Susanne Bullo ...: > print on closed filehandle main::FILE at sunday line 61. > my $username = 'admin'; > while ( my($email_to,$username,$password,$email_subject,$email_text,$system_name,$uid,$email) = $sth->fetchrow_array) { > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } First, did you intend to erase $username = 'admin' with the username you get from fetchrow_array? next, you should always check the return result from open() most likely the relative directory path does not exist in the drectory your are currently running in, so the open fails... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From richard at richard-anderson.org Tue Jan 15 12:05:35 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) References: <20020115173024.30914.qmail@web13008.mail.yahoo.com> Message-ID: <011b01c19def$3daae8c0$3d88ddd1@aciwin> There are dozens (hundred?) of tools for profiling/benchmarking code, some commercial, some open source, some bundled with the particular compiler/interpreter you are using. For Perl, look at these modules: Profiler Devel::DProf These may also be of interest: Time::HiRes Benchmark and its subclasses Richard Anderson 206.547.6903 richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Brian Maddux" To: "Richard Anderson" ; Sent: Tuesday, January 15, 2002 9:30 AM Subject: Re: SPUG: Debugging methodology (was: How to deal with same name packages?) > You mention "you have profiled the code". Are there > tools for doing this? I do the other 2 tasks, but not > this one.... > > > Thanks, > Brian > > --- Richard Anderson > wrote: > > The performance hit is negligible, especially when > > you compare the > > millisecond lost per run to the minutes, hours or > > days of human time lost to > > debugging or incorrect results. The advantage of > > having a variable is that > > the user of the module can activate debugging at run > > time without modifying > > the source code. In many cases the user of the > > module will not be able to > > modify the module source code without getting > > administrative privileges. In > > large organizations it is simply not feasible for a > > maintenance programmer > > to modify production code while debugging because > > the bits have been stamped > > as tested by the test group and installed by the > > release group. > > > > To repeat what all the books say about optimization: > > don't twiddle code to > > optimize until (1) you have working, debugged code, > > (2) you have profiled > > the code, and (3) you have optimized the algorithms > > and data structures > > underlying the code. Minor gains in performance at > > the expensive of code > > flexibility or readability are not cost-effective. > > Bugs are extremely > > expensive to fix; computer time on the order of > > milliseconds is cheap by > > comparison. > > > > Richard Anderson > > 206.547.6903 > > richard@richard-anderson.org > > www.richard-anderson.org > > ----- Original Message ----- > > From: "Chris Wilkes" > > To: > > Sent: Tuesday, January 15, 2002 12:46 AM > > Subject: Re: SPUG: Debugging methodology (was: How > > to deal with same name > > packages?) > > > > > > > On Mon, Jan 14, 2002 at 10:08:53PM -0800, Richard > > Anderson wrote: > > > > > > > > Callers of my modules can activate debug > > messages using a class variable > > > > Debug: > > > > > > > > use MyClass; > > > > $MyClass::Debug = 1; # or 2 or 3 > > > > $MyClass::DoSomething(); > > > > > > > > and in MyClass: > > > > > > > > if (Debug > 0) { > > > > print (whatever) > > > > } > > > > > > > > I usually have two or three debug levels of > > varying verbosity. The > > debug > > > > messages are written to standard out or the > > Apache error log for > > mod_perl > > > > apps. The performance impact of checking > > $Debug is trivial compared to > > the > > > > benefits. > > > > > > If you made Debug a constant then there wouldn't > > be a performance hit as > > > it would get optimized away at run/compile time, > > if my memory of a > > > recent TPJ article by Sean Burke is correct. > > > > > > With DEBUG => 3 then you'll have "If (3 > 0) { > > print }" which will get > > > optimized to just "print" Likewise if you had > > DEBUG => 0 the whole "if > > > ( 0 > 0 ) {}" will get thrown out. > > > > > > Chris > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - - > > > POST TO: spug-list@pm.org PROBLEMS: > > owner-spug-list@pm.org > > > Subscriptions; Email to majordomo@pm.org: > > ACTION LIST EMAIL > > > Replace ACTION by subscribe or unsubscribe, > > EMAIL by your Email-address > > > For daily traffic, use spug-list for LIST ; for > > weekly, spug-list-digest > > > Seattle Perl Users Group (SPUG) Home Page: > > http://zipcon.net/spug/ > > > > > > > > > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: > > ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL > > by your Email-address > > For daily traffic, use spug-list for LIST ; for > > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > > http://zipcon.net/spug/ > > > > > > > ===== > Brian Maddux Whidbey Island, WA > brianmaddux@yahoo.com > http://www.geocities.com/SiliconValley/5308 > > ** Please DO NOT mail to brian_maddux@bigfoot.com. ** > ** That address WILL NOT WORK starting sometime in ** > ** August 2001. Thanks. ** > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mathin at mathin.com Tue Jan 15 12:21:00 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: The print on close file handle error could be cause by the failure of the open command. You might try open(FILE,">>$filename") or die $!; to make sure the file is opened. (The die $! will print the error if it fails.) The second SQL error looks like you are attempting to insert a value into a table field which must be unique ... and there is already an entry with '127' in that field. The 'key 1' doesn't mean the first value in the list of values to insert. It refers to the field in the table which is in conflict with the value you are attempting to insert. If you do want to update the table (or insert if it doesn't exist) you might try the 'replace into' mysql command instead of the 'insert into' Hope that helps. Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Tue, 15 Jan 2002, Susanne Bullo wrote: > Being new, I still haven't a complete clue as to what I'm doing. The listed > program is giving the following two errors: > > print on closed filehandle main::FILE at sunday line 61. > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > line 79. > > I'm at a loss as to what the first one is. The second one I'm thinking has > to do with number assigning within the database but I'm not completely sure > (there is an id of 127 within the database but that is under id and not > under uid which seems to be what "key 1" is referencing). > > If anyone has a soft spot for a newbie and wants to help me out, I'd > appreciate it! > > #!/usr/bin/perl -w > use Time::Local; > use POSIX qw(mktime); > use DBI; > use LWP::UserAgent; > use HTTP::Request; > use HTTP::Response; > &get_date; > sub get_date { > @days = ('Sunday','Monday','Tuesday','Wednesday', > 'Thursday','Friday','Saturday'); > @months = ('January','February','March','April','May','June','July', > 'August','September','October','November','December'); > ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; > $time = sprintf("%02d:%02d",$hour,$min); > if ($year < 50){ > $year += 2000; > } > else { > $year += 1900; > } > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > $mon2 = $mon + 1; > $date2 = "$mon2/$mday/$year"; > $date3 = "$mon2.$mday.$year"; > } > my $buffer = ''; > my $buffer2 = ''; > my $buffer3 = ''; > my $host = 'localhost'; > my $database = 'safelist'; > my $username = 'admin'; > my $password = 'srb6653'; > my $ua = new LWP::UserAgent(); > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > "Failed DBI connect(): $!\n"; > my $query = "SELECT safelists.email_to, safelists.username, > safelists.password, email_txt.email_subject, email_txt.email_text, > safelists.uid, members.email from safelists, schedule, email_txt, members > where email_txt.id = schedule.SUN and schedule.system_name = > safelists.system_name and members.id = safelists.uid and > email_txt.email_subject != ''"; > $buffer .= "===> Executing Query: $query\n\n"; > my $sth = $dbh->prepare($query); > my $rc = $sth->execute(); > while > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > id,$email) = $sth->fetchrow_array) { > my $url = "http://$email_to?action=Send This > Message&username=$username&password=$password&subject=$email_subject&message > =$email_text"; > $email_text =~ s/\\//g; > my $req = HTTP::Request->new(GET=>$url); > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > my $resp = $ua->request($req, $file_path); > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } > close (FILE); > } > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > schedule where schedule.system_name = safelists.system_name and schedule.SUN > != '0'"; > $buffer2 .= "===> Executing Query: $query2\n\n"; > my $sth = $dbh->prepare($query2); > my $rc = $sth->execute(); > while (my($uid,$system_name) = $sth->fetchrow_array) { > my $datestamp = $date2; > my $timestamp = $time; > my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) > values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; > $buffer3 .= "===> Executing Query: $query3\n\n"; > my $sth = $dbh->prepare($query3); > Line 79 -->my $rc = $sth->execute(); > } > undef $sth; > $dbh->disconnect; > 0; > > Susanne Bullo - Sweet Homes > DirectTV DSL > Get Paid to Read Email! > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 12:26:56 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: Yes, actually I do intend that - the username to log in is just for the database. Then there are several users within that database so $username would have to be overwritten for each one. How do I go about checking the return result on my open()? Thanks for helping me out! Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! -----Original Message----- From: David Dyck [mailto:dcd@tc.fluke.com] Sent: Tuesday, January 15, 2002 10:04 AM To: Susanne Bullo Cc: Seattle Perl User's Group Subject: Re: SPUG: Two errors I need hashing out On Tue, 15 Jan 2002 at 09:25 -0800, Susanne Bullo ...: > print on closed filehandle main::FILE at sunday line 61. > my $username = 'admin'; > while ( my($email_to,$username,$password,$email_subject,$email_text,$system_name,$ui d,$email) = $sth->fetchrow_array) { > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } First, did you intend to erase $username = 'admin' with the username you get from fetchrow_array? next, you should always check the return result from open() most likely the relative directory path does not exist in the drectory your are currently running in, so the open fails... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 12:37:00 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: References: Message-ID: <20020115103700.G21036@hobart.helvella.org> On Tue, Jan 15, 2002 at 09:25:49AM -0800, Susanne Bullo wrote: > Being new, I still haven't a complete clue as to what I'm doing. The listed > program is giving the following two errors: > > print on closed filehandle main::FILE at sunday line 61. > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > line 79. > > I'm at a loss as to what the first one is. The second one I'm thinking has > to do with number assigning within the database but I'm not completely sure > (there is an id of 127 within the database but that is under id and not > under uid which seems to be what "key 1" is referencing). This sounds like MySQL is having trouble with some data in the table you are selecting from. If you are able to successfully prepare your handle (which you are), and get an error when calling the execute() method on the handle, then that indicates database trouble. My guess is that there are two records with the "unique" key value of 127. Can you use another tool to look in your database and verify the integrity of this table? > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } > close (FILE); > } Are you sure that your program was able to open the file successfully? It is imperative to check for errors *every* time you open a file, or close a file that has been written to. It may help to recode the above lines to be more like: open FILE, ">>$filename" or die "Could not open file: $!"; print FILE "..."; close FILE or die "Could not write to file: $!"; # we might not know of a write error (disk full, etc) until the # filehandle is closed, causing buffers to be flushed. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 12:31:03 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: Ok, I will place that in there to see if it fails - thanks. The weird thing about the number being called out is it's an id number not a uid. The uid is assigned by the previous line and it doesn't need to be unique. However, the id for this is supposed to be unique but is set to automatically increment. So, I don't know why it's trying to overwrite something that should automatically increment. Guess I'll look at the properties of that table. Thanks for your help! Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! -----Original Message----- From: Dan Ebert [mailto:mathin@mathin.com] Sent: Tuesday, January 15, 2002 10:21 AM To: Susanne Bullo Cc: Seattle Perl User's Group Subject: Re: SPUG: Two errors I need hashing out The print on close file handle error could be cause by the failure of the open command. You might try open(FILE,">>$filename") or die $!; to make sure the file is opened. (The die $! will print the error if it fails.) The second SQL error looks like you are attempting to insert a value into a table field which must be unique ... and there is already an entry with '127' in that field. The 'key 1' doesn't mean the first value in the list of values to insert. It refers to the field in the table which is in conflict with the value you are attempting to insert. If you do want to update the table (or insert if it doesn't exist) you might try the 'replace into' mysql command instead of the 'insert into' Hope that helps. Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Tue, 15 Jan 2002, Susanne Bullo wrote: > Being new, I still haven't a complete clue as to what I'm doing. The listed > program is giving the following two errors: > > print on closed filehandle main::FILE at sunday line 61. > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > line 79. > > I'm at a loss as to what the first one is. The second one I'm thinking has > to do with number assigning within the database but I'm not completely sure > (there is an id of 127 within the database but that is under id and not > under uid which seems to be what "key 1" is referencing). > > If anyone has a soft spot for a newbie and wants to help me out, I'd > appreciate it! > > #!/usr/bin/perl -w > use Time::Local; > use POSIX qw(mktime); > use DBI; > use LWP::UserAgent; > use HTTP::Request; > use HTTP::Response; > &get_date; > sub get_date { > @days = ('Sunday','Monday','Tuesday','Wednesday', > 'Thursday','Friday','Saturday'); > @months = ('January','February','March','April','May','June','July', > 'August','September','October','November','December'); > ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; > $time = sprintf("%02d:%02d",$hour,$min); > if ($year < 50){ > $year += 2000; > } > else { > $year += 1900; > } > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > $mon2 = $mon + 1; > $date2 = "$mon2/$mday/$year"; > $date3 = "$mon2.$mday.$year"; > } > my $buffer = ''; > my $buffer2 = ''; > my $buffer3 = ''; > my $host = 'localhost'; > my $database = 'safelist'; > my $username = 'admin'; > my $password = 'srb6653'; > my $ua = new LWP::UserAgent(); > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > "Failed DBI connect(): $!\n"; > my $query = "SELECT safelists.email_to, safelists.username, > safelists.password, email_txt.email_subject, email_txt.email_text, > safelists.uid, members.email from safelists, schedule, email_txt, members > where email_txt.id = schedule.SUN and schedule.system_name = > safelists.system_name and members.id = safelists.uid and > email_txt.email_subject != ''"; > $buffer .= "===> Executing Query: $query\n\n"; > my $sth = $dbh->prepare($query); > my $rc = $sth->execute(); > while > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > id,$email) = $sth->fetchrow_array) { > my $url = "http://$email_to?action=Send This > Message&username=$username&password=$password&subject=$email_subject&message > =$email_text"; > $email_text =~ s/\\//g; > my $req = HTTP::Request->new(GET=>$url); > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > my $resp = $ua->request($req, $file_path); > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } > close (FILE); > } > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > schedule where schedule.system_name = safelists.system_name and schedule.SUN > != '0'"; > $buffer2 .= "===> Executing Query: $query2\n\n"; > my $sth = $dbh->prepare($query2); > my $rc = $sth->execute(); > while (my($uid,$system_name) = $sth->fetchrow_array) { > my $datestamp = $date2; > my $timestamp = $time; > my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) > values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; > $buffer3 .= "===> Executing Query: $query3\n\n"; > my $sth = $dbh->prepare($query3); > Line 79 -->my $rc = $sth->execute(); > } > undef $sth; > $dbh->disconnect; > 0; > > Susanne Bullo - Sweet Homes > DirectTV DSL > Get Paid to Read Email! > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From dcd at tc.fluke.com Tue Jan 15 12:33:48 2002 From: dcd at tc.fluke.com (David Dyck) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: On Tue, 15 Jan 2002 at 10:26 -0800, Susanne Bullo ...: > Yes, actually I do intend that - the username to log in is just for the > database. Then there are several users within that database so $username > would have to be overwritten for each one. > > How do I go about checking the return result on my open()? in perldoc -f open it states Open returns nonzero upon success, the undefined value otherwise. so test the return result. It also states: When opening a file, it's usually a bad idea to continue normal execution if the request failed, so "open" is frequently used in connection with "die". Even if "die" won't do what you want (say, in a CGI script, where you want to make a nicely formatted error message (but there are modules that can help with that problem)) you should always check the return value from opening a file. The infrequent exception is when working with an unopened filehandle is actually what you want to do. If you're doing CGI, you may want to add use CGI::Carp; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Tue Jan 15 12:39:34 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: 1. check to see that the filehandle is really getting opened. 2. you're trying to insert a duplicate value into a field that doesn't allow dupes. Is either the uid or id the primary key or a unique index on the table per chance? On Tue, 15 Jan 2002, Susanne Bullo wrote: > Being new, I still haven't a complete clue as to what I'm doing. The listed > program is giving the following two errors: > > print on closed filehandle main::FILE at sunday line 61. > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > line 79. > > I'm at a loss as to what the first one is. The second one I'm thinking has > to do with number assigning within the database but I'm not completely sure > (there is an id of 127 within the database but that is under id and not > under uid which seems to be what "key 1" is referencing). > > If anyone has a soft spot for a newbie and wants to help me out, I'd > appreciate it! > > #!/usr/bin/perl -w > use Time::Local; > use POSIX qw(mktime); > use DBI; > use LWP::UserAgent; > use HTTP::Request; > use HTTP::Response; > &get_date; > sub get_date { > @days = ('Sunday','Monday','Tuesday','Wednesday', > 'Thursday','Friday','Saturday'); > @months = ('January','February','March','April','May','June','July', > 'August','September','October','November','December'); > ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; > $time = sprintf("%02d:%02d",$hour,$min); > if ($year < 50){ > $year += 2000; > } > else { > $year += 1900; > } > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > $mon2 = $mon + 1; > $date2 = "$mon2/$mday/$year"; > $date3 = "$mon2.$mday.$year"; > } > my $buffer = ''; > my $buffer2 = ''; > my $buffer3 = ''; > my $host = 'localhost'; > my $database = 'safelist'; > my $username = 'admin'; > my $password = 'srb6653'; > my $ua = new LWP::UserAgent(); > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > "Failed DBI connect(): $!\n"; > my $query = "SELECT safelists.email_to, safelists.username, > safelists.password, email_txt.email_subject, email_txt.email_text, > safelists.uid, members.email from safelists, schedule, email_txt, members > where email_txt.id = schedule.SUN and schedule.system_name = > safelists.system_name and members.id = safelists.uid and > email_txt.email_subject != ''"; > $buffer .= "===> Executing Query: $query\n\n"; > my $sth = $dbh->prepare($query); > my $rc = $sth->execute(); > while > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > id,$email) = $sth->fetchrow_array) { > my $url = "http://$email_to?action=Send This > Message&username=$username&password=$password&subject=$email_subject&message > =$email_text"; > $email_text =~ s/\\//g; > my $req = HTTP::Request->new(GET=>$url); > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > my $resp = $ua->request($req, $file_path); > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename"); > Line 61 -->{ print FILE "Problem on $date3"; } > close (FILE); > } > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > schedule where schedule.system_name = safelists.system_name and schedule.SUN > != '0'"; > $buffer2 .= "===> Executing Query: $query2\n\n"; > my $sth = $dbh->prepare($query2); > my $rc = $sth->execute(); > while (my($uid,$system_name) = $sth->fetchrow_array) { > my $datestamp = $date2; > my $timestamp = $time; > my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) > values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; > $buffer3 .= "===> Executing Query: $query3\n\n"; > my $sth = $dbh->prepare($query3); > Line 79 -->my $rc = $sth->execute(); > } > undef $sth; > $dbh->disconnect; > 0; > > Susanne Bullo - Sweet Homes > DirectTV DSL > Get Paid to Read Email! > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mathin at mathin.com Tue Jan 15 12:47:56 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: If it is an autoincrement field I think you can ommit it from your insert statement ... INSERT into reports (uid, system_name, last_success_run) values ('$uid', '$system_name', '$datestamp at $timestamp'); That might fix it. Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- On Tue, 15 Jan 2002, Susanne Bullo wrote: > Ok, I will place that in there to see if it fails - thanks. > > The weird thing about the number being called out is it's an id number not a > uid. The uid is assigned by the previous line and it doesn't need to be > unique. However, the id for this is supposed to be unique but is set to > automatically increment. So, I don't know why it's trying to overwrite > something that should automatically increment. Guess I'll look at the > properties of that table. > > Thanks for your help! > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > -----Original Message----- > From: Dan Ebert [mailto:mathin@mathin.com] > Sent: Tuesday, January 15, 2002 10:21 AM > To: Susanne Bullo > Cc: Seattle Perl User's Group > Subject: Re: SPUG: Two errors I need hashing out > > > > The print on close file handle error could be cause by the failure of the > open command. You might try > > open(FILE,">>$filename") or die $!; > > to make sure the file is opened. (The die $! will print the error if it > fails.) > > The second SQL error looks like you are attempting to insert a value into > a table field which must be unique ... and there is already an entry with > '127' in that field. The 'key 1' doesn't mean the first value in the > list of values to insert. It refers to the field in the table which is in > conflict with the value you are attempting to insert. > > If you do want to update the table (or insert if it doesn't exist) you > might try the 'replace into' mysql command instead of the 'insert into' > > Hope that helps. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Tue, 15 Jan 2002, Susanne Bullo wrote: > > > Being new, I still haven't a complete clue as to what I'm doing. The > listed > > program is giving the following two errors: > > > > print on closed filehandle main::FILE at sunday line 61. > > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > > line 79. > > > > I'm at a loss as to what the first one is. The second one I'm thinking > has > > to do with number assigning within the database but I'm not completely > sure > > (there is an id of 127 within the database but that is under id and not > > under uid which seems to be what "key 1" is referencing). > > > > If anyone has a soft spot for a newbie and wants to help me out, I'd > > appreciate it! > > > > #!/usr/bin/perl -w > > use Time::Local; > > use POSIX qw(mktime); > > use DBI; > > use LWP::UserAgent; > > use HTTP::Request; > > use HTTP::Response; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > > 'Thursday','Friday','Saturday'); > > @months = ('January','February','March','April','May','June','July', > > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > > $year += 2000; > > } > > else { > > $year += 1900; > > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > > $mon2 = $mon + 1; > > $date2 = "$mon2/$mday/$year"; > > $date3 = "$mon2.$mday.$year"; > > } > > my $buffer = ''; > > my $buffer2 = ''; > > my $buffer3 = ''; > > my $host = 'localhost'; > > my $database = 'safelist'; > > my $username = 'admin'; > > my $password = 'srb6653'; > > my $ua = new LWP::UserAgent(); > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > > safelists.password, email_txt.email_subject, email_txt.email_text, > > safelists.uid, members.email from safelists, schedule, email_txt, members > > where email_txt.id = schedule.SUN and schedule.system_name = > > safelists.system_name and members.id = safelists.uid and > > email_txt.email_subject != ''"; > > $buffer .= "===> Executing Query: $query\n\n"; > > my $sth = $dbh->prepare($query); > > my $rc = $sth->execute(); > > while > > > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > > id,$email) = $sth->fetchrow_array) { > > my $url = "http://$email_to?action=Send This > > > Message&username=$username&password=$password&subject=$email_subject&message > > =$email_text"; > > $email_text =~ s/\\//g; > > my $req = HTTP::Request->new(GET=>$url); > > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > > my $resp = $ua->request($req, $file_path); > > my $sec_file_path = "members/data/$username"; > > my $outfile = "index.html"; > > my $filename = "$sec_file_path/$outfile"; > > open (FILE,">>$filename"); > > Line 61 -->{ print FILE "Problem on $date3"; } > > close (FILE); > > } > > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > > schedule where schedule.system_name = safelists.system_name and > schedule.SUN > > != '0'"; > > $buffer2 .= "===> Executing Query: $query2\n\n"; > > my $sth = $dbh->prepare($query2); > > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > > my $timestamp = $time; > > my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) > > values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; > > $buffer3 .= "===> Executing Query: $query3\n\n"; > > my $sth = $dbh->prepare($query3); > > Line 79 -->my $rc = $sth->execute(); > > } > > undef $sth; > > $dbh->disconnect; > > 0; > > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > > Get Paid to Read Email! > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From andrew at sweger.net Tue Jan 15 12:51:48 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: On Tue, 15 Jan 2002, Susanne Bullo wrote: > print on closed filehandle main::FILE at sunday line 61. Make sure the open() call succeeds first. open(...) || die "Oh dear..."; > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > line 79. Find out what that fatal query really is (print it, debug it, whatever). N.B. - When inserting code samples into your postings to the list, please try to retain the original format. Your code is arriving (for me at least) with all lines flush left and some long lines broken into two. Attaching the relevent text as a file will usually be easier to read and follow (this is where several people will tell me I'm wrong). If, on the other hand, this is how your code is formatted... -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mkorb at versuslaw.com Tue Jan 15 12:55:18 2002 From: mkorb at versuslaw.com (martin korb) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: perl cpu priority Message-ID: <004301c19df6$2cfe3f20$7f01a8c0@tech6> Is there a way that I can set the priority (high,normal,low) for cpu time of a perl script within the same script on a win32 platform. I am been looking at BSD::Resource and Win32::IProcess. Most talk about how to control child process but not how to control the current process. Thanks Martin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 13:08:14 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: References: Message-ID: <20020115110814.H21036@hobart.helvella.org> On Tue, Jan 15, 2002 at 10:33:48AM -0800, David Dyck wrote: > On Tue, 15 Jan 2002 at 10:26 -0800, Susanne Bullo ...: > > > Yes, actually I do intend that - the username to log in is just for the > > database. Then there are several users within that database so $username > > would have to be overwritten for each one. > > > > How do I go about checking the return result on my open()? > > in perldoc -f open it states > Open returns nonzero upon success, the undefined value otherwise. > so test the return result. Also, please read 'perldoc -f close'. It is just as important to check the return value of close, if the filehandle in question was written to. close Closes the file or pipe associated with the file handle, returning true only if stdio successfully flushes buffers and closes the system file descriptor. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Tue Jan 15 13:11:50 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: if it's an auto-increment, don't try and explicitly set it to '', that's probably where it is choking. change your query to "INSERT into reports (uid,system_name,last_success_run) values ('$uid','$system_name','$datestamp at $timestamp')"; On Tue, 15 Jan 2002, Susanne Bullo wrote: > Ok, I will place that in there to see if it fails - thanks. > > The weird thing about the number being called out is it's an id number not a > uid. The uid is assigned by the previous line and it doesn't need to be > unique. However, the id for this is supposed to be unique but is set to > automatically increment. So, I don't know why it's trying to overwrite > something that should automatically increment. Guess I'll look at the > properties of that table. > > Thanks for your help! > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > -----Original Message----- > From: Dan Ebert [mailto:mathin@mathin.com] > Sent: Tuesday, January 15, 2002 10:21 AM > To: Susanne Bullo > Cc: Seattle Perl User's Group > Subject: Re: SPUG: Two errors I need hashing out > > > > The print on close file handle error could be cause by the failure of the > open command. You might try > > open(FILE,">>$filename") or die $!; > > to make sure the file is opened. (The die $! will print the error if it > fails.) > > The second SQL error looks like you are attempting to insert a value into > a table field which must be unique ... and there is already an entry with > '127' in that field. The 'key 1' doesn't mean the first value in the > list of values to insert. It refers to the field in the table which is in > conflict with the value you are attempting to insert. > > If you do want to update the table (or insert if it doesn't exist) you > might try the 'replace into' mysql command instead of the 'insert into' > > Hope that helps. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Tue, 15 Jan 2002, Susanne Bullo wrote: > > > Being new, I still haven't a complete clue as to what I'm doing. The > listed > > program is giving the following two errors: > > > > print on closed filehandle main::FILE at sunday line 61. > > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at sunday > > line 79. > > > > I'm at a loss as to what the first one is. The second one I'm thinking > has > > to do with number assigning within the database but I'm not completely > sure > > (there is an id of 127 within the database but that is under id and not > > under uid which seems to be what "key 1" is referencing). > > > > If anyone has a soft spot for a newbie and wants to help me out, I'd > > appreciate it! > > > > #!/usr/bin/perl -w > > use Time::Local; > > use POSIX qw(mktime); > > use DBI; > > use LWP::UserAgent; > > use HTTP::Request; > > use HTTP::Response; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > > 'Thursday','Friday','Saturday'); > > @months = ('January','February','March','April','May','June','July', > > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > > $year += 2000; > > } > > else { > > $year += 1900; > > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; > > $mon2 = $mon + 1; > > $date2 = "$mon2/$mday/$year"; > > $date3 = "$mon2.$mday.$year"; > > } > > my $buffer = ''; > > my $buffer2 = ''; > > my $buffer3 = ''; > > my $host = 'localhost'; > > my $database = 'safelist'; > > my $username = 'admin'; > > my $password = 'srb6653'; > > my $ua = new LWP::UserAgent(); > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > > safelists.password, email_txt.email_subject, email_txt.email_text, > > safelists.uid, members.email from safelists, schedule, email_txt, members > > where email_txt.id = schedule.SUN and schedule.system_name = > > safelists.system_name and members.id = safelists.uid and > > email_txt.email_subject != ''"; > > $buffer .= "===> Executing Query: $query\n\n"; > > my $sth = $dbh->prepare($query); > > my $rc = $sth->execute(); > > while > > > (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u > > id,$email) = $sth->fetchrow_array) { > > my $url = "http://$email_to?action=Send This > > > Message&username=$username&password=$password&subject=$email_subject&message > > =$email_text"; > > $email_text =~ s/\\//g; > > my $req = HTTP::Request->new(GET=>$url); > > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > > my $resp = $ua->request($req, $file_path); > > my $sec_file_path = "members/data/$username"; > > my $outfile = "index.html"; > > my $filename = "$sec_file_path/$outfile"; > > open (FILE,">>$filename"); > > Line 61 -->{ print FILE "Problem on $date3"; } > > close (FILE); > > } > > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > > schedule where schedule.system_name = safelists.system_name and > schedule.SUN > > != '0'"; > > $buffer2 .= "===> Executing Query: $query2\n\n"; > > my $sth = $dbh->prepare($query2); > > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > > my $timestamp = $time; > > $buffer3 .= "===> Executing Query: $query3\n\n"; > > my $sth = $dbh->prepare($query3); > > Line 79 -->my $rc = $sth->execute(); > > } > > undef $sth; > > $dbh->disconnect; > > 0; > > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > > Get Paid to Read Email! > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From BenB at ocentrix.com Tue Jan 15 13:13:49 2002 From: BenB at ocentrix.com (Ben Burnett) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: How to deal with same name packages Message-ID: > -----Original Message----- > From: Tim Maher [mailto:tim@consultix-inc.com] > Sent: Monday, January 14, 2002 7:00 PM > To: spug-list@pm.org > Subject: Re: SPUG: How to deal with same name packages > > > > NOTE: The word "sud", except with a B for the D, is not > allowed in messages, because MajorDomo thinks somebody is > trying to Zubscribe/Unzubscribe. So we use Z for s in such cases! > If this is the case then what about the message footer? It's got Zub and unZub in it. Does that effect the list too? > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; > for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 13:22:54 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: Ok, did the change in the reports mysql insert and changed the open file so it would indicate if it dies - and it does. Now I get an error that says "No such file or directory at sunday line 61". Here is the part in question again: my $query = "SELECT safelists.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, safelists.uid, members.email from safelists, schedule, email_txt, members where email_txt.id = schedule.SUN and schedule.system_name = safelists.system_name and members.id = safelists.uid and email_txt.email_subject != ''"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u id,$email) = $sth->fetchrow_array) { my $url = "http://$email_to?action=Send This Message&username=$username&password=$password&subject=$email_subject&message =$email_text"; $email_text =~ s/\\//g; my $req = HTTP::Request->new(GET=>$url); my $file_path = "members/data/$username/$system_name/$date3.txt"; my $resp = $ua->request($req, $file_path); my $sec_file_path = "members/data/$username"; my $outfile = "index.html"; my $filename = "$sec_file_path/$outfile"; open (FILE,">>$filename") or die $!; { print FILE "Report on $date3
"; } } Does $sec_file_path need to have a full path? Or could it be that it's literally looking for the folder of $username instead of placing the variable there? You guys are great and I appreciate the help! Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Tue Jan 15 13:50:41 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: How to deal with same name packages In-Reply-To: ; from Ben Burnett on Tue, Jan 15, 2002 at 11:13:49AM -0800 References: Message-ID: <20020115115041.A15722@timji.consultix.wa.com> On Tue, Jan 15, 2002 at 11:13:49AM -0800, Ben Burnett wrote: > > If this is the case then what about the message footer? It's got Zub and > unZub in it. Does that effect the list too? > I figure that Majordomo doesn't "see" that, because it's added on after the message is scanned for no-no's. -Tim > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your > > Email-address For daily traffic, use spug-list for LIST ; > > for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > -- *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 14:00:55 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: References: Message-ID: <20020115120055.J21036@hobart.helvella.org> On Tue, Jan 15, 2002 at 11:22:54AM -0800, Susanne Bullo wrote: > Ok, did the change in the reports mysql insert and changed the open file so > it would indicate if it dies - and it does. Now I get an error that says > "No such file or directory at sunday line 61". Here is the part in question > again: [...] > my $file_path = "members/data/$username/$system_name/$date3.txt"; > my $resp = $ua->request($req, $file_path); > my $sec_file_path = "members/data/$username"; > my $outfile = "index.html"; > my $filename = "$sec_file_path/$outfile"; > open (FILE,">>$filename") or die $!; > { print FILE "Report on $date3
"; } > > } > > Does $sec_file_path need to have a full path? Or could it be that it's > literally looking for the folder of $username instead of placing the > variable there? $sec_file_path needs to be either an absolute path, or relative to the current working directory. The current working dir will be the directory that the script was started in, as nothing in your code changes dir. The folder containing the file must already exist. You can add a print statement or run through the debugger (perl -d) to see for yourself what the values of $sec_file_path and $filename are. You are using double quotes, which allows the interpolation of variable names to their values within the string. Had you been using single quotes, then the interpolation would be prevented, and you'd be looking for a directory called literally '$username'. Hope to see you all at the meeting tonite... ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Tue Jan 15 14:10:33 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out Message-ID: <6D6F0541E2B1D411A75B0002A513016D0280017E@wacorpml03.wwireless.com> Since you enclosed the variable $username in doublequotes Perl will properly expand it to it's value, so it's not literally looking for the '$username' directory. Try doing the following: use CWD; my $dir = getcwd(); open (FILE,">>$filename") or die "Error opening $dir/$filename: $!"; Ryan Parr -----Original Message----- From: Susanne Bullo [mailto:sweetsue@sweethomes.com] Sent: Tuesday, January 15, 2002 11:23 AM To: Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out Ok, did the change in the reports mysql insert and changed the open file so it would indicate if it dies - and it does. Now I get an error that says "No such file or directory at sunday line 61". Here is the part in question again: my $query = "SELECT safelists.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, safelists.uid, members.email from safelists, schedule, email_txt, members where email_txt.id = schedule.SUN and schedule.system_name = safelists.system_name and members.id = safelists.uid and email_txt.email_subject != ''"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while (my($email_to,$username,$password,$email_subject,$email_text,$system_name,$u id,$email) = $sth->fetchrow_array) { my $url = "http://$email_to?action=Send This Message&username=$username&password=$password&subject=$email_subject&message =$email_text"; $email_text =~ s/\\//g; my $req = HTTP::Request->new(GET=>$url); my $file_path = "members/data/$username/$system_name/$date3.txt"; my $resp = $ua->request($req, $file_path); my $sec_file_path = "members/data/$username"; my $outfile = "index.html"; my $filename = "$sec_file_path/$outfile"; open (FILE,">>$filename") or die $!; { print FILE "Report on $date3
"; } } Does $sec_file_path need to have a full path? Or could it be that it's literally looking for the folder of $username instead of placing the variable there? You guys are great and I appreciate the help! Susanne Bullo - Sweet Homes DirectTV DSL Get Paid to Read Email! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Tue Jan 15 14:39:32 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out Message-ID: <6D6F0541E2B1D411A75B0002A513016D0280017F@wacorpml03.wwireless.com> MySQL auto_increment fields can take an empty or NULL value and still work, so I don't think it's choking on that. However it should be left out since you're explicitly defining the fields/order you are inputting data. Why would you have two separate accounts with the same UID though? Did you set up the database? If not then maybe whoever did set this to be a unique index. From the mysql command line: mysql> show keys from reports; -- and -- mysql> show index from reports; This will show you whether or not the UID field is able to be non-unique. So if the Non-Unique field is set to 0, then that's why you have a problem. -- Ryan -----Original Message----- From: Daryn Nakhuda [mailto:daryn@marinated.org] Sent: Tuesday, January 15, 2002 11:12 AM To: Susanne Bullo Cc: Dan Ebert; Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out if it's an auto-increment, don't try and explicitly set it to '', that's probably where it is choking. change your query to "INSERT into reports (uid,system_name,last_success_run) values ('$uid','$system_name','$datestamp at $timestamp')"; On Tue, 15 Jan 2002, Susanne Bullo wrote: > Ok, I will place that in there to see if it fails - thanks. > > The weird thing about the number being called out is it's an id number > not a uid. The uid is assigned by the previous line and it doesn't > need to be unique. However, the id for this is supposed to be unique > but is set to automatically increment. So, I don't know why it's > trying to overwrite something that should automatically increment. > Guess I'll look at the properties of that table. > > Thanks for your help! > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > -----Original Message----- > From: Dan Ebert [mailto:mathin@mathin.com] > Sent: Tuesday, January 15, 2002 10:21 AM > To: Susanne Bullo > Cc: Seattle Perl User's Group > Subject: Re: SPUG: Two errors I need hashing out > > > > The print on close file handle error could be cause by the failure of > the open command. You might try > > open(FILE,">>$filename") or die $!; > > to make sure the file is opened. (The die $! will print the error if > it > fails.) > > The second SQL error looks like you are attempting to insert a value > into a table field which must be unique ... and there is already an entry with > '127' in that field. The 'key 1' doesn't mean the first value in the > list of values to insert. It refers to the field in the table which > is in conflict with the value you are attempting to insert. > > If you do want to update the table (or insert if it doesn't exist) you > might try the 'replace into' mysql command instead of the 'insert > into' > > Hope that helps. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Tue, 15 Jan 2002, Susanne Bullo wrote: > > > Being new, I still haven't a complete clue as to what I'm doing. > > The > listed > > program is giving the following two errors: > > > > print on closed filehandle main::FILE at sunday line 61. > > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at > > sunday line 79. > > > > I'm at a loss as to what the first one is. The second one I'm > > thinking > has > > to do with number assigning within the database but I'm not > > completely > sure > > (there is an id of 127 within the database but that is under id and > > not under uid which seems to be what "key 1" is referencing). > > > > If anyone has a soft spot for a newbie and wants to help me out, I'd > > appreciate it! > > > > #!/usr/bin/perl -w > > use Time::Local; > > use POSIX qw(mktime); > > use DBI; > > use LWP::UserAgent; > > use HTTP::Request; > > use HTTP::Response; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > > 'Thursday','Friday','Saturday'); > > @months = ('January','February','March','April','May','June','July', > > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > > $year += 2000; > > } > > else { > > $year += 1900; > > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = > > $mon + 1; $date2 = "$mon2/$mday/$year"; > > $date3 = "$mon2.$mday.$year"; > > } > > my $buffer = ''; > > my $buffer2 = ''; > > my $buffer3 = ''; > > my $host = 'localhost'; > > my $database = 'safelist'; > > my $username = 'admin'; > > my $password = 'srb6653'; > > my $ua = new LWP::UserAgent(); > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > > safelists.password, email_txt.email_subject, email_txt.email_text, > > safelists.uid, members.email from safelists, schedule, email_txt, members > > where email_txt.id = schedule.SUN and schedule.system_name = > > safelists.system_name and members.id = safelists.uid and > > email_txt.email_subject != ''"; > > $buffer .= "===> Executing Query: $query\n\n"; > > my $sth = $dbh->prepare($query); > > my $rc = $sth->execute(); > > while > > > (my($email_to,$username,$password,$email_subject,$email_text,$system_n > ame,$u > > id,$email) = $sth->fetchrow_array) { > > my $url = "http://$email_to?action=Send This > > > Message&username=$username&password=$password&subject=$email_subject&m > essage > > =$email_text"; > > $email_text =~ s/\\//g; > > my $req = HTTP::Request->new(GET=>$url); > > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > > my $resp = $ua->request($req, $file_path); > > my $sec_file_path = "members/data/$username"; > > my $outfile = "index.html"; > > my $filename = "$sec_file_path/$outfile"; > > open (FILE,">>$filename"); > > Line 61 -->{ print FILE "Problem on > > $date3"; } close (FILE); } > > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > > schedule where schedule.system_name = safelists.system_name and > schedule.SUN > > != '0'"; > > $buffer2 .= "===> Executing Query: $query2\n\n"; > > my $sth = $dbh->prepare($query2); > > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > > my $timestamp = $time; > > $buffer3 .= "===> Executing Query: $query3\n\n"; > > my $sth = $dbh->prepare($query3); > > Line 79 -->my $rc = $sth->execute(); > > } > > undef $sth; > > $dbh->disconnect; > > 0; > > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > > Get Paid to Read Email! > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Tue Jan 15 14:43:43 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Dang... Message-ID: <6D6F0541E2B1D411A75B0002A513016D02800180@wacorpml03.wwireless.com> It takes forever for e-mail's to be posted... ... maybe forever is a strong word. A long time nonetheless. -- Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020115/ffe93af5/attachment.htm From tim at consultix-inc.com Tue Jan 15 14:53:46 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out Message-ID: <20020115125346.A16184@timji.consultix.wa.com> NOTE from List Owner: All the follow-ups to the original message of this thread, and the original itself, have bounced-back from some of the intended recipients due to the .sig of the original poster containing keywords that wake up SPAM filters. So I recommend that those wishing to issue further follow-ups delete the DirectTV and Get Paid lines first, to allow your messages the widest distribution. DirectTV DSL Get Paid to Read Email! -Tim ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Tue Jan 15 15:20:25 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Tonight's Dinner & Meeting Message-ID: <20020115132025.B16659@timji.consultix.wa.com> Hungry SPUGsters, You are invited to dine with Brian Ingerson, our special guest speaker, tonight at the Cedars restaurant. It's at 47th St. and Brooklyn, in the University District, near the Safeco building where the meeting will take place. The phone number is 527-5247, and we'll meet at 5pm. Around 6:15, we'll head over to the Bigtime Brewery and Alehouse, to conduct "final preparations" for the 7pm meeting, and others might like to join up with us there. Brian tells me that his new module, YAML.pm is destined to be even bigger than Inline.pm, so tonight's meeting is your chance to be one of the first to learn about this revolutionary software. Also, because he'll be moving East *tomorrow*, this will be your *last chance* to see Brian in the PNW for quite a while! Finally, in keeping with our policy of featuring Beginner-level topics periodically, I'll be giving an "Intro to Perl" talk for the first quarter of the meeting. A copy of the original meeting notice is attached. ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= Seattle Perl Users Group January Meeting, 2002 Topic #1: "Intro. to Perl" Speaker: Tim Maher, Consultix (http://www.consultix-inc.com) Topic #2: "YAML: Yet Another Markup Language" Speaker: Brian "Ingy" Ingerson, formerly of ActiveState Corp. Cost: Free! Time: January 15th, 2002, 7pm-9pm Location: Safeco Tower auditorium, University District, Seattle More Info: www.seattleperl.org Pre/Post Meeting: Big Time Brewery and Alehouse http://www.bigtimebrewery.com 4133 University Way NE, Seattle * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** Intro. to Perl ** Tim Maher, Consultix (tim@consultix-inc.com) Topics: + Perl as an outgrowth of the grep, sed, awk,and shell utilities of UNIX + Perl documentation + Perl culture and gatherings + Perl educational resources, online and otherwise + Elementary examples of simple Perl programs + What a module is, and where to look for free ones (viz., CPAN) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** YAML.pm: Yet Another Markup Language ** Brian "Ingy" Ingerson (ingy@cpan.org) YAML (Yet Another Markup Language; aka YAML Ain't Markup Language) is a generic data serialization language that is optimized for human readability. It can be used to express the data structures of most modern programming languages. (including Perl!!!) More information can be found at http://www.yaml.org/. Does your camel YAML? YAML is readable for people. It makes clear sense out of complex data structures. You should find that YAML is an exceptional data dump- ing tool. Structure is shown through indentation, YAML supports recursive data, and hash keys are sorted by default. In addition, YAML supports several styles of scalar formatting for different types of data. YAML is editable. YAML was designed from the ground up to be the ulti- mate syntax for configuration files. All almost all programs need configuration files, so why invent a new syntax for each one. And why subject users to the com- plexities of XML or native Perl code. YAML is multilingual Yes, YAML supports Unicode. But I'm actually referring to programming languages. YAML was designed to meet the serialization needs of Perl, Python, Tcl, PHP, Java. It was also designed to be interoperable between those languages. That means any YAML serialization produced by Perl can be processed by Python, and be guaranteed to return the data structure intact. (Even if it contained Perl specific structures like GLOBs) YAML is taint safe. Using modules like Data::Dumper for serialization is fine as long as you can be sure that nobody can tamper with your data files or transmissions. That's because you need to use Perl's "eval()" built-in to deserial- ize the data. Somebody could add a snippet of Perl to erase your files. Plus much more... -- *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 15:30:21 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D0280017F@wacorpml03.wwireless.com> Message-ID: The uid is being called up from another table in order to be placed in the reports table. The uid can be used over and over. It's the id that should be unique and is setup as such. Running those commands showed me that id is the primary and the non-unique field is set to 0. I can't seem to figure out why it tries to go with 127 as the next id when that's already in place. Scratching my head still. Susanne Bullo - Sweet Homes -----Original Message----- From: Parr, Ryan [mailto:Ryan.Parr@wwireless.com] Sent: Tuesday, January 15, 2002 12:40 PM To: 'Daryn Nakhuda'; Susanne Bullo Cc: Dan Ebert; Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out MySQL auto_increment fields can take an empty or NULL value and still work, so I don't think it's choking on that. However it should be left out since you're explicitly defining the fields/order you are inputting data. Why would you have two separate accounts with the same UID though? Did you set up the database? If not then maybe whoever did set this to be a unique index. From the mysql command line: mysql> show keys from reports; -- and -- mysql> show index from reports; This will show you whether or not the UID field is able to be non-unique. So if the Non-Unique field is set to 0, then that's why you have a problem. -- Ryan -----Original Message----- From: Daryn Nakhuda [mailto:daryn@marinated.org] Sent: Tuesday, January 15, 2002 11:12 AM To: Susanne Bullo Cc: Dan Ebert; Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out if it's an auto-increment, don't try and explicitly set it to '', that's probably where it is choking. change your query to "INSERT into reports (uid,system_name,last_success_run) values ('$uid','$system_name','$datestamp at $timestamp')"; On Tue, 15 Jan 2002, Susanne Bullo wrote: > Ok, I will place that in there to see if it fails - thanks. > > The weird thing about the number being called out is it's an id number > not a uid. The uid is assigned by the previous line and it doesn't > need to be unique. However, the id for this is supposed to be unique > but is set to automatically increment. So, I don't know why it's > trying to overwrite something that should automatically increment. > Guess I'll look at the properties of that table. > > Thanks for your help! > > Susanne Bullo - Sweet Homes > > DirectTV DSL > Get Paid to Read Email! > > > -----Original Message----- > From: Dan Ebert [mailto:mathin@mathin.com] > Sent: Tuesday, January 15, 2002 10:21 AM > To: Susanne Bullo > Cc: Seattle Perl User's Group > Subject: Re: SPUG: Two errors I need hashing out > > > > The print on close file handle error could be cause by the failure of > the open command. You might try > > open(FILE,">>$filename") or die $!; > > to make sure the file is opened. (The die $! will print the error if > it > fails.) > > The second SQL error looks like you are attempting to insert a value > into a table field which must be unique ... and there is already an entry with > '127' in that field. The 'key 1' doesn't mean the first value in the > list of values to insert. It refers to the field in the table which > is in conflict with the value you are attempting to insert. > > If you do want to update the table (or insert if it doesn't exist) you > might try the 'replace into' mysql command instead of the 'insert > into' > > Hope that helps. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Tue, 15 Jan 2002, Susanne Bullo wrote: > > > Being new, I still haven't a complete clue as to what I'm doing. > > The > listed > > program is giving the following two errors: > > > > print on closed filehandle main::FILE at sunday line 61. > > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at > > sunday line 79. > > > > I'm at a loss as to what the first one is. The second one I'm > > thinking > has > > to do with number assigning within the database but I'm not > > completely > sure > > (there is an id of 127 within the database but that is under id and > > not under uid which seems to be what "key 1" is referencing). > > > > If anyone has a soft spot for a newbie and wants to help me out, I'd > > appreciate it! > > > > #!/usr/bin/perl -w > > use Time::Local; > > use POSIX qw(mktime); > > use DBI; > > use LWP::UserAgent; > > use HTTP::Request; > > use HTTP::Response; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > > 'Thursday','Friday','Saturday'); > > @months = ('January','February','March','April','May','June','July', > > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > > $year += 2000; > > } > > else { > > $year += 1900; > > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = > > $mon + 1; $date2 = "$mon2/$mday/$year"; > > $date3 = "$mon2.$mday.$year"; > > } > > my $buffer = ''; > > my $buffer2 = ''; > > my $buffer3 = ''; > > my $host = 'localhost'; > > my $database = 'safelist'; > > my $username = 'admin'; > > my $password = 'srb6653'; > > my $ua = new LWP::UserAgent(); > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > > safelists.password, email_txt.email_subject, email_txt.email_text, > > safelists.uid, members.email from safelists, schedule, email_txt, members > > where email_txt.id = schedule.SUN and schedule.system_name = > > safelists.system_name and members.id = safelists.uid and > > email_txt.email_subject != ''"; > > $buffer .= "===> Executing Query: $query\n\n"; > > my $sth = $dbh->prepare($query); > > my $rc = $sth->execute(); > > while > > > (my($email_to,$username,$password,$email_subject,$email_text,$system_n > ame,$u > > id,$email) = $sth->fetchrow_array) { > > my $url = "http://$email_to?action=Send This > > > Message&username=$username&password=$password&subject=$email_subject&m > essage > > =$email_text"; > > $email_text =~ s/\\//g; > > my $req = HTTP::Request->new(GET=>$url); > > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > > my $resp = $ua->request($req, $file_path); > > my $sec_file_path = "members/data/$username"; > > my $outfile = "index.html"; > > my $filename = "$sec_file_path/$outfile"; > > open (FILE,">>$filename"); > > Line 61 -->{ print FILE "Problem on > > $date3"; } close (FILE); } > > my $query2 = "SELECT safelists.uid, schedule.system_name from safelists, > > schedule where schedule.system_name = safelists.system_name and > schedule.SUN > > != '0'"; > > $buffer2 .= "===> Executing Query: $query2\n\n"; > > my $sth = $dbh->prepare($query2); > > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > > my $timestamp = $time; > > $buffer3 .= "===> Executing Query: $query3\n\n"; > > my $sth = $dbh->prepare($query3); > > Line 79 -->my $rc = $sth->execute(); > > } > > undef $sth; > > $dbh->disconnect; > > 0; > > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > > Get Paid to Read Email! > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tuck at whistlingfish.net Tue Jan 15 15:45:37 2002 From: tuck at whistlingfish.net (Matt Tucker) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: The issue with subroutines Message-ID: <230470000.1011131137@benzene> I have a hard time believing that anyone would write list software that cared about the three-character combination "sub" _anywhere_ it might appear in the message. That seems ridiculous (particularly on a Perl list!) Perhaps it's only at the beginning of the line? Anyway, I'm testing it out to see what the list thinks about it. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : http://mail.pm.org/archives/spug-list/attachments/20020115/3efae307/attachment.bin From sweetsue at sweethomes.com Tue Jan 15 16:27:46 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D0280017F@wacorpml03.wwireless.com> Message-ID: Hm, further checking into this seems to show that the MySQL insert gets to the id of 127 and just stops. Then it tries to overwrite 127 over and over again. Weird. Anyone know just enough MySQL to allude to what would cause this? If not, I'll see if I can get this resolved via a MySQL help site. Susanne Bullo - Sweet Homes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 16:34:40 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: Ok, just after I sent this, it dawned on me that tinyint would limit to 127. Hence my problem. Sorry to have wasted time! Susanne Bullo - Sweet Homes -----Original Message----- From: Susanne Bullo [mailto:sweetsue@sweethomes.com] Sent: Tuesday, January 15, 2002 2:28 PM To: Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out Hm, further checking into this seems to show that the MySQL insert gets to the id of 127 and just stops. Then it tries to overwrite 127 over and over again. Weird. Anyone know just enough MySQL to allude to what would cause this? If not, I'll see if I can get this resolved via a MySQL help site. Susanne Bullo - Sweet Homes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Tue Jan 15 16:46:52 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Tonight's Dinner & Meeting In-Reply-To: <20020115132025.B16659@timji.consultix.wa.com> References: <20020115132025.B16659@timji.consultix.wa.com> Message-ID: <20020115144651.A23998@hobart.helvella.org> On Tue, Jan 15, 2002 at 01:20:25PM -0800, Tim Maher wrote: > Hungry SPUGsters, > > You are invited to dine with Brian Ingerson, our special guest speaker, > tonight at the Cedars restaurant. It's at 47th St. and Brooklyn, in You'll find it closer to 50th St, across the street from Safeway. See you there, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Tue Jan 15 17:08:41 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out Message-ID: <6D6F0541E2B1D411A75B0002A513016D02800181@wacorpml03.wwireless.com> Maybe you could post the results of a "describe reports;" command so we can see what all your field types are. MySQL supports (through emulation) using placeholders in your SQL statements. With placeholders you never need to comment your stuff, as the DBI module will take care of that for you. Using placeholders would turn: my $query3 = "INSERT into reports (uid, system_name, last_success_run, id) values ('$uid', '$system_name', '$datestamp at $timestamp', '')"; $buffer3 .= "===> Executing Query: $query3\n\n"; my $sth = $dbh->prepare($query3); $sth->execute; Into: my $query3 = "INSERT INTO reports (uid,system_name,last_success_run) VALUES (?,?,?)"; my $sth = $dbh->prepare($query3); $sth->execute($uid,$system_name,"$datestamp at $timestamp"); The main benefit of this is that you can _re-use_ the statement handle, which is being used in a loop. Then instead of recreating the handle you can simply create the handle outside of the loop and re-execute inside the loop. This can be a major bonus if you loop a bunch of times. And it's (IMHO) much cleaner. In databases other than MySQL it can have huge performance increases in terms of database processing speed. ButMySQL doesn't do that. -- Ryan -----Original Message----- From: Susanne Bullo [mailto:sweetsue@sweethomes.com] Sent: Tuesday, January 15, 2002 1:30 PM To: Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out The uid is being called up from another table in order to be placed in the reports table. The uid can be used over and over. It's the id that should be unique and is setup as such. Running those commands showed me that id is the primary and the non-unique field is set to 0. I can't seem to figure out why it tries to go with 127 as the next id when that's already in place. Scratching my head still. Susanne Bullo - Sweet Homes -----Original Message----- From: Parr, Ryan [mailto:Ryan.Parr@wwireless.com] Sent: Tuesday, January 15, 2002 12:40 PM To: 'Daryn Nakhuda'; Susanne Bullo Cc: Dan Ebert; Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out MySQL auto_increment fields can take an empty or NULL value and still work, so I don't think it's choking on that. However it should be left out since you're explicitly defining the fields/order you are inputting data. Why would you have two separate accounts with the same UID though? Did you set up the database? If not then maybe whoever did set this to be a unique index. From the mysql command line: mysql> show keys from reports; -- and -- mysql> show index from reports; This will show you whether or not the UID field is able to be non-unique. So if the Non-Unique field is set to 0, then that's why you have a problem. -- Ryan -----Original Message----- From: Daryn Nakhuda [mailto:daryn@marinated.org] Sent: Tuesday, January 15, 2002 11:12 AM To: Susanne Bullo Cc: Dan Ebert; Seattle Perl User's Group Subject: RE: SPUG: Two errors I need hashing out if it's an auto-increment, don't try and explicitly set it to '', that's probably where it is choking. change your query to "INSERT into reports (uid,system_name,last_success_run) values ('$uid','$system_name','$datestamp at $timestamp')"; On Tue, 15 Jan 2002, Susanne Bullo wrote: > Ok, I will place that in there to see if it fails - thanks. > > The weird thing about the number being called out is it's an id number > not a uid. The uid is assigned by the previous line and it doesn't > need to be unique. However, the id for this is supposed to be unique > but is set to automatically increment. So, I don't know why it's > trying to overwrite something that should automatically increment. > Guess I'll look at the properties of that table. > > Thanks for your help! > > > -----Original Message----- > From: Dan Ebert [mailto:mathin@mathin.com] > Sent: Tuesday, January 15, 2002 10:21 AM > To: Susanne Bullo > Cc: Seattle Perl User's Group > Subject: Re: SPUG: Two errors I need hashing out > > > > The print on close file handle error could be cause by the failure of > the open command. You might try > > open(FILE,">>$filename") or die $!; > > to make sure the file is opened. (The die $! will print the error if > it > fails.) > > The second SQL error looks like you are attempting to insert a value > into a table field which must be unique ... and there is already an > entry with > '127' in that field. The 'key 1' doesn't mean the first value in the > list of values to insert. It refers to the field in the table which > is in conflict with the value you are attempting to insert. > > If you do want to update the table (or insert if it doesn't exist) you > might try the 'replace into' mysql command instead of the 'insert > into' > > Hope that helps. > > Dan. > ---------------------------------------------------------- > Immigration is the sincerest form of flattery. > - Unknown > ---------------------------------------------------------- > > > On Tue, 15 Jan 2002, Susanne Bullo wrote: > > > Being new, I still haven't a complete clue as to what I'm doing. The > listed > > program is giving the following two errors: > > > > print on closed filehandle main::FILE at sunday line 61. > > DBD::mysql::st execute failed: Duplicate entry '127' for key 1 at > > sunday line 79. > > > > I'm at a loss as to what the first one is. The second one I'm > > thinking > has > > to do with number assigning within the database but I'm not > > completely > sure > > (there is an id of 127 within the database but that is under id and > > not under uid which seems to be what "key 1" is referencing). > > > > If anyone has a soft spot for a newbie and wants to help me out, I'd > > appreciate it! > > > > #!/usr/bin/perl -w > > use Time::Local; > > use POSIX qw(mktime); > > use DBI; > > use LWP::UserAgent; > > use HTTP::Request; > > use HTTP::Response; > > &get_date; > > sub get_date { > > @days = ('Sunday','Monday','Tuesday','Wednesday', > > 'Thursday','Friday','Saturday'); > > @months = ('January','February','March','April','May','June','July', > > 'August','September','October','November','December'); > > ($sec,$min,$hour,$mday,$mon,$year,$wday) = > (localtime(time))[0,1,2,3,4,5,6]; > > $time = sprintf("%02d:%02d",$hour,$min); > > if ($year < 50){ > > $year += 2000; > > } > > else { > > $year += 1900; > > } > > $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = > > $mon + 1; $date2 = "$mon2/$mday/$year"; $date3 = > > "$mon2.$mday.$year"; } > > my $buffer = ''; > > my $buffer2 = ''; > > my $buffer3 = ''; > > my $host = 'localhost'; > > my $database = 'safelist'; > > my $username = 'admin'; > > my $password = 'srb6653'; > > my $ua = new LWP::UserAgent(); > > my $dbh = DBI->connect("DBI:mysql:$database", $username, $password) || die > > "Failed DBI connect(): $!\n"; > > my $query = "SELECT safelists.email_to, safelists.username, > > safelists.password, email_txt.email_subject, email_txt.email_text, > > safelists.uid, members.email from safelists, schedule, email_txt, members > > where email_txt.id = schedule.SUN and schedule.system_name = > > safelists.system_name and members.id = safelists.uid and > > email_txt.email_subject != ''"; $buffer .= "===> Executing Query: > > $query\n\n"; my $sth = $dbh->prepare($query); > > my $rc = $sth->execute(); > > while > > > (my($email_to,$username,$password,$email_subject,$email_text,$system_n > ame,$u > > id,$email) = $sth->fetchrow_array) { > > my $url = "http://$email_to?action=Send This > > > Message&username=$username&password=$password&subject=$email_subject&m > essage > > =$email_text"; > > $email_text =~ s/\\//g; > > my $req = HTTP::Request->new(GET=>$url); > > my $file_path = "./members/data/$username/$system_name/$date3.txt"; > > my $resp = $ua->request($req, $file_path); > > my $sec_file_path = "members/data/$username"; > > my $outfile = "index.html"; > > my $filename = "$sec_file_path/$outfile"; > > open (FILE,">>$filename"); > > Line 61 -->{ print FILE "Problem on > > $date3"; } close (FILE); } my $query2 = "SELECT safelists.uid, > > schedule.system_name from safelists, schedule where > > schedule.system_name = safelists.system_name and > schedule.SUN > > != '0'"; > > $buffer2 .= "===> Executing Query: $query2\n\n"; > > my $sth = $dbh->prepare($query2); > > my $rc = $sth->execute(); > > while (my($uid,$system_name) = $sth->fetchrow_array) { > > my $datestamp = $date2; > > my $timestamp = $time; > > $buffer3 .= "===> Executing Query: $query3\n\n"; > > my $sth = $dbh->prepare($query3); > > Line 79 -->my $rc = $sth->execute(); > > } > > undef $sth; > > $dbh->disconnect; > > 0; > > > > Susanne Bullo - Sweet Homes > > DirectTV DSL > > Get Paid to Read Email! > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Ryan.Parr at wwireless.com Tue Jan 15 17:19:10 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: The issue with subroutines Message-ID: <6D6F0541E2B1D411A75B0002A513016D02800182@wacorpml03.wwireless.com> Particularly since the SPUG footer which contains the words "Zubscribe" and "Unzubscribe" get's included in the replies, and has been getting included in replies for some time, but has not been changed. Does majordomo also look for that particular footer and ignore it? -- Ryan -----Original Message----- From: Matt Tucker [mailto:tuck@whistlingfish.net] Sent: Tuesday, January 15, 2002 1:46 PM To: Seattle Perl User's Group Subject: SPUG: The issue with subroutines I have a hard time believing that anyone would write list software that cared about the three-character combination "sub" _anywhere_ it might appear in the message. That seems ridiculous (particularly on a Perl list!) Perhaps it's only at the beginning of the line? Anyway, I'm testing it out to see what the list thinks about it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mcglk at artlogix.com Tue Jan 15 17:30:38 2002 From: mcglk at artlogix.com (Ken McGlothlen) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: References: Message-ID: <877kqj5h0h.fsf@ralf.artlogix.com> "Susanne Bullo" writes: | If anyone has a soft spot for a newbie and wants to help me out, I'd | appreciate it! I'm not sure I'd want to help out a known, chronic spammer or spam-friendly site. I mean, I'm helpful, but aiding and abetting a lawbreaker isn't my idea of a good time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mcglk at artlogix.com Tue Jan 15 17:32:50 2002 From: mcglk at artlogix.com (Ken McGlothlen) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: <20020115125346.A16184@timji.consultix.wa.com> References: <20020115125346.A16184@timji.consultix.wa.com> Message-ID: <873d175gwt.fsf@ralf.artlogix.com> Tim Maher writes: | All the follow-ups to the original message of this thread, and the | original itself, have bounced-back from some of the intended recipients | due to the .sig of the original poster containing keywords that wake up | SPAM filters. Actually, it may be due to the spams that referenced sites hosted at sweethomes.com that have been going around. I still have quite a few of those. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 15 18:11:38 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: <877kqj5h0h.fsf@ralf.artlogix.com> Message-ID: Um, actually I'm not a known spammer - my server is currently being used by someone for this purpose (something I am working on at this very moment). My server is being listed as we can't pinpoint where they are getting in (though at this point it looks like an old unused mailman program may be the culprit). It's nice to know you are so friendly :) Susanne Bullo - Sweet Homes -----Original Message----- From: mcglk@ralf.artlogix.com [mailto:mcglk@ralf.artlogix.com]On Behalf Of Ken McGlothlen Sent: Tuesday, January 15, 2002 3:31 PM To: sweetsue@sweethomes.com Cc: Seattle Perl User's Group Subject: Re: SPUG: Two errors I need hashing out "Susanne Bullo" writes: | If anyone has a soft spot for a newbie and wants to help me out, I'd | appreciate it! I'm not sure I'd want to help out a known, chronic spammer or spam-friendly site. I mean, I'm helpful, but aiding and abetting a lawbreaker isn't my idea of a good time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jimfl at colltech.com Tue Jan 15 18:17:37 2002 From: jimfl at colltech.com (Jim Flanagan) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: The issue with subroutines In-Reply-To: <6D6F0541E2B1D411A75B0002A513016D02800182@wacorpml03.wwireless.com> References: <6D6F0541E2B1D411A75B0002A513016D02800182@wacorpml03.wwireless.c om> Message-ID: <2011895.1011111457@[0.0.0.0]> --On Tuesday, January 15, 2002 3:19 PM -0800 "Parr, Ryan" wrote: > Particularly since the SPUG footer which contains the words > "Zubscribe" and "Unzubscribe" get's included in the replies, and has > been getting included in replies for some time, but has not been > changed. Does majordomo also look for that particular footer and > ignore it? And don't forget that the majority of the messages also have a Zubject: line in the header! -- Jim Flanagan jimfl@colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From aaronp at amazon.com Tue Jan 15 18:46:03 2002 From: aaronp at amazon.com (Aaron Paul) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: The issue with subroutines References: <6D6F0541E2B1D411A75B0002A513016D02800182@wacorpml03.wwireless.c om> <2011895.1011111457@[0.0.0.0]> Message-ID: <3C44CD4B.1723F11E@amazon.com> majordomo commands must be in the body of a message. -Aaron Jim Flanagan wrote: > --On Tuesday, January 15, 2002 3:19 PM -0800 "Parr, Ryan" > wrote: > > > Particularly since the SPUG footer which contains the words > > "Zubscribe" and "Unzubscribe" get's included in the replies, and has > > been getting included in replies for some time, but has not been > > changed. Does majordomo also look for that particular footer and > > ignore it? > > And don't forget that the majority of the messages also have a Zubject: > line in the header! > > -- > Jim Flanagan > jimfl@colltech.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From mcglk at artlogix.com Tue Jan 15 19:01:38 2002 From: mcglk at artlogix.com (Ken McGlothlen) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: References: Message-ID: <87sn973y8d.fsf@ralf.artlogix.com> "Susanne Bullo" writes: | Um, actually I'm not a known spammer - my server is currently being used by | someone for this purpose (something I am working on at this very moment). | My server is being listed as we can't pinpoint where they are getting in | (though at this point it looks like an old unused mailman program may be the | culprit). | | It's nice to know you are so friendly :) After a couple of dozen from the same source, it's hard to maintain patience. The one upside to the whole thing is that I learned a little about purchasing liens. But it wasn't *useful* information. :) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Tue Jan 15 19:01:34 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:34 2004 Subject: SPUG: Two errors I need hashing out In-Reply-To: Message-ID: > I'm not sure I'd want to help out a known, chronic spammer or spam-friendly > site. I mean, I'm helpful, but aiding and abetting a lawbreaker isn't my > idea of a good time. Ken, Please don't waste all of our time with this kind of post. 1. it was obnoxious. 2. the original post & ensuing thread was completely perl related and therefore appropriate. 3. was there really any benefit to the whole group hearing you be a smart-ass? 4. sounds like you were wrongly accusing her anyway. if you have a reply to this, keep it off the list. -daryn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sthoenna at efn.org Wed Jan 16 00:27:28 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Debugging methodology References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020115004613.A40924@www.ladro.com> Message-ID: In article <20020115004613.A40924@www.ladro.com>, Chris Wilkes wrote: >If you made Debug a constant then there wouldn't be a performance hit as >it would get optimized away at run/compile time, if my memory of a >recent TPJ article by Sean Burke is correct. > >With DEBUG => 3 then you'll have "If (3 > 0) { print }" which will get >optimized to just "print" Likewise if you had DEBUG => 0 the whole "if >( 0 > 0 ) {}" will get thrown out. Actually, it seems (on 5.6.1) to get optimized to just "do { print }", which is slightly less efficient. The other problem with that approach is that you can't change it mid-code the way you can a $debug flag. One fix would be to have something like this at the top of your module: our $debug; BEGIN { *DEBUG = defined $debug ? sub () { $debug } : sub () { 0 } } and then say in the code something like: sub blah { debug_log("entering blah for $_[0]") if DEBUG; Here, if (at the time of the 'use' of your module) there is a $module::debug variable defined, DEBUG is a dynamic function, returning whatever the user has currently set $module::debug to. If not, DEBUG is a constant 0 which is optimized away. So, if you want to debug only a particular call to method blah for a Blah object, say: $Blah::debug = 0; use Blah; ... $Blah::debug = 1; $blah_obj->blah; $Blah::debug = 0; Some will be bothered by the violation of the Blah namespace by a foreign entity. Unfortunately, you can't have something like: use Blah debug => 0; since the args to use are only handled at import time, and you need $debug set somehow before Blah.pm is compiled. One suggestion (which I saw from Ilya Z.) is to have a separate init module that can be used before the module proper: use Blah::Init debug => 0; # sets a $Blah::debug flag use Blah; # refers to $Blah::debug via BEGIN line above - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jason at strangelight.com Wed Jan 16 06:37:56 2002 From: jason at strangelight.com (Jason Lamport) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: helping spammers (was: Two errors I need hashing out) In-Reply-To: References: Message-ID: While I agree that the smart-ass tone of Ken's post was not helpful, it seems to me that if one has reason to believe that someone posting on this list is seeking information to be used for some unethical or illegal purpose, then it is perfectly appropriate to alert the rest of us to that fact. I consider spam to be a serious problem, and as part of the internet community, I believe we have an obligation to do what we can to stop it -- including ostracizing known spammers from such forums as SPUG. Again, I'm not defending the exact content of Ken's post: there was no need to be rude or obnoxious (and I personally would have given the OP the benefit of the doubt, and *asked* her about the spams before jumping to conclusions). But I do think that (well-founded) accusations of spamming are completely appropriate on this list. Of course, it's ultimately the moderator's decision what is and is not off-topic, and if Tim decides that it's none of our business what a poster chooses to do with the information we share -- even if it's grossly unethical -- then I will certainly respect that decision. But while the matter is up for discussion, I wanted to explain why I (somewhat) disagree with Daryn on this point. -jason At 5:01 pm -0800 1/15/02, Daryn Nakhuda wrote: > > I'm not sure I'd want to help out a known, chronic spammer or spam-friendly >> site. I mean, I'm helpful, but aiding and abetting a lawbreaker isn't my >> idea of a good time. > >Ken, > >Please don't waste all of our time with this kind of post. > >1. it was obnoxious. >2. the original post & ensuing thread was completely perl related and >therefore appropriate. >3. was there really any benefit to the whole group hearing you be a >smart-ass? >4. sounds like you were wrongly accusing her anyway. > >if you have a reply to this, keep it off the list. > >-daryn > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Wed Jan 16 10:11:41 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: helping spammers (was: Two errors I need hashing out) In-Reply-To: Message-ID: Oh, wow. It occurred to me that my project does look like that. And coupled with the blacklisting I have right now for the spam flying through my servers, that looks really bad. I feel the need to explain the project - it's not for spamming but rather for a project by a fellow who needs to have safelist submission automated. From what I understand (and I went through and joined several to see exactly how they worked), you must actually join and wish to join a safelist in order to receive emails from it. Therefore, it is requested information and not spam. I wanted to assure people that I do not condone spam - it's become a pain in the backside for me as of late what with thousands and thousands of bounce messages and hundreds of remove messages for things I have no control over. Trying to completely pinpoint this has been a major headache. Anyway, I hope I've cleared things up. I certainly do not want to be labeled for something I'm not doing. Susanne Bullo - Sweet Homes -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Jason Lamport Sent: Wednesday, January 16, 2002 4:38 AM To: Daryn Nakhuda; Seattle Perl User's Group Subject: SPUG: helping spammers (was: Two errors I need hashing out) While I agree that the smart-ass tone of Ken's post was not helpful, it seems to me that if one has reason to believe that someone posting on this list is seeking information to be used for some unethical or illegal purpose, then it is perfectly appropriate to alert the rest of us to that fact. I consider spam to be a serious problem, and as part of the internet community, I believe we have an obligation to do what we can to stop it -- including ostracizing known spammers from such forums as SPUG. Again, I'm not defending the exact content of Ken's post: there was no need to be rude or obnoxious (and I personally would have given the OP the benefit of the doubt, and *asked* her about the spams before jumping to conclusions). But I do think that (well-founded) accusations of spamming are completely appropriate on this list. Of course, it's ultimately the moderator's decision what is and is not off-topic, and if Tim decides that it's none of our business what a poster chooses to do with the information we share -- even if it's grossly unethical -- then I will certainly respect that decision. But while the matter is up for discussion, I wanted to explain why I (somewhat) disagree with Daryn on this point. -jason - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From andrew at sweger.net Wed Jan 16 15:04:03 2002 From: andrew at sweger.net (Andrew Sweger) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: helping spammers (was: Two errors I need hashing out) In-Reply-To: Message-ID: On Wed, 16 Jan 2002, Jason Lamport wrote: > accusations of spamming are completely appropriate on this list. Not without clear evidence. And even then, it would be better to arrange an announcement through a known/trusted source (wrt the list), like Tim. > ...it's ultimately the moderator's decision what is and is > not off-topic... This is an un-moderated list. There are feedback control mechanisms in operation, but nothing that controls postings (except for /su[b]/). -- Andrew B. Sweger -- The great thing about multitasking is that several things can go wrong at once. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From kkkk5012 at yahoo.co.kr Thu Jan 17 04:34:45 2002 From: kkkk5012 at yahoo.co.kr (±èÁ¤Àº) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: (Á¤º¸) ¡ÚÅ·Ä«, ÄýÄ«¸¦ ãÀ¸¼¼¿ä???????????????????????? Message-ID: <200201171035.g0HAZ1615073@mail.pm.org> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020117/a89038c8/attachment.htm From warner at oz.net Thu Jan 17 03:49:36 2002 From: warner at oz.net (Marion Scott Warner) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Re: Senior Software Engineer - Linux/Unix References: Message-ID: <3C469E30.18EC91B1@oz.net> Heather, So thanks for forwarding my email to Chairman Bill. I guess the idea of the "Blue Screen of Death Cafe" accross the street from Bill's office did not seem all that appealing. Have you ever seen the 'Got Milk' commercial? You know what I use to say at work when everyone got another Windows virus or the Blue Screen of Death? Got Linux? I actually got several converts, go figure. The only problem with Bill's thinking is that trying to add security/relability to an Operating System that has already been written is sort of like trying to turn a Volks Wagon into a Rolls Royce. Not going to happen. Security and reliability need to be part and parcel to the initial design of the Operating System, not an afterthought. That being the case the OS folks better start from scratch. They could either consider using Linux or FreeBSD as a model and go from there. Or forget it and start porting the applications software to Linux. The latter would seem to be the most practical considering how long it takes to write a new OS, and the Linux Kernel would be that much further along by the time your OS was complete. In the event you wish to port I would be more than glad to offer my services http://sense-warner-200.oz.net/resume.html ------------------------------------------------------------------- So I can help you all out by porting all of your applications to a more stable operating system, Linux of course. The future is clear enough from where I'm sitting. Evolve or become extinct! I like Microsoft Applications software OK, but running it on a crappy OS sort of defeats the purpose, does it not? Why do you think Linux has expanded so quickly. Because there are those of us who have no time for the "Blue Screen of Death" !! Reliability/security should not be an after thought in the design of an OS ! Lets see, I can get a free operating system that is stable, or I can pay good money for one that is not. Seems like a no brainer and I bet your Average Joe eventually figures this out. Certainly many Corporations have. So I'm thinking about opening a cafe across the street from the Redmond Campus. What do you think of the name "The Blue Screen of Death Cafe". Pretty cool eh? Regards Scott Warner Heather Hamilton wrote: > OK, then why are you sending me your resume? > > -----Original Message----- > From: Marion Scott Warner [mailto:warner@oz.net] > Sent: Tuesday, January 08, 2002 7:06 AM > To: Heather Hamilton > Subject: Senior Software Engineer - Linux/Unix > > So, are there any plans in Microsoft's future to port existing > applications to Linux? > Microsoft should really get out of the operating system business and > stick to something > they are competent at. I quit using Microsoft products 3 years ago > because the operating system > was so unreliable that I could not take seriously using Microsoft > products in conducting business. > When your ready to start porting to a real operating system let me > know. > Oh, and while you all are > trying to sue Lindows maybe you should go after MIT as well for > X-Windows. > http://sense-warner-200.oz.net/resume.html > > Regards > Scott Warner -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020117/28c43812/attachment.htm From ryan.bark at onebox.com Thu Jan 17 15:39:30 2002 From: ryan.bark at onebox.com (Ryan Bark) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Re: Senior Software Engineer - Linux/Unix Message-ID: <20020117213930.GCIK29441.mta11.onebox.com@onebox.com> Scott, Why did you CC the SPUG list on your rant to a Microsoft employee? I would rather not have the SPUG remotely associated with that kind of email. -- Ryan Bark ---- Marion Scott Warner wrote: > > Heather, > > So thanks for forwarding my email to Chairman Bill. I guess the idea > of > the > "Blue Screen of Death Cafe" accross the street from Bill's office did > not > seem all that appealing. Have you ever seen the 'Got Milk' commercial? > You know what I use to say at work when everyone got another Windows > virus > or the Blue Screen of Death? > Got Linux? I actually got several converts, go figure. > The only problem with Bill's thinking is that trying to add > security/relability to an Operating > System that has already been written is sort of like trying to turn > a > Volks Wagon > into a Rolls Royce. Not going to happen. Security and reliability need > to be part and parcel > to the initial design of the Operating System, not an afterthought. > That > being the case > the OS folks better start from scratch. They could either consider > using > Linux or FreeBSD > as a model and go from there. Or forget it and start porting the > applications software to Linux. > The latter would seem to be the most practical considering how long > it > takes to write a new OS, > and the Linux Kernel would be that much further along by the time your > OS was complete. > In the event you wish to port I would be more than glad to offer my > services > http://sense-warner-200.oz.net/resume.html > ------------------------------------------------------------------- > > So I can help you all out by porting all of your applications to a > more > stable > operating system, Linux of course. The future is clear enough from > where > I'm sitting. > Evolve or become extinct! > I like Microsoft Applications software OK, but running it on a crappy > OS > sort of > defeats the purpose, does it not? > Why do you think Linux has expanded so quickly. > Because there are those of us who have no time for the "Blue Screen > of > Death" !! > Reliability/security should not be an after thought in the design of > an > OS ! > Lets see, I can get a free operating system that is stable, or I can > pay > good money > for one that is not. Seems like a no brainer and I bet your Average > Joe > eventually figures this out. > Certainly many Corporations have. > So I'm thinking about opening a cafe across the street from the Redmond > Campus. > What do you think of the name "The Blue Screen of Death Cafe". Pretty > cool eh? > > Regards > Scott Warner > > Heather Hamilton wrote: > > > OK, then why are you sending me your resume? > > > > -----Original Message----- > > From: Marion Scott Warner [mailto:warner@oz.net] > > Sent: Tuesday, January 08, 2002 7:06 AM > > To: Heather Hamilton > > Subject: Senior Software Engineer - Linux/Unix > > > > So, are there any plans in Microsoft's future to port existing > > applications to Linux? > > Microsoft should really get out of the operating system business > and > > stick to something > > they are competent at. I quit using Microsoft products 3 years ago > > because the operating system > > was so unreliable that I could not take seriously using Microsoft > > products in conducting business. > > When your ready to start porting to a real operating system let me > > know. > > Oh, and while you all are > > trying to sue Lindows maybe you should go after MIT as well for > > X-Windows. > > http://sense-warner-200.oz.net/resume.html > > > > Regards > > Scott Warner > > > __________________________________________________ FREE voicemail, email, and fax...all in one place. Sign Up Now! http://www.onebox.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From master at ilove-english.co.kr Thu Jan 17 22:40:15 2002 From: master at ilove-english.co.kr (¾ÆÀÌ·¯ºêÀ×±Û¸®½¬) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: [±¤°í] Èû°Ü¿ü´ø ¿µ¾î! ÀÌÁ¦ ´Ù½Ã ½ÃÀÛÇϽʽÿÀ. Message-ID: <20020118044235.4AA219823E@mail3.panix.com> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020118/17ab0868/attachment.htm From tim at consultix-inc.com Fri Jan 18 14:17:01 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Feb/Apr Perl & UNIX Classes, Seattle Message-ID: <20020118121701.A21209@timji.consultix.wa.com> SPUGsters, Thought some of you might want to know that we're offering several public Perl classes in February and April, in Kirkland. The January deadline for obtaining the 10% discount on registrations is today, but for subscribers to this list, or their colleagues, we'll extend it until next Friday. Let me know if you need any additional information! -Tim P.S. Damian Conway will be teaching some classes through Consultix in June and/or July; I'll let you know when we have a firm schedule established. *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* -------------- next part -------------- From: Tim Maher, CONSULTIX Topic: New Class Schedule; Some Discounts Expiring 1/18; Damian Coming Now that we've all recovered from the Holiday Season, it's time to satisfy those New Year's Resolutions and upgrade computer skills! 8-} So here's our schedule of public classes, all offered in Kirkland WA, through April. Note that the 10% discounts for the February classes expire on Friday (Jan. 18). We're also offering special discounts for students who register for combinations of classes running in the same week; see our web-site (the relevant URLs are provided below) for details. "In other news", Dr. Damian Conway, Australia's "Mad Scientist" of Perl, and award-winning author of Perl modules and the definitive OO Perl book, will be presenting an "Advanced Perl Workshop" for us in June or July. More information will be forthcoming as arrangements are finalized. As usual, we're available to provide on-site training to groups of 3 or more. Let us know your needs, and we'll do our best to satisfy them! +-----------------------------------------------------------+ COURSE DATES Days Discount Expires UNIX Fundamentals 2/11-2/14 4 1/18 Minimal Perl 2/15 1 1/18 Perl Programming 2/19-2/21 3 1/18 Perl Modules 2/22 1 1/18 Shell Programming 4/08-4/10 3 3/04 UNIX Utilities 4/11-4/12 2 3/04 Intermediate Perl 4/15-4/17 3 3/21 Object Oriented Perl 4/18-4/19 1.5 3/21 Database Prog. w/Perl 4/22-4/25 3.5 3/21 COURSE COMBINATIONS: Perl Prog + Modules 2/19-2/22 4 1/18 Shell + Utilities 4/08-4/12 5 3/04 Int Perl + OOP 4/15-4/19 4.5 3/21 +-----------------------------------------------------------+ COMMENTS FROM RECENT STUDENTS: UNIX Fundamentals, by Colin Meyer: "Excellent instructor, very knowledgeable, easy to ask questions. For a 4-day class, I am amazed by all of the information I learned. I would definitely recommend this course to others." Katuo Nakashima, Tech II, AT&T/WS Intermediate Perl Programming, by Tim Maher: "Dr. Tim Maher provided a very good course, and he offered additional help and extra information to those with special needs. I believe his teaching style and experience satisfied all students with different levels of programming background. I consider this one of the best classes I've ever attended!" Jinlan Tomasic, CS Dept., University of Alaska CONSULTIX ON-LINE RESOURCES General Information: http://www.consultix-inc.com On-Site Training: http://www.consultix-inc.com/on-site.html Course Listings: UNIX/Shell, http://www.consultix-inc.com/unixlist.html Perl, http://www.consultix-inc.com/perllist.html Registration and Pricing: http://www.consultix-inc.com/reg.html Instructor Evaluations: http://www.consultix-inc.com/evals.html Course Evaluations: http://www.consultix-inc.com/course_evals.html *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* From sweetsue at sweethomes.com Sat Jan 19 16:22:46 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question Message-ID: Ok, I am trying to figure out the coding for checking to see if a directory exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" book and did a lot of searching and am still stumped. Anyone have a quick and easy answer for me? Thanks! Susanne Bullo - Sweet Homes -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020119/940f7ce0/attachment.htm From bvh at speakeasy.net Sat Jan 19 16:36:41 2002 From: bvh at speakeasy.net (Brian Van Horne) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: Message-ID: This should do it: # create dir if it doesn't already exist my $directory = '/absolute/path/to/dir/'; mkdir($directory) unless -d $directory; Brian -- "The mind is not a vessel to be filled but a fire to be kindled." - Plutarch On Sat, 19 Jan 2002, Susanne Bullo wrote: > Ok, I am trying to figure out the coding for checking to see if a directory > exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" > book and did a lot of searching and am still stumped. Anyone have a quick > and easy answer for me? > > Thanks! > > Susanne Bullo - Sweet Homes > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jimfl at colltech.com Sat Jan 19 16:45:55 2002 From: jimfl at colltech.com (Jim Flanagan) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: References: Message-ID: <8945928.1011451555@[0.0.0.0]> --On Saturday, January 19, 2002 2:22 PM -0800 Susanne Bullo wrote: > Ok, I am trying to figure out the coding for checking to see if a > directory exists and if it doesn't, create it. I've gotten out my > "Perl For Dummies" book and did a lot of searching and am still > stumped. Anyone have a quick and easy answer for me? use File::Path; mkpath($dir) unless -d $dir; Take a look at the manual page for File::Path. There are some other options you can set in the call to mkpath, that may apply to your project. But you asked for the quick and easy version :^) -- Jim Flanagan jimfl@colltech.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From moonbeam at catmanor.com Sat Jan 19 16:48:15 2002 From: moonbeam at catmanor.com (William Julien) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question Message-ID: <200201192248.g0JMmFe14098@catmanor.com> > >Ok, I am trying to figure out the coding for checking to see if a directory >exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" >book and did a lot of searching and am still stumped. Anyone have a quick >and easy answer for me? > >Thanks! > >Susanne Bullo - Sweet Homes > Maybe something like this: #!/usr/bin/perl -w # $dir = "some/directory/path"; $base = "/usr/people/moonbeam"; use File::Path; if ( ! -f "$base/$dir" ) { if ( ! -d "$base/$dir" ) { mkpath("$base/$dir", 0, 0755 ) or die "Cannot make $dir/$base - $!\n"; } } Here is the perldoc on File::Path: NAME File::Path - create or remove directory trees SYNOPSIS use File::Path; mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711); rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1); DESCRIPTION The "mkpath" function provides a convenient way to create directories, even if your "mkdir" kernel call won't create more than one level of directory at a time. "mkpath" takes three arguments: o the name of the path to create, or a reference to a list of paths to create, o a boolean value, which if TRUE will cause "mkpath" to print the name of each directory as it is created (defaults to FALSE), and o the numeric mode to use when creating the directories (defaults to 0777) It returns a list of all directories (including intermedi- ates, determined using the Unix '/' separator) created. William - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Sat Jan 19 17:01:55 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: Message-ID: That did the trick right there - how very simple! Thank you! Susanne Bullo - Sweet Homes -----Original Message----- From: Brian Van Horne [mailto:bvh@speakeasy.net] Sent: Saturday, January 19, 2002 2:37 PM To: Susanne Bullo Cc: Seattle Perl User's Group Subject: Re: SPUG: Yet another silly question This should do it: # create dir if it doesn't already exist my $directory = '/absolute/path/to/dir/'; mkdir($directory) unless -d $directory; Brian -- "The mind is not a vessel to be filled but a fire to be kindled." - Plutarch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From wbrian2 at qwest.net Sat Jan 19 17:12:52 2002 From: wbrian2 at qwest.net (Brian Wisti) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: References: Message-ID: <200201192312.g0JNCr707153@www.coolnamehere.com> Hi Susanna, Here's one way: my $dirname = "foo"; unless (-e $dirname) { mkdir ($dirname) || die("Cannot create directory '$dirname': $!\n"); } There's probably a few other ways, Perl being what it is :-) Brian Wisti On Saturday 19 January 2002 02:22 pm, you wrote: > Ok, I am trying to figure out the coding for checking to see if a directory > exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" > book and did a lot of searching and am still stumped. Anyone have a quick > and easy answer for me? > > Thanks! > > Susanne Bullo - Sweet Homes -- ------------------------------------------------------------ Visit http://www.coolnamehere.com/ It'll kill some time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From brian at tangent.org Sat Jan 19 17:12:50 2002 From: brian at tangent.org (Brian Aker) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: References: Message-ID: <1011481990.30054.1782.camel@avenger> On Sat, 2002-01-19 at 14:22, Susanne Bullo wrote: > Ok, I am trying to figure out the coding for checking to see if a directory > exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" > book and did a lot of searching and am still stumped. Anyone have a quick > and easy answer for me? #!/usr/bin/perl -w use strict; if ( -e $ARGV[0] ) { if (-d $ARGV[0]) { print "Directory exists\n"; } else { print "A file exists where you want a directory\n"; } mkdir($ARGV[0]); } else { mkdir($ARGV[0]); } A bit verbose. If you need to create multiple directories look at File::Path. -Brian -- _______________________________________________________ Brian Aker, brian@tangent.org Slashdot Senior Developer Seattle, Washington http://tangent.org/~brian/ http://askbrian.org/ _______________________________________________________ You can't grep a dead tree. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From ben at reser.org Sat Jan 19 17:08:33 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: References: Message-ID: <20020119230833.GL1437@titanium.brain.org> On Sat, Jan 19, 2002 at 02:22:46PM -0800, Susanne Bullo wrote: > Ok, I am trying to figure out the coding for checking to see if a > directory exists and if it doesn't, create it. I've gotten out my > "Perl For Dummies" book and did a lot of searching and am still > stumped. Anyone have a quick and easy answer for me? my $mynewdirpath = 'perltest1'; unless (mkdir($mynewdirpath) || ($! eq 'File exists' && -d $mynewdirpath)) { die "Was unable to create directory $mynewdirpath"; } That's how I'd do it. Or you can use the file test flags before you make the directory (strongly discouraged because of race conditions. i.e. someone could make the directory before you and hose you). E.G: my $mynewdirpath = 'perltest2'; unless (-d $mynewdirpath) { mkdir($mynewdirpath) || die "Was unable to create directory $mynewdirpath"; } -- Ben Reser http://ben.reser.org "I wish it need not have happened in my time," said Frodo. "So do I," said Gandalf, "and so do all who live in such times. But that is not for them to decide. All we have to decide is what to do with the time that is given us." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Daniel.Pommert at verizonwireless.com Mon Jan 21 10:10:39 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question Message-ID: <9B30436F511ED5118EDF0002A55C31800119D85D@cairvexmb03.la.airtouch.com> I have found that mkpath will check to see if the directory is there before it tries to create it. So, checking is not necessary when using mkpath. So, the code below would better be written: #!/usr/bin/perl -w # $dir = "some/directory/path"; $base = "/usr/people/moonbeam"; use File::Path; if ( ! -f "$base/$dir" ) { mkpath("$base/$dir", 0, 0755 ) or die "Cannot make $dir/$base - $!\n"; } else { print STDERR, "$base/$dir already exists as a file!\n"; } -----Original Message----- From: William Julien [mailto:moonbeam@catmanor.com] Sent: Saturday, January 19, 2002 2:48 PM To: sweetsue@sweethomes.com Cc: spug-list@pm.org Subject: Re: SPUG: Yet another silly question > >Ok, I am trying to figure out the coding for checking to see if a directory >exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" >book and did a lot of searching and am still stumped. Anyone have a quick >and easy answer for me? > >Thanks! > >Susanne Bullo - Sweet Homes > Maybe something like this: #!/usr/bin/perl -w # $dir = "some/directory/path"; $base = "/usr/people/moonbeam"; use File::Path; if ( ! -f "$base/$dir" ) { if ( ! -d "$base/$dir" ) { mkpath("$base/$dir", 0, 0755 ) or die "Cannot make $dir/$base - $!\n"; } } Here is the perldoc on File::Path: NAME File::Path - create or remove directory trees SYNOPSIS use File::Path; mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711); rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1); DESCRIPTION The "mkpath" function provides a convenient way to create directories, even if your "mkdir" kernel call won't create more than one level of directory at a time. "mkpath" takes three arguments: o the name of the path to create, or a reference to a list of paths to create, o a boolean value, which if TRUE will cause "mkpath" to print the name of each directory as it is created (defaults to FALSE), and o the numeric mode to use when creating the directories (defaults to 0777) It returns a list of all directories (including intermedi- ates, determined using the Unix '/' separator) created. William - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jason at strangelight.com Mon Jan 21 13:47:26 2002 From: jason at strangelight.com (Jason Lamport) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question In-Reply-To: <9B30436F511ED5118EDF0002A55C31800119D85D@cairvexmb03.la.airtouch.com> References: <9B30436F511ED5118EDF0002A55C31800119D85D@cairvexmb03.la.airtouch.com> Message-ID: At 8:10 am -0800 1/21/02, Pommert, Daniel wrote: >I have found that mkpath will check to see if the directory is there before >it tries to create it. So, checking is not necessary when using mkpath. Is this behaviour in the documentation for File::Path, or is this simply something you've observed? I personally consider it poor programming practice to rely on undocumented behaviour, even in trivial cases such as this. (And even if it is part of the formal spec, an extra check rarely hurts.) Sanity Checks are Good Things. -jason > >So, the code below would better be written: > >#!/usr/bin/perl -w ># >$dir = "some/directory/path"; >$base = "/usr/people/moonbeam"; > >use File::Path; > >if ( ! -f "$base/$dir" ) { > mkpath("$base/$dir", 0, 0755 ) or > die "Cannot make $dir/$base - $!\n"; >} >else { > print STDERR, "$base/$dir already exists as a file!\n"; >} > >-----Original Message----- >From: William Julien [mailto:moonbeam@catmanor.com] >Sent: Saturday, January 19, 2002 2:48 PM >To: sweetsue@sweethomes.com >Cc: spug-list@pm.org >Subject: Re: SPUG: Yet another silly question > > >> >>Ok, I am trying to figure out the coding for checking to see if a directory >>exists and if it doesn't, create it. I've gotten out my "Perl For Dummies" >>book and did a lot of searching and am still stumped. Anyone have a quick >>and easy answer for me? >> >>Thanks! >> >>Susanne Bullo - Sweet Homes >> > >Maybe something like this: > >#!/usr/bin/perl -w ># >$dir = "some/directory/path"; >$base = "/usr/people/moonbeam"; > >use File::Path; > >if ( ! -f "$base/$dir" ) { > if ( ! -d "$base/$dir" ) { > mkpath("$base/$dir", 0, 0755 ) or > die "Cannot make $dir/$base - $!\n"; > } >} > >Here is the perldoc on File::Path: > >NAME > File::Path - create or remove directory trees > >SYNOPSIS > use File::Path; > > mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711); > rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1); > > >DESCRIPTION > The "mkpath" function provides a convenient way to create > directories, even if your "mkdir" kernel call won't create > more than one level of directory at a time. "mkpath" > takes three arguments: > > o the name of the path to create, or a reference to a > list of paths to create, > > o a boolean value, which if TRUE will cause "mkpath" to > print the name of each directory as it is created > (defaults to FALSE), and > > o the numeric mode to use when creating the directories > (defaults to 0777) > > It returns a list of all directories (including intermedi- > ates, determined using the Unix '/' separator) created. > >William > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sthoenna at efn.org Mon Jan 21 23:25:07 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Yet another silly question References: <9B30436F511ED5118EDF0002A55C31800119D85D@cairvexmb03.la.airtouch.com> Message-ID: In article , Jason Lamport wrote: >At 8:10 am -0800 1/21/02, Pommert, Daniel wrote: >>I have found that mkpath will check to see if the directory is there before >>it tries to create it. So, checking is not necessary when using mkpath. > >Is this behaviour in the documentation for File::Path, or is this >simply something you've observed? I personally consider it poor >programming practice to rely on undocumented behaviour, even in >trivial cases such as this. (And even if it is part of the formal >spec, an extra check rarely hurts.) I have File::Path version 1.0404 here. It does indeed skip directories that already exist. It returns a list of directories created (including intermediates). In scalar context, this is a count of directories created. So if you say mkpath("$base/$dir"...) and $base/$dir already exists it returns 0. So in the suggested code below, the die is triggered. Worse yet, since no system error actually occured, the value of $! is meaningless. Indeed, an extra check rarely hurts. >>So, the code below would better be written: >> >>#!/usr/bin/perl -w >># >>$dir = "some/directory/path"; >>$base = "/usr/people/moonbeam"; >> >>use File::Path; >> >>if ( ! -f "$base/$dir" ) { >> mkpath("$base/$dir", 0, 0755 ) or >> die "Cannot make $dir/$base - $!\n"; >>} >>else { >> print STDERR, "$base/$dir already exists as a file!\n"; s/,// >>} I'm also not sure what the point is of printing a warning (but not via warn) if $base/$dir already exists as a file but dying if if any of the intermediates exist as a file. (BTW, mkpath already does a die if a mkdir fails. The only case I see that *will* hit the die above is if the directory already exists.) You might try something like this: my $makeme = "$base/$dir"; # portably, use = File::Spec::->catfile($base,$dir) eval { mkpath($makeme,0,0755) }; warn "Error making path $makeme: ", ($@ || "race condition") unless -d $makeme; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From pdarley at kinesis-cem.com Wed Jan 23 11:33:17 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules Message-ID: Friends, I have a question about how Apache Mod_Perl caches modules, which I can't find on the web anywhere. The situation I'm in is that I recently started using CVS and found that it was easier to have a cvs Modules repository where I keep my custom modules, so they can be easily replicated to my production web server. Older versions of these same modules exist in the standard modules directory, '/usr/lib/perl5/site_perl/5.005/i386-linux/'. It appears that the module that gets cached by the httpd instance is dependant on weather the first script it runs has the use lib '../Modules' line in it or not. If it does it seems to cache the module from the cvs fed directory, and if not it caches the one from the standard modules directory. I've changed my startup.pl to include use lib 'my cvs modules directory', which seems to solve my problem, but I'm not sure. My question is thus: In order to more fully understand the inner workings of the system, can someone describe the rules Apache uses for caching modules? Does the behavior that I described make sense, or do y'all think I'm missing something? Thanks, Peter Darley P.S. I understand that having packages of the same name in different places is probably not good, and I'll clean it up in the future, but because of time considerations I don't have a whole lot of choice for now. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Wed Jan 23 11:48:48 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present Message-ID: <20020123094848.A30380@timji.consultix.wa.com> Is anybody familiar with this company, or its products? Should we let them make a presentation to us? Opinions welcome . . . -Tim ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= Hi Tim, I am writing to inquire about your interest in having a speaker from Teamstudio present at an upcoming Seattle Perl User Group meeting. The following is information about our company. Company Overview: Founded in 1995 and headquartered in Beverly, Massachusetts, Teamstudio is a global software company specializing in software design tools for enhancing developer productivity and improving application quality. We offer two distinct product lines: Teamstudio for Web and Teamstudio for Notes. Teamstudio for Web is our offering of tools for Web developers, including PHP and Perl developers and developers looking to integrate legacy systems into existing Web applications. Teamstudio for Notes is a modular suite of tools and training for Lotus Notes and Domino developers. In addition, Teamstudio Partnersource - the company's third-party product family - offers a menu of tools that complements the Teamstudio products and represents best-of-breed technologies. Teamstudio is an IBM Business Partner. For more information about Teamstudio tools, visit our Web site at http://www.teamstudio.com/webtools or call 800-632-9787. We'd love to make a presentation to your group on our PHP/Perl editor and debugger. Please drop me a line if you think your group would find it valuable. Thank you, Jen Labossiere - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From warner at oz.net Wed Jan 23 04:26:49 2002 From: warner at oz.net (Marion Scott Warner) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to present Message-ID: <3C4E8FE9.41C85F93@oz.net> Gee, ask him how much it cost? Since half of us are unemployed we might just have to stick with open source tools. :) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From james at banshee.com Wed Jan 23 13:05:06 2002 From: james at banshee.com (James Moore) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present In-Reply-To: <20020123094848.A30380@timji.consultix.wa.com> Message-ID: <000a01c1a440$df3eedb0$697ba8c0@gealach> I'd like to hear what they have to say. While my preference is for open source tools, I'm perfectly happy to listen to what commercial offerings bring to the table. No Unix support in their product, though, which seems pretty strange for a Perl system. - James - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Wed Jan 23 13:11:45 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: RE: Ballard Perl Assignment In-Reply-To: <200201231853.g0NIr6E14000@mail.pm.org>; from owner-spug-list@pm.org on Wed, Jan 23, 2002 at 12:53:06PM -0600 References: <200201231853.g0NIr6E14000@mail.pm.org> Message-ID: <20020123111145.A30966@timji.consultix.wa.com> On Wed, Jan 23, 2002 at 12:53:06PM -0600, owner-spug-list@pm.org wrote: > > I was browsing one of the contract web sites and found a Perl position > in Ballard. Anyone know what the company might be? It might be a small shop that posted an ad on our SPUG list sometime back; see attachment. -Tim ============================================================= | Tim Maher, Ph.D. Tel: (206) 781-UNIX/8649 | | SPUG Founder & Leader Email: spug@seattleperl.org | | Seattle Perl Users Group HTTP: www.seattleperl.org | ============================================================= > > > > - James -------------- next part -------------- From cmeyer at helvella.org Wed Jan 23 13:32:46 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: References: Message-ID: <20020123113246.B4740@hobart.helvella.org> Hi Peter, On Wed, Jan 23, 2002 at 09:33:17AM -0800, Peter Darley wrote: > > My question is thus: In order to more fully understand the inner > workings of the system, can someone describe the rules Apache uses for > caching modules? Does the behavior that I described make sense, or do > y'all think I'm missing something? When running code in the mod_perl framework, the rules for how Perl loads and uses modules are basically the same as non-mod_perl. You need to keep two things in mind: apache runs one parent process that forks off children to do the work. Each "individual" script becomes a subroutine in the same large mod_perl environment. Thus script_a and script_b share any modules that are loaded before the fork. Modules loaded after forking are limited to just that particular process. Apache child processes typically have a limited lifetime. You can examine %INC to see which modules are loaded, and where on disk they were loaded from. For example, try: perl -MData::Dumper -le 'print Dumper \%INC then try dumping it from within a mod_perl program There are two common ways to load up a module before the fork. The first is with a 'PerlModule' directive in your apache config file. Alternatively you can use a 'PerlRequire' directive, and point it at a Perl script in which you can do some setup (adjust @INC, load up shared data ...) and load modules. > > Thanks, > Peter Darley > > P.S. I understand that having packages of the same name in different places > is probably not good, and I'll clean it up in the future, but because of > time considerations I don't have a whole lot of choice for now. Not only not good, but, depending on your situation, just plain won't work. Scripts running in the mod_perl framework are not 'standalone scripts', but rather are translated on-the-fly into subroutines that are called from within the same environment. Thus if script_a.pl loads up a 'config' module by use lib '/script_a/private/libdir'; use Config; and script_b tries something similar: use lib '/script_b/private/libdir'; use Config; The results will be unpredictable. If they happen to be called from two different apache child processes, then everything will appear to work fine. If they happen to be called sequentially from the same apache child, then script_b could get script_a's Config module, or vice versa. A super ugly kludge could be: use lib '/my/own/private/idaho'; delete $INC{Config} require Config; Config::import; Much better to rename the modules to Script_a::Config or something unique. hth, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From humbaba9 at yahoo.com Wed Jan 23 15:24:51 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present In-Reply-To: <20020123094848.A30380@timji.consultix.wa.com> Message-ID: <20020123212451.76622.qmail@web12802.mail.yahoo.com> 1/22/02 I didn't know anything about this vendor nor its products until I went to the Web site. These are Web tools - right? - so their Web site SHOULD be a good indictor of how good their tools are or what their Web coding standards are like... that's my premise, anyway. What I found does not entice me to their "presentation." Here's my evaluation of the coding on their site: Their top level pages just miss fitting in a Netscape 4.x window on 800 X 600 resolution and their product pages and Webtools pages are even worse. The HTML appears to have been generated by a (bad) HTML generator, possibly Frontpage, with tags all in uppercase and bad indentation, bad boundaries on their buttons, and extra unneeded tags (this is a good indicator of bad code - view source on this page http://www.teamstudio.com and look at all the at the bottom plus the double tags). Their navigation isn't particularly good (it's confusing, and in some places non-intuitive - but that isn't coding, just architectural logic). All that being said, they obviously want to "make a presentation" that is going to be an advertisement for their products - I assume they aren't looking for speaker's fees. How entertaining do you think their presentation might be - is it worth squandering a SPUG meeting on it - or are we running out of topics and volunteer speakers anyway? Would it obligate us to them in any way? Meryll --- Tim Maher wrote: > Is anybody familiar with this company, or its > products? > Should we let them make a presentation to us? > Opinions welcome . . . > > -Tim > ============================================================= > | Tim Maher, Ph.D. Tel: (206) > 781-UNIX/8649 | > | SPUG Founder & Leader Email: > spug@seattleperl.org | > | Seattle Perl Users Group HTTP: > www.seattleperl.org | > ============================================================= > > Hi Tim, > > I am writing to inquire about your interest in > having a speaker from > Teamstudio present at an upcoming Seattle Perl User > Group meeting. The > following is information about our company. > > Company Overview: > Founded in 1995 and headquartered in Beverly, > Massachusetts, Teamstudio is > a global software company specializing in software > design tools for > enhancing developer productivity and improving > application quality. We > offer two distinct product lines: Teamstudio for Web > and Teamstudio for > Notes. Teamstudio for Web is our offering of tools > for Web developers, > including PHP and Perl developers and developers > looking to integrate > legacy systems into existing Web applications. > Teamstudio for Notes is a > modular suite of tools and training for Lotus Notes > and Domino developers. > In addition, Teamstudio Partnersource - the > company's third-party product > family - offers a menu of tools that complements the > Teamstudio products > and represents best-of-breed technologies. > > Teamstudio is an IBM Business Partner. > > For more information about Teamstudio tools, visit > our Web site at > http://www.teamstudio.com/webtools or call > 800-632-9787. > > We'd love to make a presentation to your group on > our PHP/Perl editor and > debugger. Please drop me a line if you think your > group would find it > valuable. > > Thank you, > > Jen Labossiere > > - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL > by your Email-address > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From ben at reser.org Wed Jan 23 17:26:36 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present In-Reply-To: <20020123212451.76622.qmail@web12802.mail.yahoo.com> References: <20020123094848.A30380@timji.consultix.wa.com> <20020123212451.76622.qmail@web12802.mail.yahoo.com> Message-ID: <20020123232636.GI26695@titanium.brain.org> On Wed, Jan 23, 2002 at 01:24:51PM -0800, Meryll Larkin wrote: > The HTML appears to have been generated by a (bad) > HTML generator, possibly Frontpage, with tags all in > uppercase and bad indentation, bad boundaries on their > buttons, and extra unneeded tags > (this is a good indicator of bad code - view source on > this page > http://www.teamstudio.com and look at all the at > the bottom plus the double tags). Their > navigation isn't particularly good (it's confusing, > and in some places non-intuitive - but that isn't > coding, just architectural logic). Just what does the tags being in all caps prove? I always use caps for my tags. -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From humbaba9 at yahoo.com Wed Jan 23 18:43:27 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present In-Reply-To: <20020123232636.GI26695@titanium.brain.org> Message-ID: <20020124004327.15953.qmail@web12803.mail.yahoo.com> 1/22/02 Hi Ben & All, HTML tags all in upper case isn't necessarily bad - (sorry, I didn't mean to imply that it is) some people prefer lower case because it makes the pages more XML friendly. In this case, I just made a note of it because I know that HTML tags all in caps and bad indentation is characteristic of coding produced by old versions of Frontpage. Meryll --- Ben Reser wrote: > On Wed, Jan 23, 2002 at 01:24:51PM -0800, Meryll > Larkin wrote: > > The HTML appears to have been generated by a (bad) > > HTML generator, possibly Frontpage, with tags all > in > > uppercase and bad indentation, bad boundaries on > their > > buttons, and extra unneeded tags > > (this is a good indicator of bad code - view > source on > > this page > > http://www.teamstudio.com and look at all the > at > > the bottom plus the double tags). Their > > navigation isn't particularly good (it's > confusing, > > and in some places non-intuitive - but that isn't > > coding, just architectural logic). > > Just what does the tags being in all caps prove? I > always use caps for > my tags. > > -- > Ben Reser > http://ben.reser.org > > What difference does it make to the dead, the > orphans, and the homeless, > whether the mad destruction is wrought under the > name of totalitarianism > or the holy name of liberty and democracy? - Ghandi __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From jay at Scherrer.com Wed Jan 23 18:52:47 2002 From: jay at Scherrer.com (Jay Scherrer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to present In-Reply-To: <3C4E8FE9.41C85F93@oz.net> References: <3C4E8FE9.41C85F93@oz.net> Message-ID: <200201240052.g0O0qmu08583@localhost.localdomain> The talk might be interesting. After all we did listen Active State present their Perl debugger using Kamodo. I think they're asking for $500 for a yearly license. Let's see if it's anything like Quanta. Jay On Wednesday 23 January 2002 02:26 am, Marion Scott Warner wrote: > Gee, ask him how much it cost? Since half of us are unemployed we might > just have to stick with open source tools. :) > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From myocom at microsoft.com Wed Jan 23 19:55:41 2002 From: myocom at microsoft.com (Mark Yocom) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to Present Message-ID: <935F630FDD8A7F4CB1A0412C7CA4371437647E@RED-MSG-10.redmond.corp.microsoft.com> The HTML comments seem to indicate that capitalized tags are also produced by : > -----Original Message----- > From: Meryll Larkin [mailto:humbaba9@yahoo.com] > Sent: Wednesday, January 23, 2002 4:43 PM > To: Ben Reser > Cc: spug-list@pm.org > Subject: Re: SPUG: Vendor wants to Present > > > 1/22/02 > > Hi Ben & All, > > HTML tags all in upper case isn't necessarily bad - > (sorry, I didn't mean to imply that it is) some people > prefer lower case because it makes the pages more XML > friendly. > > In this case, I just made a note of it because I know > that HTML tags all in caps and bad indentation is > characteristic of coding produced by old versions of > Frontpage. > > Meryll > > --- Ben Reser wrote: > > On Wed, Jan 23, 2002 at 01:24:51PM -0800, Meryll > > Larkin wrote: > > > The HTML appears to have been generated by a (bad) > > > HTML generator, possibly Frontpage, with tags all > > in > > > uppercase and bad indentation, bad boundaries on > > their > > > buttons, and extra unneeded tags > > > (this is a good indicator of bad code - view > > source on > > > this page > > > http://www.teamstudio.com and look at all the > > at > > > the bottom plus the double tags). Their > > > navigation isn't particularly good (it's > > confusing, > > > and in some places non-intuitive - but that isn't > > > coding, just architectural logic). > > > > Just what does the tags being in all caps prove? I > > always use caps for > > my tags. > > > > -- > > Ben Reser > > http://ben.reser.org > > > > What difference does it make to the dead, the > > orphans, and the homeless, > > whether the mad destruction is wrought under the > > name of totalitarianism > > or the holy name of liberty and democracy? - Ghandi > > > __________________________________________________ > Do You Yahoo!? > Send FREE video emails in Yahoo! Mail! > http://promo.yahoo.com/videomail/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your > Email-address > For daily traffic, use spug-list for LIST ; for weekly, > spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sthoenna at efn.org Wed Jan 23 20:59:43 2002 From: sthoenna at efn.org (Yitzchak Scott-Thoennes) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules References: <20020123113246.B4740@hobart.helvella.org> Message-ID: Colin Meyer wrote: >A super ugly kludge could be: > > use lib '/my/own/private/idaho'; > delete $INC{Config} > require Config; Config::import; You probably want a: use Symbol (); Symbol::delete_package 'Config'; before the require, to start with a fresh %Config namespace. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From chris at chriskate.net Wed Jan 23 22:31:56 2002 From: chris at chriskate.net (Chris Sutton) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: References: Message-ID: <200201240431.g0O4VuB27537@phineas.chriskate.net> I've been doing mod_perl stuff for quite a while and though I hate doing this, the only way I've found to make sure Apache is running the correct versions of perl code (using a cached version vs. one just loaded off disk) is to restart the server. Do a full stop and then start, not just HUP. Not sure how this fits into what you are trying to do, but when weird stuff starts happening between requests, I find its time to restart the server. Whenever I release development code to a production server, if it's mod_perl, I always restart apache on the production machine. On Wednesday 23 January 2002 09:33 am, you wrote: > Friends, > I have a question about how Apache Mod_Perl caches modules, which I can't > find on the web anywhere. > > The situation I'm in is that I recently started using CVS and found that > it was easier to have a cvs Modules repository where I keep my custom > modules, so they can be easily replicated to my production web server. > Older versions of these same modules exist in the standard modules > directory, '/usr/lib/perl5/site_perl/5.005/i386-linux/'. It appears that > the module that gets cached by the httpd instance is dependant on weather > the first script it runs has the use lib '../Modules' line in it or not. > If it does it seems to cache the module from the cvs fed directory, and if > not it caches the one from the standard modules directory. > I've changed my startup.pl to include use lib 'my cvs modules directory', > which seems to solve my problem, but I'm not sure. > > My question is thus: In order to more fully understand the inner workings > of the system, can someone describe the rules Apache uses for caching > modules? Does the behavior that I described make sense, or do y'all think > I'm missing something? > > Thanks, > Peter Darley > > P.S. I understand that having packages of the same name in different > places is probably not good, and I'll clean it up in the future, but > because of time considerations I don't have a whole lot of choice for now. > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Wed Jan 23 22:44:25 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: References: <20020123113246.B4740@hobart.helvella.org> Message-ID: <20020123204425.A5822@hobart.helvella.org> On Wed, Jan 23, 2002 at 06:59:43PM -0800, Yitzchak Scott-Thoennes wrote: > Colin Meyer wrote: > >A super ugly kludge could be: > > > > use lib '/my/own/private/idaho'; > > delete $INC{Config} > > require Config; Config::import; > > You probably want a: > use Symbol (); > Symbol::delete_package 'Config'; > before the require, to start with a fresh %Config namespace. You are right. Another problem that occurred to me immediately after posting the above is that the 'use lib' statement will only run once, as the script gets compiled. The following might work better: {local @INC; unshift @INC, '/my/private/libdir'; Symbol::delete_package 'Config'; require Config; Config::import; # if it needs it } It's obviously a lousy workaround to account for duplicate use of a namespace. Not only that, but it foils some of mod_perl's usefulness by re-loading some code for each request. use MyApp::Config; # much nicer ;-) Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Wed Jan 23 22:55:33 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Vendor wants to present In-Reply-To: <200201240052.g0O0qmu08583@localhost.localdomain> References: <3C4E8FE9.41C85F93@oz.net> <200201240052.g0O0qmu08583@localhost.localdomain> Message-ID: <20020123205533.B5822@hobart.helvella.org> On Wed, Jan 23, 2002 at 04:52:47PM -0800, Jay Scherrer wrote: > The talk might be interesting. After all we did listen Active State present > their Perl debugger using Kamodo. I think they're asking for $500 for a > yearly license. Let's see if it's anything like Quanta. > Jay I have to admit, I was a little leary at having ActiveState present one of their products at a SPUG meeting. One of the most enjoyable aspects of our group is the lack of commercialism. We discuss and learn about programming. If we talk about a product, it is because someone finds it interesting (positively or negatively), not because someone has asked us to consider buying it. What was enjoyable about Neil and Brian's presentation is that they talked in some detail about the implementation of their product. They discussed and handled technical questions about regexs, XS programming, parsing Perl, programming Mozilla and other topics. It was not a slick commercial presentation, but it was informative and interesting. If someone is willing to talk about some free tools that do similar things (my favorite: vim, perl -d; alternatively: emacs or ptkdb) then it might interesting to pair them up with this vendor presentation. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Wed Jan 23 23:22:37 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: <200201240431.g0O4VuB27537@phineas.chriskate.net> References: <200201240431.g0O4VuB27537@phineas.chriskate.net> Message-ID: <20020123212237.C5822@hobart.helvella.org> On Wed, Jan 23, 2002 at 08:31:56PM -0800, Chris Sutton wrote: > I've been doing mod_perl stuff for quite a while and though I hate doing > this, the only way I've found to make sure Apache is running the correct > versions of perl code (using a cached version vs. one just loaded off disk) > is to restart the server. Do a full stop and then start, not just HUP. > > Not sure how this fits into what you are trying to do, but when weird stuff > starts happening between requests, I find its time to restart the server. I wouldn't use it within a production environment, but Apache::Reload can be very useful on your devel machine. It reloads modules that have been modified, no server restart or even kill -1 necessary. Apache::Reload is a replacement for Apache::StatINC. > > Whenever I release development code to a production server, if it's mod_perl, > I always restart apache on the production machine. Yup, that's the way to go. Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From haven001 at daum.com Thu Jan 24 06:56:16 2002 From: haven001 at daum.com (Àç±Õ) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: pda ±×³É µå¸³´Ï´Ù!!! Message-ID: <20020124125654.0336998241@mail3.panix.com> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020124/9ab7d3c8/attachment.htm From pdarley at kinesis-cem.com Thu Jan 24 09:36:24 2002 From: pdarley at kinesis-cem.com (Peter Darley) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: <20020123113246.B4740@hobart.helvella.org> Message-ID: Friends, PerlModule is exactly what I was hoping for. Apache::Reload also looks like a great time saver. I often restart Apache on my dev machine two or three times a minute while debugging. Just out of curiosity, what kind of problems might it cause that would make it a bad idea for the production machine, or is it just a performance issue? Thanks to everyone, Peter Darley -----Original Message----- From: owner-spug-list@pm.org [mailto:owner-spug-list@pm.org]On Behalf Of Colin Meyer Sent: Wednesday, January 23, 2002 11:33 AM To: Peter Darley Cc: SPUG Subject: Re: SPUG: Apache and Modules Hi Peter, There are two common ways to load up a module before the fork. The first is with a 'PerlModule' directive in your apache config file. Alternatively you can use a 'PerlRequire' directive, and point it at a Perl script in which you can do some setup (adjust @INC, load up shared data ...) and load modules. I wouldn't use it within a production environment, but Apache::Reload can be very useful on your devel machine. It reloads modules that have been modified, no server restart or even kill -1 necessary. Apache::Reload is a replacement for Apache::StatINC. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From simonw at simonwilcox.co.uk Thu Jan 24 10:44:45 2002 From: simonw at simonwilcox.co.uk (Simon Wilcox) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: Message-ID: On Thu, 24 Jan 2002, Peter Darley wrote: > Friends, > PerlModule is exactly what I was hoping for. > Apache::Reload also looks like a great time saver. I often restart Apache > on my dev machine two or three times a minute while debugging. Just out of > curiosity, what kind of problems might it cause that would make it a bad > idea for the production machine, or is it just a performance issue? Purely a performance issue I think. It makes a *lot* of stat calls on every request to check all the modules in use. Simon. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Thu Jan 24 10:56:52 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: Apache and Modules In-Reply-To: References: <20020123113246.B4740@hobart.helvella.org> Message-ID: <20020124085652.D5822@hobart.helvella.org> On Thu, Jan 24, 2002 at 07:36:24AM -0800, Peter Darley wrote: > Friends, > PerlModule is exactly what I was hoping for. > Apache::Reload also looks like a great time saver. I often restart Apache > on my dev machine two or three times a minute while debugging. Just out of > curiosity, what kind of problems might it cause that would make it a bad > idea for the production machine, or is it just a performance issue? I agree that it is a great time saver while developing. I wouldn't use it on a production machine because it implements a similar hack to the one I described in a prior message. It adds cpu time to each and every request, and while the code seems reasonable enough, I am hesitant to add unnecessary logic to a production system, especially a heavily loaded one. Apache::Reload doesn't use Yitzchak's advice of deleting the namespace prior to reloading the module; it is assumed that the compilation of the newer module will overwrite everything in the same namespace. A similar module that is interesting for devel environments, but I would not run on production is Apache::PerlVINC. This lets one use two different versions of a module within one running instance of apache/mod_perl. Have fun, -C. > > Thanks to everyone, > Peter Darley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From humbaba9 at yahoo.com Fri Jan 25 19:22:08 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: trinary ? operator Message-ID: <20020126012208.94652.qmail@web12808.mail.yahoo.com> 1/25/02 Hi Folks, I'm using Active Perl5.005_03 on Windows98 and 5.6.1 on Windows2000 professional edition and I can't get the trinary ? operator to work. Does anyone have any experience with this in Windows? Does my syntax need correcting? On pg 92 of Programming Perl (2nd Edition) an example of the trinary operator is given: $a = $ok ? $b : $c; I find if I use this syntax, I get an assignment to $b (the "true" choice) because $a = $ok has a single = instead of ==. If I try to use == I don't get an error, the entire line seems to be ignored. If I use strings and use "eq" the line is also ignored. Turning on -w gets me this error: Useless use of private variable in void context. Useless use of private variable in void context. (yes, twice, I assume it refers to $b and $c) help? Meryll __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From daryn at marinated.org Fri Jan 25 19:41:55 2002 From: daryn at marinated.org (Daryn Nakhuda) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: trinary ? operator In-Reply-To: <20020126012208.94652.qmail@web12808.mail.yahoo.com> Message-ID: what are you trying to do exactly? what you typed is equivalent to: if ($ok) { $a = $b; } else { $a = $c; } if you meant to do if ($a == $ok) { $something = $b; } else { $something = $c; } that'd be $something = ($a == $ok) ? $b : $c; On Fri, 25 Jan 2002, Meryll Larkin wrote: > 1/25/02 > > Hi Folks, > > I'm using Active Perl5.005_03 on Windows98 and 5.6.1 > on Windows2000 professional edition and I can't get > the trinary ? operator to work. Does anyone have any > experience with this in Windows? Does my syntax need > correcting? > > On pg 92 of Programming Perl (2nd Edition) an example > of the trinary operator is given: > > $a = $ok ? $b : $c; > > I find if I use this syntax, I get an assignment to $b > (the "true" choice) because $a = $ok has a single = > instead of ==. > > If I try to use == I don't get an error, the entire > line seems to be ignored. > > If I use strings and use "eq" the line is also > ignored. > > Turning on -w gets me this error: > Useless use of private variable in void context. > Useless use of private variable in void context. > (yes, twice, I assume it refers to $b and $c) > > help? > > Meryll > > > > > __________________________________________________ > Do You Yahoo!? > Great stuff seeking new owners in Yahoo! Auctions! > http://auctions.yahoo.com > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From humbaba9 at yahoo.com Fri Jan 25 20:06:40 2002 From: humbaba9 at yahoo.com (Meryll Larkin) Date: Wed Aug 4 00:08:35 2004 Subject: SPUG: trinary ? operator In-Reply-To: Message-ID: <20020126020640.35504.qmail@web12806.mail.yahoo.com> 1/25/02 Thanks Daryn, I was able to get that to work in with both integers and strings. You were right, I was trying to do this: if ($boolean == "y") { $boolean = 1; } else { $boolean = 0; } Meryll --- Daryn Nakhuda wrote: > > what are you trying to do exactly? > > what you typed is equivalent to: > > if ($ok) { > $a = $b; > } > else { > $a = $c; > } > > if you meant to do > > if ($a == $ok) { > $something = $b; > } > else { > $something = $c; > } > > that'd be > > $something = ($a == $ok) ? $b : $c; > > > > > On Fri, 25 Jan 2002, Meryll Larkin wrote: > > > 1/25/02 > > > > Hi Folks, > > > > I'm using Active Perl5.005_03 on Windows98 and > 5.6.1 > > on Windows2000 professional edition and I can't > get > > the trinary ? operator to work. Does anyone have > any > > experience with this in Windows? Does my syntax > need > > correcting? > > > > On pg 92 of Programming Perl (2nd Edition) an > example > > of the trinary operator is given: > > > > $a = $ok ? $b : $c; > > > > I find if I use this syntax, I get an assignment > to $b > > (the "true" choice) because $a = $ok has a single > = > > instead of ==. > > > > If I try to use == I don't get an error, the > entire > > line seems to be ignored. > > > > If I use strings and use "eq" the line is also > > ignored. > > > > Turning on -w gets me this error: > > Useless use of private variable in void context. > > Useless use of private variable in void context. > > (yes, twice, I assume it refers to $b and $c) > > > > help? > > > > Meryll > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Great stuff seeking new owners in Yahoo! Auctions! > > > http://auctions.yahoo.com > > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: > owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: > ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, > EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for > weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: > http://zipcon.net/spug/ > > > > > > -- > > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From warner at oz.net Fri Jan 25 20:03:05 2002 From: warner at oz.net (Marion Scott Warner) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Broken Perl on Redhat with install of GD.pm Message-ID: <3C520E59.B5B6EF80@oz.net> Do any of you know which RedHat RPM version of Perl is the broken one that will not work correctly when GD.pm is installed? OK mine does not work. Maybe I should ask which one is not broken with regards to GD.pm? Thanks, Scott W. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From korea79420 at lycos.co.kr Sat Jan 26 08:07:27 2002 From: korea79420 at lycos.co.kr (¹ÚÁöÇö) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: ¿Í¿ì~ ¹«·á°æÇ°½ÅûÇϱâ!!!ÇÚµåÆùÀÌ °øÂ¥!!!,¿ù±ÞÁ¤º¸!!!¾Æ¸£¹ÙÀÌÆ® ±¸Çϱâ!!![±¤-°í] Message-ID: <200201261408.g0QE8M623091@mail.pm.org> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020126/c127baa7/attachment.htm From MichaelRunningWolf at att.net Sat Jan 26 08:53:32 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <009401c19d8b$26e59680$3d88ddd1@aciwin> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> Message-ID: "Richard Anderson" writes: > use MyClass; > $MyClass::Debug = 1; # or 2 or 3 > $MyClass::DoSomething(); > > and in MyClass: > > if (Debug > 0) { > print (whatever) > } I, too, use statements like this, but format them as follows: print STDERR "Debug/Assertion statement" if $debug; or print STDERR "Debug/Assertion statement" if $debug > 1; The reason I like this is that it reads as an assertion comment for casual human readers, but runs like an if statement. -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From support at blackjackshack.com Mon Jan 28 14:21:18 2002 From: support at blackjackshack.com (support@blackjackshack.com) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Worlds First Player vs Player Blackjack Message-ID: <03af10102221c12STATION@station.blackjackstation.com> This message can only be viewed in HTML -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020128/c8b762e8/attachment.htm From tim at consultix-inc.com Mon Jan 28 16:37:16 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: ; from Michael R. Wolf on Sat, Jan 26, 2002 at 09:53:32AM -0500 References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> Message-ID: <20020128143716.A2031@timji.consultix.wa.com> On Sat, Jan 26, 2002 at 09:53:32AM -0500, Michael R. Wolf wrote: > "Richard Anderson" writes: > > > $MyClass::Debug = 1; # or 2 or 3 > > if (Debug > 0) { You meant: > > if ($Debug > 0) { > > print (whatever) > > } > > I, too, use statements like this, but format them as follows: > > print STDERR "Debug/Assertion statement" if $debug; > or > print STDERR "Debug/Assertion statement" if $debug > 1; > > The reason I like this is that it reads as an assertion > comment for casual human readers, but runs like an if > statement. > -- Michael R. Wolf Personally, I rarely use this syntax, despite its purported "ergonomic" advantages, because in doing so I risk having to restructure the whole statement later on when I find a need to do a *second thing* conditionally: > print STDERR "Debug/Assertion statement" if $debug > 1; BECOMES: if ($debug > 1) { print STDERR "Debug statement" ; second_thing; } OR even: do { print STDERR "Debug statement" ; second_thing; } if $debug > 1; Using an if-construct in the first place guarantees that this part of the program can evolve without being restructured. Sure there's a speed tradeoff, because of the overhead of setting up the new scope for the { }, but that's one I'm often willing to accept. But, of course, TMTOWTDI! 8-} *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From cmeyer at helvella.org Mon Jan 28 17:08:23 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <20020128143716.A2031@timji.consultix.wa.com> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020128143716.A2031@timji.consultix.wa.com> Message-ID: <20020128150823.B14938@hobart.helvella.org> On Mon, Jan 28, 2002 at 02:37:16PM -0800, Tim Maher wrote: > > > print STDERR "Debug/Assertion statement" if $debug > 1; > > BECOMES: > if ($debug > 1) { print STDERR "Debug statement" ; second_thing; } > OR even: > do { print STDERR "Debug statement" ; second_thing; } if $debug > 1; Or even: print (STDERR "Debug statement"), second_thing if $debug > 1; > > But, of course, TMTOWTDI! 8-} Have fun, -C. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From harding.a at portseattle.org Mon Jan 28 17:30:51 2002 From: harding.a at portseattle.org (Harding, Alyssa) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Worlds First Player vs Player Blackjack Message-ID: Is this gambling application written in Perl? Why is this list getting messages from companies like this? Blackjackshack.com: Kindly remove spug-list@pm.org from your distribution list immediately as I am sure we have not opted-in to any advertising from your company. Perhaps you did not know that this is a mailing list for Perl programming related topics. -----Original Message----- From: support@blackjackshack.com [mailto:support@blackjackshack.com] Sent: Monday, January 28, 2002 6:21 AM To: spug-list@pm.org Subject: SPUG: Worlds First Player vs Player Blackjack NEW 25 cent tables! Blackjack Shack eliminates the traditional casino House and transfers the House advantage to players. Players compete in one-on-one sessions against each other and never play against the House. Our game is similar to a poker room where the House only serves as host and never competes against players. This is the only blackjack game in existence where player skill determines the advantage. Success is measured by how well you play, not how lucky you are. Test our game today and you'll see why we have the most fair and credible blackjack game on the planet. Come join other blackjack enthusiasts from all over the world and play for fun or for real money. "Highly recommended" - Smartergaming.com Blackjackshack.com To unsubscribe please reply to: unsubscribe@blackjackshack.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020128/09e8d454/attachment.htm From noah at geospiza.com Mon Jan 28 17:40:19 2002 From: noah at geospiza.com (Noah Iliinsky) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Worlds First Player vs Player Blackjack In-Reply-To: References: Message-ID: <02012815401900.10128@backbay.office.geospiza> Tim, can non-subscribers post to this list? If so, is that desirable behavior? -N On Monday 28 January 2002 15:30, Harding, Alyssa wrote: > Is this gambling application written in Perl? > > Why is this list getting messages from companies like this? > > Blackjackshack.com: > Kindly remove spug-list@pm.org from your > distribution list immediately as I am sure we have not opted-in to any > advertising from your company. Perhaps you did not know that this is a > mailing list for Perl programming related topics. -- Noah Iliinsky noah at geospiza dot com (206) 633-4403 x106 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From tim at consultix-inc.com Mon Jan 28 18:32:12 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <20020128150823.B14938@hobart.helvella.org>; from Colin Meyer on Mon, Jan 28, 2002 at 03:08:23PM -0800 References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020128143716.A2031@timji.consultix.wa.com> <20020128150823.B14938@hobart.helvella.org> Message-ID: <20020128163212.A2797@timji.consultix.wa.com> On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: > On Mon, Jan 28, 2002 at 02:37:16PM -0800, Tim Maher wrote: > > > > > print STDERR "Debug/Assertion statement" if $debug > 1; > > > > BECOMES: > > if ($debug > 1) { print STDERR "Debug statement" ; second_thing; } > > OR even: > > do { print STDERR "Debug statement" ; second_thing; } if $debug > 1; > > Or even: > > print (STDERR "Debug statement"), second_thing if $debug > 1; That's just too kinky. I thought the whole idea of this backwards statement was to make the code *easier* to read, not to make it harder to see how much is being executed conditionally! -Tim > > > > > But, of course, TMTOWTDI! 8-} > > Have fun, > -C. -- *===========================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | EMAIL: tim@consultix-inc.com WEB: http://www.consultix-inc.com | | TIM MAHER: UNIX/Perl DAMIAN CONWAY: Adv. Perl COLIN MEYER: Perl CGI/DBI | | CLASSES! FEB: Unix; Perl; APR: Shell; Int & OO Perl; Perl Database w/DBI | *===========================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Mon Jan 28 23:11:24 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? Message-ID: How to stripslashes, addslashes, strip_tags from mysql data? I can grab the data and I can have it email as it should but it emails with things like
in the text which I don't want. Plus I don't want \' to show. I've done a lot of searching and haven't come up with the answer. Using $text = stripslashes($text); Gives me an error about not declaring or some such. TIA! Susanne Bullo (still having spam/relay problems with my server) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020128/da70c67b/attachment.htm From MichaelRunningWolf at att.net Tue Jan 29 09:52:20 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <20020128163212.A2797@timji.consultix.wa.com> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020128143716.A2031@timji.consultix.wa.com> <20020128150823.B14938@hobart.helvella.org> <20020128163212.A2797@timji.consultix.wa.com> Message-ID: Tim Maher writes: > On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: [...] > > Or even: > > > > print (STDERR "Debug statement"), second_thing if $debug > 1; > > That's just too kinky. I thought the whole idea of this backwards > statement was to make the code *easier* to read, not to make it > harder to see how much is being executed conditionally! Kinky? Maybe. Pushing the edge of my one-line limit? Probably. As with all formatting and logic issues in programming, there are competing values toward a balance point. - Don't waste extra curlies for a single-expression block - Hilight control flow - Hilight normal execution - Hilight normal execution - Limit expression modifiers to a single line For example, I think the inverted control flow works better in the first example below. The extra curlies, whitespace, and punctuation do not add any readability or flexibility in the second one. use Memoize; memoize (fib, fluffy_fib); sub fib { $n = shift; return 1 if $n == 1; return 0 if $n < 1; return fib($n -1) + fib($n-2); } sub fluffy_fib { $n = shift; if ($n == 1) { return 1; } if ($n < 1) { return 0; } return fluffy_fib($n -1) + fluffy_fib($n-2); } And here, I like that the control flow is easy to see. I over-emphasized it by lining up the "if", and it still fits on a line nicely. Even when there is something to do before next-ing, like the pragma processing. sub doit { while(<>) { next if /^\s*$/; # skip blank lines next if /^\s*#/; # skip shell-style comments do_pragma($_), next if /^pragma\b/; doit_toit($_); } } Obviously kinky, perverse. do { many lines of code here .. .. .. } if condition So I agree with your sentiment. I choose a different balance point for short expressions, especially if they tend to draw attention to the important part of the clause. Enjoy, it's Perl! It's Perl, enjoy! There's a different focus to the following (equivalent) statements. I utilize this in my English. And in my Perl. enjoy if $is_perl; if ($is_perl) { enjoy; } -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From MichaelRunningWolf at att.net Tue Jan 29 09:55:40 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <20020128163212.A2797@timji.consultix.wa.com> References: <200201150205.g0F25Nx15349@phineas.chriskate.net> <20020114185439.A21036@hobart.helvella.org> <009401c19d8b$26e59680$3d88ddd1@aciwin> <20020128143716.A2031@timji.consultix.wa.com> <20020128150823.B14938@hobart.helvella.org> <20020128163212.A2797@timji.consultix.wa.com> Message-ID: Tim Maher writes: > On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: [...] > > Or even: > > > > print (STDERR "Debug statement"), second_thing if $debug > 1; > > That's just too kinky. I thought the whole idea of this backwards > statement was to make the code *easier* to read, not to make it > harder to see how much is being executed conditionally! Kinky? Maybe. Pushing the edge of my one-line limit? Probably. As with all formatting and logic issues in programming, there are competing values toward a balance point. - Don't waste extra curlies for a single-expression block - Hilight control flow - Hilight normal execution - Hilight normal execution - Limit expression modifiers to a single line For example, I think the inverted control flow works better in the first example below. The extra curlies, whitespace, and punctuation do not add any readability or flexibility in the second one. use Memoize; memoize (fib, fluffy_fib); sub fib { $n = shift; return 1 if $n == 1; return 0 if $n < 1; return fib($n -1) + fib($n-2); } sub fluffy_fib { $n = shift; if ($n == 1) { return 1; } if ($n < 1) { return 0; } return fluffy_fib($n -1) + fluffy_fib($n-2); } And here, I like that the control flow is easy to see. I over-emphasized it by lining up the "if", and it still fits on a line nicely. Even when there is something to do before next-ing, like the pragma processing. sub doit { while(<>) { next if /^\s*$/; # skip blank lines next if /^\s*#/; # skip shell-style comments do_pragma($_), next if /^pragma\b/; doit_toit($_); } } Obviously kinky, perverse. do { many lines of code here .. .. .. } if condition So I agree with your sentiment. I choose a different balance point for short expressions, especially if they tend to draw attention to the important part of the clause. There's a different focus to the following (equivalent) statements. I utilize this in my English. Enjoy, it's Perl! It's Perl, enjoy! And in my Perl. enjoy if $is_perl; if ($is_perl) { enjoy; } And of course, TMTOWTDI $is_perl && enjoy; if ($is_perl) { enjoy; } -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From richard at richard-anderson.org Tue Jan 29 11:21:16 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) References: <200201150205.g0F25Nx15349@phineas.chriskate.net><20020114185439.A21036@hobart.helvella.org><009401c19d8b$26e59680$3d88ddd1@aciwin> <20020128143716.A2031@timji.consultix.wa.com><20020128150823.B14938@hobart.helvella.org><20020128163212.A2797@timji.consultix.wa.com> Message-ID: <013301c1a8e9$5d691a60$2988ddd1@aciwin> I still agree with Tim. Michael's example was a straw man. A fair comparison would be: return 1 if $n == 1; return 0 if $n < 1; versus if ($n == 1) { return 1; } if ($n < 1) ( return 0; } The shortness of this statement makes the first form more acceptable, but it still states the action of the statement backwards. The point of the statement is to make a conditional test and if it succeeds, do something. So the logical and readable way to right it is the second form. This becomes even more significant with longer statements. And I think Michael's use of non-standard indenting: next if /^\s*$/; # skip blank lines next if /^\s*#/; # skip shell-style comments adds nothing to the readability of the code. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Michael R. Wolf" To: Sent: Tuesday, January 29, 2002 7:55 AM Subject: Re: SPUG: Debugging methodology (was: How to deal with same name packages?) > Tim Maher writes: > > > On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: > [...] > > > Or even: > > > > > > print (STDERR "Debug statement"), second_thing if $debug > 1; > > > > That's just too kinky. I thought the whole idea of this backwards > > statement was to make the code *easier* to read, not to make it > > harder to see how much is being executed conditionally! > > Kinky? Maybe. Pushing the edge of my one-line limit? > Probably. > > As with all formatting and logic issues in programming, > there are competing values toward a balance point. > > - Don't waste extra curlies for a single-expression block > - Hilight control flow > - Hilight normal execution > - Hilight normal execution > - Limit expression modifiers to a single line > > For example, I think the inverted control flow works better > in the first example below. The extra curlies, whitespace, > and punctuation do not add any readability or flexibility in > the second one. > > use Memoize; > memoize (fib, fluffy_fib); > > sub fib > { > $n = shift; > return 1 if $n == 1; > return 0 if $n < 1; > return fib($n -1) + fib($n-2); > } > > sub fluffy_fib > { > $n = shift; > if ($n == 1) { > return 1; > } > if ($n < 1) { > return 0; > } > return fluffy_fib($n -1) + fluffy_fib($n-2); > } > > And here, I like that the control flow is easy to see. I > over-emphasized it by lining up the "if", and it still fits > on a line nicely. Even when there is something to do before > next-ing, like the pragma processing. > > sub doit { > while(<>) { > next if /^\s*$/; # skip blank lines > next if /^\s*#/; # skip shell-style comments > do_pragma($_), next if /^pragma\b/; > doit_toit($_); > } > } > > Obviously kinky, perverse. > > do { > many lines of code here > .. > .. > .. > } if condition > > > So I agree with your sentiment. I choose a different > balance point for short expressions, especially if they tend > to draw attention to the important part of the clause. > > > There's a different focus to the following (equivalent) > statements. I utilize this in my English. > > Enjoy, it's Perl! > > It's Perl, enjoy! > > And in my Perl. > > enjoy if $is_perl; > > if ($is_perl) { > enjoy; > } > > And of course, TMTOWTDI > > $is_perl && enjoy; > > if ($is_perl) { enjoy; } > > -- > Michael R. Wolf > All mammals learn by playing! > MichaelRunningWolf@att.net > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From noah at geospiza.com Tue Jan 29 11:46:54 2002 From: noah at geospiza.com (Noah Iliinsky) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: References: Message-ID: <02012909465400.11450@backbay.office.geospiza> Hi Susanne. If you give specific examples of the text you want to filter I'm sure we can come up with the regex's you need. Cheers, Noah On Monday 28 January 2002 21:11, Susanne Bullo wrote: > How to stripslashes, addslashes, strip_tags from mysql data? I can grab > the data and I can have it email as it should but it emails with things > like
in the text which I don't want. Plus I don't want \' to show. > I've done a lot of searching and haven't come up with the answer. Using > > $text = stripslashes($text); > > Gives me an error about not declaring or some such. > > TIA! > > Susanne Bullo (still having spam/relay problems with my server) ---------------------------------------- Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1" Content-Transfer-Encoding: quoted-printable Content-Description: ---------------------------------------- -- Noah Iliinsky noah at geospiza dot com (206) 633-4403 x106 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From Daniel.Pommert at verizonwireless.com Tue Jan 29 12:07:55 2002 From: Daniel.Pommert at verizonwireless.com (Pommert, Daniel) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) Message-ID: <9B30436F511ED5118EDF0002A55C31800119D86C@cairvexmb03.la.airtouch.com> This all depends what you are used to. If you programmed a lot in C, you will be less comfortable with non-C syntax. If you programmed a lot in ksh before Perl became popular, then the "expr && action" syntax is obvious and natural. Michael's "non-standard indenting" reads well on a printed page and is very close to what is found in 2nd Camel, pp 104,5. It is also idiomatically common (in certain circles). A bigger question here is: How big is your script or routine and how many other people will be maintaining it? How long will its life be? I have been quite free wheeling with vector code, closures, morphing objects and Schwartz transforms when I knew that I would be the primary one maintaining the code (and I took the time to comment my code clearly). In shops where I knew my term was short lived and I saw that my coworkers tended to be not very advanced in Perl, I tended to tone things down a bit. (Although, I really I really had a hard time weaning myself from those nested map lines!) IMHO, TMTOWTDI and you need to look at the culture around you. -- Daniel Pommert Verizon Wireless 425-603-8612 -----Original Message----- From: Richard Anderson [mailto:richard@richard-anderson.org] Sent: Tuesday, January 29, 2002 9:21 AM To: spug-list@pm.org Subject: Re: SPUG: Debugging methodology (was: How to deal with same name packages?) I still agree with Tim. Michael's example was a straw man. A fair comparison would be: return 1 if $n == 1; return 0 if $n < 1; versus if ($n == 1) { return 1; } if ($n < 1) ( return 0; } The shortness of this statement makes the first form more acceptable, but it still states the action of the statement backwards. The point of the statement is to make a conditional test and if it succeeds, do something. So the logical and readable way to right it is the second form. This becomes even more significant with longer statements. And I think Michael's use of non-standard indenting: next if /^\s*$/; # skip blank lines next if /^\s*#/; # skip shell-style comments adds nothing to the readability of the code. Cheers, Richard richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Michael R. Wolf" To: Sent: Tuesday, January 29, 2002 7:55 AM Subject: Re: SPUG: Debugging methodology (was: How to deal with same name packages?) > Tim Maher writes: > > > On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: > [...] > > > Or even: > > > > > > print (STDERR "Debug statement"), second_thing if $debug > 1; > > > > That's just too kinky. I thought the whole idea of this backwards > > statement was to make the code *easier* to read, not to make it > > harder to see how much is being executed conditionally! > > Kinky? Maybe. Pushing the edge of my one-line limit? > Probably. > > As with all formatting and logic issues in programming, > there are competing values toward a balance point. > > - Don't waste extra curlies for a single-expression block > - Hilight control flow > - Hilight normal execution > - Hilight normal execution > - Limit expression modifiers to a single line > > For example, I think the inverted control flow works better > in the first example below. The extra curlies, whitespace, > and punctuation do not add any readability or flexibility in > the second one. > > use Memoize; > memoize (fib, fluffy_fib); > > sub fib > { > $n = shift; > return 1 if $n == 1; > return 0 if $n < 1; > return fib($n -1) + fib($n-2); > } > > sub fluffy_fib > { > $n = shift; > if ($n == 1) { > return 1; > } > if ($n < 1) { > return 0; > } > return fluffy_fib($n -1) + fluffy_fib($n-2); > } > > And here, I like that the control flow is easy to see. I > over-emphasized it by lining up the "if", and it still fits > on a line nicely. Even when there is something to do before > next-ing, like the pragma processing. > > sub doit { > while(<>) { > next if /^\s*$/; # skip blank lines > next if /^\s*#/; # skip shell-style comments > do_pragma($_), next if /^pragma\b/; > doit_toit($_); > } > } > > Obviously kinky, perverse. > > do { > many lines of code here > .. > .. > .. > } if condition > > > So I agree with your sentiment. I choose a different > balance point for short expressions, especially if they tend > to draw attention to the important part of the clause. > > > There's a different focus to the following (equivalent) > statements. I utilize this in my English. > > Enjoy, it's Perl! > > It's Perl, enjoy! > > And in my Perl. > > enjoy if $is_perl; > > if ($is_perl) { > enjoy; > } > > And of course, TMTOWTDI > > $is_perl && enjoy; > > if ($is_perl) { enjoy; } > > -- > Michael R. Wolf > All mammals learn by playing! > MichaelRunningWolf@att.net > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From richard at richard-anderson.org Tue Jan 29 13:33:27 2002 From: richard at richard-anderson.org (Richard Anderson) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) References: <9B30436F511ED5118EDF0002A55C31800119D86C@cairvexmb03.la.airtouch.com> Message-ID: <021c01c1a8fb$d4902a40$2988ddd1@aciwin> Style considerations based on historical precedent should not take precedence over considerations based on rationality and readability. When people are thinking about conditional actions, they phrase the action as "do this test, then take the appropriate action". Code that reflects the actual sequence of events is easier to read and understand. The "expr && action" is not bad, but not as readable and obvious as "if expr then action". Why not make it easy for your fellow coders to read your code? When you are writing documentation, would you write "Next, reset the registry setting for SysBoot Record to "Secure", close all applications and reboot your system unless you are running Windows 98, in which case this will render your system unbootable"? Cheers, Richard richard@richard-anderson.org www.richard-anderson.org ----- Original Message ----- From: "Pommert, Daniel" To: "'Richard Anderson'" ; Sent: Tuesday, January 29, 2002 10:07 AM Subject: RE: SPUG: Debugging methodology (was: How to deal with same name packages?) > This all depends what you are used to. If you programmed a lot in C, you > will be less comfortable with non-C syntax. If you programmed a lot in ksh > before Perl became popular, then the "expr && action" syntax is obvious and > natural. Michael's "non-standard indenting" reads well on a printed page > and is very close to what is found in 2nd Camel, pp 104,5. It is also > idiomatically common (in certain circles). > > A bigger question here is: How big is your script or routine and how many > other people will be maintaining it? How long will its life be? I have > been quite free wheeling with vector code, closures, morphing objects and > Schwartz transforms when I knew that I would be the primary one maintaining > the code (and I took the time to comment my code clearly). In shops where I > knew my term was short lived and I saw that my coworkers tended to be not > very advanced in Perl, I tended to tone things down a bit. (Although, I > really I really had a hard time weaning myself from those nested map lines!) > > IMHO, TMTOWTDI and you need to look at the culture around you. > > -- Daniel Pommert > Verizon Wireless > 425-603-8612 > > > -----Original Message----- > From: Richard Anderson [mailto:richard@richard-anderson.org] > Sent: Tuesday, January 29, 2002 9:21 AM > To: spug-list@pm.org > Subject: Re: SPUG: Debugging methodology (was: How to deal with same > name packages?) > > > I still agree with Tim. Michael's example was a straw man. A fair > comparison would be: > > return 1 if $n == 1; > return 0 if $n < 1; > > versus > > if ($n == 1) { return 1; } > if ($n < 1) ( return 0; } > > The shortness of this statement makes the first form more acceptable, but it > still states the action of the statement backwards. The point of the > statement is to make a conditional test and if it succeeds, do something. > So the logical and readable way to right it is the second form. This > becomes even more significant with longer statements. > > And I think Michael's use of non-standard indenting: > > next if /^\s*$/; # skip blank lines > next if /^\s*#/; # skip shell-style comments > > adds nothing to the readability of the code. > > Cheers, > Richard > richard@richard-anderson.org > www.richard-anderson.org > ----- Original Message ----- > From: "Michael R. Wolf" > To: > Sent: Tuesday, January 29, 2002 7:55 AM > Subject: Re: SPUG: Debugging methodology (was: How to deal with same name > packages?) > > > > Tim Maher writes: > > > > > On Mon, Jan 28, 2002 at 03:08:23PM -0800, Colin Meyer wrote: > > [...] > > > > Or even: > > > > > > > > print (STDERR "Debug statement"), second_thing if $debug > 1; > > > > > > That's just too kinky. I thought the whole idea of this backwards > > > statement was to make the code *easier* to read, not to make it > > > harder to see how much is being executed conditionally! > > > > Kinky? Maybe. Pushing the edge of my one-line limit? > > Probably. > > > > As with all formatting and logic issues in programming, > > there are competing values toward a balance point. > > > > - Don't waste extra curlies for a single-expression block > > - Hilight control flow > > - Hilight normal execution > > - Hilight normal execution > > - Limit expression modifiers to a single line > > > > For example, I think the inverted control flow works better > > in the first example below. The extra curlies, whitespace, > > and punctuation do not add any readability or flexibility in > > the second one. > > > > use Memoize; > > memoize (fib, fluffy_fib); > > > > sub fib > > { > > $n = shift; > > return 1 if $n == 1; > > return 0 if $n < 1; > > return fib($n -1) + fib($n-2); > > } > > > > sub fluffy_fib > > { > > $n = shift; > > if ($n == 1) { > > return 1; > > } > > if ($n < 1) { > > return 0; > > } > > return fluffy_fib($n -1) + fluffy_fib($n-2); > > } > > > > And here, I like that the control flow is easy to see. I > > over-emphasized it by lining up the "if", and it still fits > > on a line nicely. Even when there is something to do before > > next-ing, like the pragma processing. > > > > sub doit { > > while(<>) { > > next if /^\s*$/; # skip blank lines > > next if /^\s*#/; # skip shell-style comments > > do_pragma($_), next if /^pragma\b/; > > doit_toit($_); > > } > > } > > > > Obviously kinky, perverse. > > > > do { > > many lines of code here > > .. > > .. > > .. > > } if condition > > > > > > So I agree with your sentiment. I choose a different > > balance point for short expressions, especially if they tend > > to draw attention to the important part of the clause. > > > > > > There's a different focus to the following (equivalent) > > statements. I utilize this in my English. > > > > Enjoy, it's Perl! > > > > It's Perl, enjoy! > > > > And in my Perl. > > > > enjoy if $is_perl; > > > > if ($is_perl) { > > enjoy; > > } > > > > And of course, TMTOWTDI > > > > $is_perl && enjoy; > > > > if ($is_perl) { enjoy; } > > > > -- > > Michael R. Wolf > > All mammals learn by playing! > > MichaelRunningWolf@att.net > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > > > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From MichaelRunningWolf at att.net Tue Jan 29 13:52:58 2002 From: MichaelRunningWolf at att.net (Michael R. Wolf) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: <9B30436F511ED5118EDF0002A55C31800119D86C@cairvexmb03.la.airtouch.com> References: <9B30436F511ED5118EDF0002A55C31800119D86C@cairvexmb03.la.airtouch.com> Message-ID: "Pommert, Daniel" writes: [...] > IMHO, TMTOWTDI and you need to look at the culture around you. Hear! Hear! As a guest consultant, I'd weigh that more heavily than any of my personal preferences. If I'm following. If I'm leading, I may tend toward educating and creating a culture. For my own domestic code, I still consider it. It may run away from me, into the wild, and become feral Perl code in the public landscape. I use a metaphor of dancing. I'm a great dancer (and Perl coder). But I base my style on my partner. We have to look good *together*. And, especially if I'm the more experienced dancer (coder), it's my job to make my partner look great!!! -- Michael R. Wolf All mammals learn by playing! MichaelRunningWolf@att.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/ From sweetsue at sweethomes.com Tue Jan 29 17:07:40 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <02012909465400.11450@backbay.office.geospiza> Message-ID: Well, the email is going out like: Sign up for Retire Quickly with me.
http://... It should show without the
The coding I have is as follows: #!/usr/bin/perl use Time::Local; use POSIX qw(mktime); use DBI; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use File::Path; &get_date; sub get_date { @days = ('Sunday','Monday','Tuesday','Wednesday', 'Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $time = sprintf("%02d:%02d",$hour,$min); if ($year < 50){ $year += 2000; } else { $year += 1900; } $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $mon2 = $mon + 1; $date2 = "$mon2/$mday/$year"; $date3 = "$mon2.$mday.$year"; } my $buffer = ''; my $buffer2 = ''; my $buffer3 = ''; my $host = 'localhost'; my $database = 'safelist'; my $uname = 'admin'; my $password = 'srb6653'; my $ua = new LWP::UserAgent(); my $dbh = DBI->connect("DBI:mysql:$database", $uname, $password) || die "Failed DBI connect(): $!\n"; my $query = "select slmain.email_to, safelists.username, safelists.password, email_txt.email_subject, email_txt.email_text, members.username, schedule.system_name from schedule, members, slmain, email_txt, safelists where schedule.WED != '' and schedule.WED != 'N' and schedule.WED != '0' and schedule.uid = members.id and schedule.system_name = slmain.system_name and schedule.WED = email_txt.id and schedule.system_name = safelists.system_name and schedule.uid = safelists.uid and members.username != 'demo'"; $buffer .= "===> Executing Query: $query\n\n"; my $sth = $dbh->prepare($query); my $rc = $sth->execute(); while(@row = $sth->fetchrow_array()) { my $url = "http://$row[0]&username=$row[1]&password=$row[2]&subject=$row[3]&message=$r ow[4]"; $row[4] =~ s/\\//g; my $req = HTTP::Request->new(GET=>$url); my $datadir = "members/data/$row[5]/$row[6]"; my $file_path = "members/data/$row[5]/$row[6]/$date3"; if (! -d "$datadir") { system "mkdir -p $datadir" } my $resp = $ua->request($req, $file_path); my $sec_file_path = "members/data/$row[5]"; my $outfile = "index.html"; my $filename = "$sec_file_path/$outfile"; open (FILE,">>$filename") or die "Error opening $filename: $!"; { print FILE "Report on $date3 for '$row[6]'
"; } } close (FILE); my $query2 = "SELECT email_txt.uid, schedule.system_name from schedule, email_txt, members where schedule.WED IS NOT NULL and schedule.WED != 'N' and schedule.WED != '0' and schedule.WED = email_txt.id and members.id = email_txt.uid and members.username != 'demo'"; $buffer2 .= "===> Executing Query: $query2\n\n"; my $sth = $dbh->prepare($query2); my $rc = $sth->execute(); while (my($uid,$system_name) = $sth->fetchrow_array) { my $datestamp = $date2; my $timestamp = $time; my $query3 = "INSERT into reports (uid, system_name, last_success_run) values ('$uid', '$system_name', '$datestamp at $timestamp')"; $buffer3 .= "===> Executing Query: $query3\n\n"; my $sth = $dbh->prepare($query3); my $rc = $sth->execute(); } undef $sth; $dbh->disconnect; 0; Susanne Bullo - Sweet Homes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From jope-spug at jope.net Wed Jan 30 02:47:39 2002 From: jope-spug at jope.net (El JoPe Magnifico) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Debugging methodology (was: How to deal with same name packages?) In-Reply-To: Message-ID: On 29 Jan 2002, Michael R. Wolf wrote: > Tim Maher writes: >> That's just too kinky. I thought the whole idea of this backwards >> statement was to make the code *easier* to read, not to make it >> harder to see how much is being executed conditionally! [...] > As with all formatting and logic issues in programming, > there are competing values toward a balance point. If you're into kinky code, just wait til Perl 6's switch-on-steroids becomes an option. Man, the RFC on that thing made my brain hurt. Which was an obvious sign that Damian wrote it, of course. =) -jp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From sweetsue at sweethomes.com Wed Jan 30 11:27:19 2002 From: sweetsue at sweethomes.com (Susanne Bullo) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <02012909465400.11450@backbay.office.geospiza> Message-ID: I think I have it narrowed down but am still unclear as to what should be in: $row[4] =~ s/
/somethinghere/g; Basically, I want to look at that string in $row[4], find all instances of
and replace it with line breaks. Susanne Bullo - Sweet Homes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From tim at consultix-inc.com Wed Jan 30 11:33:22 2002 From: tim at consultix-inc.com (Tim Maher) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: ; from Susanne Bullo on Wed, Jan 30, 2002 at 09:27:19AM -0800 References: <02012909465400.11450@backbay.office.geospiza> Message-ID: <20020130093322.A17382@timji.consultix.wa.com> On Wed, Jan 30, 2002 at 09:27:19AM -0800, Susanne Bullo wrote: > I think I have it narrowed down but am still unclear as to what should be > in: > > $row[4] =~ s/
/somethinghere/g; You need to "quote" the literal / within the regular expression field, like so: $row[4] =~ s/
/somethinghere/g; Or better still, use a different delimiter: $row[4] =~ s|
|somethinghere|g; Also, are you sure there will always be a single space after the br? If not, put an asterisk after it, which means any number of spaces, including 0, is okay: $row[4] =~ s|
|somethinghere|g; > > Basically, I want to look at that string in $row[4], find all instances of >
and replace it with line breaks. Then I think you want: $row[4] =~ s|
|
|g; I won't even ask how you got those messed up line-break tags there in the first place! 8-} > > Susanne Bullo - Sweet Homes > -- *==============================================================================* | Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# | | tim@consultix-inc.com www.consultix-inc.com www.softwareprofessor.com | | FEB: Perl; APR: Shell; Int. & OO Perl; Perl DataBase; JUNE: Basic UNIX, Perl | *------------------------------------------------------------------------------* | NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle, 7/15-18 | | Adv. OOP * Adv. Module Implementation Techniques * Programming in Perl 6 | *==============================================================================* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From mathin at mathin.com Wed Jan 30 11:51:53 2002 From: mathin at mathin.com (Dan Ebert) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <20020130093322.A17382@timji.consultix.wa.com> Message-ID: Dan. ---------------------------------------------------------- Immigration is the sincerest form of flattery. - Unknown ---------------------------------------------------------- *snip* On Wed, 30 Jan 2002, Tim Maher wrote: > > > > > Basically, I want to look at that string in $row[4], find all instances of > >
and replace it with line breaks. > > Then I think you want: > > $row[4] =~ s|
|
|g; > Or if you want literal line breaks instead of HTML breaks: $row[4] =~ s|
|\n|g; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cwilkes-spug at ladro.com Wed Jan 30 12:31:09 2002 From: cwilkes-spug at ladro.com (Chris Wilkes) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: ; from sweetsue@sweethomes.com on Wed, Jan 30, 2002 at 09:27:19AM -0800 References: <02012909465400.11450@backbay.office.geospiza> Message-ID: <20020130103109.A68733@www.ladro.com> On Wed, Jan 30, 2002 at 09:27:19AM -0800, Susanne Bullo wrote: > I think I have it narrowed down but am still unclear as to what should be > in: > > $row[4] =~ s/
/somethinghere/g; > > Basically, I want to look at that string in $row[4], find all instances of >
and replace it with line breaks. Watch the slashes as you've started to tell perl to replace "
" and with the switches of "somethinghere" -- maybe if you just used the letters "imsxo" you could of made it through the interpreter ;) Backslash the "/" like "\/" or use a different symbol for your substitutes, like a #: $row[4] =~ s/
/somethinghere/g; # with backslashes $row[4] =~ s#
#somethinghere#g; # with #'s (easier to read) Now I have a question about this, what if she said $br = "< br />"; $row[4] =~ s/$br/somethinghere/g; Why doesn't that blow up? Good thing I checked this, I thought it did gives problems in previous versions of perl and was going to ask how to get around it. Chris - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From cmeyer at helvella.org Wed Jan 30 12:33:22 2002 From: cmeyer at helvella.org (Colin Meyer) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <20020130093322.A17382@timji.consultix.wa.com> References: <02012909465400.11450@backbay.office.geospiza> <20020130093322.A17382@timji.consultix.wa.com> Message-ID: <20020130103322.A20342@hobart.helvella.org> On Wed, Jan 30, 2002 at 09:33:22AM -0800, Tim Maher wrote: > > Then I think you want: > > $row[4] =~ s|
|
|g; > > I won't even ask how you got those messed up line-break tags there > in the first place! 8-} Those "messed up" break tags come from xhtml, and are completely compatible with sgml (and therefore with any of the older html standards). Any decent web browser renders
just as it renders
. The space is optional;
is valid xml & xhtml, but fools older web browsers. For info: http://www.w3.org/TR/xhtml1 Section 4 discusses differences between html & xhtml. Appendix C gives some useful html compatibility advice. Many generated (as opposed to hand written) webpages are xhtml compliant. If you've dealt with parsing html files (to extract data, add data, or otherwise transform documents), then you'll appreciate xhtml. xhtml is *much* easier to deal with. If you are doing anything more complex than replacing
with
or "\n", then you'll probably want to use HTML::Parser, or some combo of tidy and XML::*. Writing regexs to deal with longer tags, with optional attributes, and possibly spreading across two or more lines, is tough! Have fun, -C. p.s. I guess this post is off topic, but hopefully somewhat useful to web developers, which many of us reading this list are. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From ben at reser.org Wed Jan 30 13:04:38 2002 From: ben at reser.org (Ben Reser) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <20020130103109.A68733@www.ladro.com> References: <02012909465400.11450@backbay.office.geospiza> <20020130103109.A68733@www.ladro.com> Message-ID: <20020130190438.GD1395@titanium.brain.org> On Wed, Jan 30, 2002 at 10:31:09AM -0800, Chris Wilkes wrote: > Now I have a question about this, what if she said > $br = "< br />"; > $row[4] =~ s/$br/somethinghere/g; > Why doesn't that blow up? Good thing I checked this, I thought it did > gives problems in previous versions of perl and was going to ask how to > get around it. Because the parser knows what you mean. You can't do: $x = "print 'this';" $x; So why would it expand before executing the pattern? Frankly if you want to do something with /'s in it you should be doing something like this: s#
#\n#g; or whatever other delimeter you want that is compatable with your pattern. :) -- Ben Reser http://ben.reser.org What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is wrought under the name of totalitarianism or the holy name of liberty and democracy? - Ghandi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From perl-win32 at punch.net Wed Jan 30 19:45:18 2002 From: perl-win32 at punch.net (Tom Heady) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? In-Reply-To: <20020130190438.GD1395@titanium.brain.org> References: <02012909465400.11450@backbay.office.geospiza> <20020130103109.A68733@www.ladro.com> <20020130190438.GD1395@titanium.brain.org> Message-ID: <200201301745180189.153D31B6@smtp.punch.net> another safer option my $replace = "
"; $row[4] =~ s/\Q$replace\E/
/g; *********** REPLY SEPARATOR *********** On 1/30/2002 at 11:04 AM Ben Reser wrote: >On Wed, Jan 30, 2002 at 10:31:09AM -0800, Chris Wilkes wrote: >> Now I have a question about this, what if she said >> $br = "< br />"; >> $row[4] =~ s/$br/somethinghere/g; >> Why doesn't that blow up? Good thing I checked this, I thought it did >> gives problems in previous versions of perl and was going to ask how to >> get around it. > >Because the parser knows what you mean. You can't do: >$x = "print 'this';" >$x; > >So why would it expand before executing the pattern? > >Frankly if you want to do something with /'s in it you should be doing >something like this: >s#
#\n#g; >or whatever other delimeter you want that is compatable with your >pattern. >:) > >-- >Ben Reser >http://ben.reser.org > >What difference does it make to the dead, the orphans, and the homeless, >whether the mad destruction is wrought under the name of totalitarianism >or the holy name of liberty and democracy? - Ghandi > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org > Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL > Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address > For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest > Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From Ryan.Parr at wwireless.com Wed Jan 30 21:09:38 2002 From: Ryan.Parr at wwireless.com (Parr, Ryan) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Anyone savvy in this? Message-ID: <6D6F0541E2B1D411A75B0002A513016D028001BF@wacorpml03.wwireless.com> Susanne, Is it *just* the
tag you're looking to take out or are you trying to extract plain text from an HTML format? -- Ryan -----Original Message----- From: Susanne Bullo [mailto:sweetsue@sweethomes.com] Sent: Wednesday, January 30, 2002 9:27 AM To: Seattle Perl User's Group Subject: RE: SPUG: Anyone savvy in this? I think I have it narrowed down but am still unclear as to what should be in: $row[4] =~ s/
/somethinghere/g; Basically, I want to look at that string in $row[4], find all instances of
and replace it with line breaks. Susanne Bullo - Sweet Homes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POST TO: spug-list@pm.org PROBLEMS: owner-spug-list@pm.org Subscriptions; Email to majordomo@pm.org: ACTION LIST EMAIL Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org From trafficproducts at trafficwow.net Thu Jan 31 12:25:21 2002 From: trafficproducts at trafficwow.net (trafficproducts@trafficwow.net) Date: Wed Aug 4 00:08:36 2004 Subject: SPUG: Best Source of Internet Traffic and Search Engine Placements Message-ID: <20020131182653.F251398241@mail3.panix.com> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020131/b0d473c5/attachment.htm From Conferencing at alta-comm.ca Thu Jan 31 23:55:17 2002 From: Conferencing at alta-comm.ca (Conferencing@alta-comm.ca) Date: Wed Aug 4 00:08:41 2004 Subject: SPUG: Guaranteed Return On Your Investment Message-ID: <1012575281.0515628072@mail.alta-comm.ca> An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/spug-list/attachments/20020201/236dafd3/attachment.htm