From e at arix.com Sun Oct 3 17:33:58 2004 From: e at arix.com (Erick Calder) Date: Sun Oct 3 17:42:33 2004 Subject: [LA.pm] Meeting In-Reply-To: <415B04C4.1070809@bizrate.com> Message-ID: if it's a weeknight, Studio City/Pasadena areas are good for me. on the weekends Redondo Beach is better -----Original Message----- From: losangeles-pm-bounces@mail.pm.org [mailto:losangeles-pm-bounces@mail.pm.org]On Behalf Of Ofer Nave Sent: Wednesday, September 29, 2004 11:54 AM To: Robert Spier Cc: losangeles-pm@mail.pm.org Subject: Re: [LA.pm] Meeting Not sure the difference between a technical meeting and a dinner meeting. Can't we talk tech over dinner? So I vote for 1&2. When are you back from PerlWhirl? Does everyone prefer a weeknight or weekend night? Here are some restaurant suggestions: 1) Canters on Fairfax 2) IHOP on Sunset 3) House of Pies in Los Feliz 4) The Pantry, downtown 5) Burger Continental, Pasadena 6) Twains, Studio City (Ventura Blvd./Coldwater Cyn) (super cheap, 24hr, outdoor patio) 7) BJ's, Westwood 8) C&O Trattoria's, Marina Del Rey (awesome fun italian) 9) Anastasia's Asylum, Santa Monica (quiet cafe) -ofer Robert Spier wrote: >Well, if I'm in charge, we have three options: > >1- Wait until I get back from the PerlWhirl and then have a technical >meeting in West Hollywood. >2- Wait until I get back from the PerlWhirl and then have a dinner >meeting at some random and yummy restaurant. >3- Someone else takes charge and do something else sooner. > >At Tue, 28 Sep 2004 10:08:43 -0700, >Arkadiy wrote: > > >>Agreed! >> >>Actually, Robert did, no? :) >> >> >>Arkadiy wrote: >> >> >> >>>Agreed! >>> >>>-----Original Message----- >>>From: losangeles-pm-bounces@mail.pm.org >>>[mailto:losangeles-pm-bounces@mail.pm.org] On Behalf Of Robert Spier >>>Sent: Monday, September 27, 2004 8:44 PM >>>To: losangeles-pm@mail.pm.org >>>Subject: [LA.pm] Meeting >>> >>> >>>We should have a meeting. >>> >>>-R >>>_______________________________________________ >>>Losangeles-pm mailing list >>>Losangeles-pm@mail.pm.org >>>http://mail.pm.org/mailman/listinfo/losangeles-pm >>> >>>_______________________________________________ >>>Losangeles-pm mailing list >>>Losangeles-pm@mail.pm.org >>>http://mail.pm.org/mailman/listinfo/losangeles-pm >>> >>> >>> >>> >>Someone needs to volunteer to organize it. >> >>-ofer >>_______________________________________________ >>Losangeles-pm mailing list >>Losangeles-pm@mail.pm.org >>http://mail.pm.org/mailman/listinfo/losangeles-pm >> >>_______________________________________________ >>Losangeles-pm mailing list >>Losangeles-pm@mail.pm.org >>http://mail.pm.org/mailman/listinfo/losangeles-pm >> >> >_______________________________________________ >Losangeles-pm mailing list >Losangeles-pm@mail.pm.org >http://mail.pm.org/mailman/listinfo/losangeles-pm > > _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm From fred.kleindenst at citigroup.com Tue Oct 5 18:33:21 2004 From: fred.kleindenst at citigroup.com (Kleindenst, Fred) Date: Tue Oct 5 18:33:27 2004 Subject: [LA.pm] Re: Losangeles-pm Digest, Vol 15, Issue 3 Message-ID: <1E6014B28FEE6F43A5F49C6628B7B85E02D6A3D1@EXNJMB11.nam.nsroot.net> See Bottom Post On Sep 29, 2004, at 12:57 PM, Clive Holloway wrote: >> Here are some restaurant suggestions: >> >> 1) Canters on Fairfax >> 2) IHOP on Sunset >> 3) House of Pies in Los Feliz >> 4) The Pantry, downtown >> 5) Burger Continental, Pasadena >> 6) Twains, Studio City (Ventura Blvd./Coldwater Cyn) (super cheap, >> 24hr, >> outdoor patio) >> 7) BJ's, Westwood >> 8) C&O Trattoria's, Marina Del Rey (awesome fun italian) >> 9) Anastasia's Asylum, Santa Monica (quiet cafe) > > 6/7/8 seems good. > > >For the non-westside contingent, I'd vote 3 or 5, or anywhere that I >can take the Gold / Red line to, which appears to be... 4, although I'm >actually not too keen on that. You could walk < 1 mile from the red line to 3 or gold line to 5 I offer my fav. restaurant: NaNa thai in old town Pasadena. Seconds from the rail line, free parking for 90 minutes. Excellent food. Certain to have space for 12/15 people. <$10 per entree. Some of the fine suggestions above would have trouble with groups ( C&0 in particular is always a zoo, and parking is non-existent ) _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm From joe-pm-org at elem.com Tue Oct 5 19:12:10 2004 From: joe-pm-org at elem.com (Joe Edmonds) Date: Tue Oct 5 19:12:13 2004 Subject: [LA.pm] C&O Cucina In-Reply-To: <1E6014B28FEE6F43A5F49C6628B7B85E02D6A3D1@EXNJMB11.nam.nsroot.net> References: <1E6014B28FEE6F43A5F49C6628B7B85E02D6A3D1@EXNJMB11.nam.nsroot.net> Message-ID: <87acv0puw5.fsf@ixia.rent.com> Kleindenst, Fred wrote: > C&0 in particular is always a zoo, and parking is non-existent FWIW, there is a new C&O branch, a mile inland, that has better parking (and fewer caged animals): http://co-cucina.notlong.com/ From nick at docmagic.com Fri Oct 8 15:56:48 2004 From: nick at docmagic.com (Nicholas Bernstein) Date: Fri Oct 8 15:53:42 2004 Subject: [LA.pm] Hello Message-ID: <1097269008.4990.70.camel@nick.docmagic.com> Just wanted to say hello and introduce myself. I'm a sys admin, use perl regularly for tasks involving system administration, personal projects, and odd development tasks that come up from time to time. I don't know if last month was a light month or not, but I was wondering if 1-2 messages/month is really an accurate number of how much use this list gets. -Nick -- Nicholas Bernstein, Unix Systems Administrator Document Systems Inc. http://docmagic.com nick@docmagic.com CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. From darkuncle at darkuncle.net Fri Oct 8 21:55:54 2004 From: darkuncle at darkuncle.net (Scott Francis) Date: Fri Oct 8 21:55:39 2004 Subject: [LA.pm] Hello In-Reply-To: <1097269008.4990.70.camel@nick.docmagic.com> References: <1097269008.4990.70.camel@nick.docmagic.com> Message-ID: <20041009025554.GH28380@darkuncle.net> On Fri, Oct 08, 2004 at 01:56:48PM -0700, nick@docmagic.com said: > Just wanted to say hello and introduce myself. I'm a sys admin, use perl > regularly for tasks involving system administration, personal projects, > and odd development tasks that come up from time to time. I don't know > if last month was a light month or not, but I was wondering if 1-2 > messages/month is really an accurate number of how much use this list > gets. pretty much. The traffic picks up whenever we're discussing where to eat for the next get-together, but UUASC seems to have more Perl traffic than LA.pm. :) -- Scott Francis | darkuncle(at)darkuncle(dot)net | 0x5537F527 The ultimate result of shielding men from the effects of folly is to fill the world with fools. -- Herbert Spencer From ask at develooper.com Sat Oct 9 00:08:18 2004 From: ask at develooper.com (=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?=) Date: Sat Oct 9 00:31:25 2004 Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th Message-ID: <3B73C01F-19B1-11D9-887C-000A957168EC@develooper.com> Damian will be in town so we'll have a meeting probably on the 19th. Stay tuned for time, location and other such details... :-) - ask -- http://www.askbjoernhansen.com/ From bill at daze.net Sat Oct 9 04:26:07 2004 From: bill at daze.net (bill@daze.net) Date: Sat Oct 9 04:26:15 2004 Subject: [LA.pm] Hello In-Reply-To: <20041009025554.GH28380@darkuncle.net> References: <1097269008.4990.70.camel@nick.docmagic.com> <20041009025554.GH28380@darkuncle.net> Message-ID: <20041009022223.I49974@droid.daze.net> > pretty much. The traffic picks up whenever we're discussing where to eat for > the next get-together, but UUASC seems to have more Perl traffic than LA.pm. Which reminds me... there was talk on this list about having a meeting sometime in the future. Well, UUASC-OC is having a meeting about Perl this *Monday* near John Wayne Airport in Irvine. Here is the announcement: UUASC-OC Unix Users Association of Southern California Orange County Chapter October Meeting --------------------------------------------- Poor Perl Programming --------------------------------------------- Monday, Oct. 11, 7-9 PM Sun Microsystems, Inc. 2020 S. Main St. in Irvine 12th Floor --------------------------------------------- NOTE: PLEASE BE AWARE OF OUR NEW LOCATION. UUASC prides itself on presenting fair and balanced UNIX. After hosting a series of lessons on AWK during the past couple of years, we felt it necessary to provide a Perl tutorial. Kenytt Avery, one of UUASC's resident Perl programmers, maintains that Perl has a reputation for being ugly because too many people insist on writing poor code. At the October meeting of UUASC-OC, Kenytt will take some really bad Perl scripts and show us how to whip them into shape. He will show us some common errors, how to fix them, and how some common Perl idioms can make your code easier to read and maintain. Examples will be drawn from open source projects such as NMIS, MetaDot, and LogWatch, and names will not be changed to protect the guilty. Kenytt once had the goal of acheiving more industry certifications than any other unemployed sysadmin, but is now gainfully employed by Willing Minds LLC, http://www.willingminds.com . He wrote his first Perl program in 1993. POST-MEETING ACTIVITIES: Join us at the Pilsner Room, within walking distance. AFTER HOURS ACCESS: The Sun building's doors are locked at 7 p.m. If you arrive late, please contact the guard at 949 - 372 - 2937 for access. CARPOOL INFO: If you are interested in joining a carpool with other members, please post an email to the general list, uuasc@uuasc.org , requesting carpool info. PARKING: Convenient FREE parking is located next to the Sun office building in the visitor parking lot for after hours usage. Take a ticket when entering the garage but don't be concerned - no one will be there to collect money when the meeting ends, so you can exit for free. DIRECTIONS: Exit the San Diego Freeway (I-405) at MacArthur, go north (away from the airport) to the signal at Main Street (the first cross-street), turn right to Mercantile (the first signal on Main Street), turn right to parking. Please visit our web site, http://uuasc.org/oc.html , where you will find a detailed map. Here's an ASCII version: | Mercantile | Gillette | v | Main -----+---------+---------------+----------- | | ElTorito | | | | | | Sun | | \_______________/ +--\ parking | /\ 405 ======|===================================== | \/ Airport +--/ (all intersections shown | have signals (+)) The El Torito is on the corner and can serve as a landmark. The Pilsner Room is at the other end of the same block, Gillette and Main. The Sun building is behind the one with El Torito. 949-833-1640. UUASC-OC wants to thank our host, Sun Microsystems, for the continued support of our meetings. --------------------------------------------------------------------- The UUASC is for all persons using Unix either personally or professionally, or interested in learning more about Unix. We recognize all varieties of Unix, including (without prejudice) HP/UX, Linux, SVr4, Solaris, AIX, and BSD. This is a good place to meet others with similar interests and broaden your skills and knowledge. Generally, meetings include a technical presentation on a hardware or software topic of current interest to the Unix community and a round-table discussion of current topics of interest to the group. We are always looking for interesting presentations and your suggestions are most welcome. Please join us this month and bring along your friends or co-workers. Also, please forward this announcement to others who may be interested and feel free to post it to wherever you wish, both electronically and physically. If you receive more than one announcement by email, please let us know so we can keep our lists current. ------------------------------------------------------------------------ This list is for announcements only. Send all discussion to the regular UUASC list. For details, send message "info UUASC" to Majordomo@UUASC.org. To unsubscribe, send "unsubscribe UUASC-announce" to Majordomo@UUASC.org. From RNathan at baxglobal.com Sun Oct 10 04:13:46 2004 From: RNathan at baxglobal.com (Ranga Nathan) Date: Sun Oct 10 04:14:11 2004 Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th In-Reply-To: <3B73C01F-19B1-11D9-887C-000A957168EC@develooper.com> Message-ID: Awesome. I have not met him for a while, since moving from Boston. Please allow for travel from OC. Thanks __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 Ask Bj?rn Hansen Sent by: losangeles-pm-bounces@mail.pm.org 10/08/2004 10:08 PM To: Los Angeles Perl Mongers cc: Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th Damian will be in town so we'll have a meeting probably on the 19th. Stay tuned for time, location and other such details... :-) - ask -- http://www.askbjoernhansen.com/ _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/losangeles-pm/attachments/20041010/c536c80e/attachment.htm From RNathan at baxglobal.com Sun Oct 10 04:20:40 2004 From: RNathan at baxglobal.com (Ranga Nathan) Date: Sun Oct 10 04:20:45 2004 Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th In-Reply-To: Message-ID: Can we ask Damien to present "Quantum Superpositions"? Hopefully there will be a book-signing. I would like to purchase his OO book and have it signed. __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 Ranga Nathan Sent by: losangeles-pm-bounces@mail.pm.org 10/10/2004 02:13 AM To: Los Angeles Perl Mongers cc: Subject: Re: [LA.pm] Damian coming to town - meeting on Tuesday the 19th Awesome. I have not met him for a while, since moving from Boston. Please allow for travel from OC. Thanks __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 Ask Bj?rn Hansen Sent by: losangeles-pm-bounces@mail.pm.org 10/08/2004 10:08 PM To: Los Angeles Perl Mongers cc: Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th Damian will be in town so we'll have a meeting probably on the 19th. Stay tuned for time, location and other such details... :-) - ask -- http://www.askbjoernhansen.com/ _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/losangeles-pm/attachments/20041010/73b8a18c/attachment.htm From onave at bizrate.com Tue Oct 12 15:54:14 2004 From: onave at bizrate.com (Ofer Nave) Date: Tue Oct 12 15:54:27 2004 Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th In-Reply-To: <3B73C01F-19B1-11D9-887C-000A957168EC@develooper.com> References: <3B73C01F-19B1-11D9-887C-000A957168EC@develooper.com> Message-ID: <416C4476.5010004@bizrate.com> Staying tuned. So... any news? -ofer Ask Bj?rn Hansen wrote: > Damian will be in town so we'll have a meeting probably on the 19th. > > Stay tuned for time, location and other such details... :-) > > > - ask > From RNathan at baxglobal.com Wed Oct 13 15:34:45 2004 From: RNathan at baxglobal.com (Ranga Nathan) Date: Wed Oct 13 15:35:27 2004 Subject: [LA.pm] Damian coming to town - meeting on Tuesday the 19th In-Reply-To: <416C4476.5010004@bizrate.com> Message-ID: I was at the Unix User Group of O.C on Monday. The members were interested in knowing about Damian's visit. Are the place and time confirmed? Thanks __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 Ofer Nave Sent by: losangeles-pm-bounces@mail.pm.org 10/12/2004 01:54 PM To: Ask Bj?rn Hansen cc: Los Angeles Perl Mongers Subject: Re: [LA.pm] Damian coming to town - meeting on Tuesday the 19th Staying tuned. So... any news? -ofer Ask Bj?rn Hansen wrote: > Damian will be in town so we'll have a meeting probably on the 19th. > > Stay tuned for time, location and other such details... :-) > > > - ask > _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/losangeles-pm/attachments/20041013/9b295ba5/attachment.htm From RNathan at baxglobal.com Sun Oct 17 20:03:40 2004 From: RNathan at baxglobal.com (Ranga Nathan) Date: Sun Oct 17 20:03:47 2004 Subject: [LA.pm] Damian coming to LA Message-ID: Is this still on? Is it going to be combined with the upcoming meeting or is this a special event. Would someone give an update please? __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/archives/losangeles-pm/attachments/20041017/237c4599/attachment.htm From ask at develooper.com Mon Oct 18 03:22:58 2004 From: ask at develooper.com (=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?=) Date: Mon Oct 18 03:23:05 2004 Subject: [LA.pm] Damian coming to LA In-Reply-To: References: Message-ID: On Oct 17, 2004, at 6:03 PM, Ranga Nathan wrote: > Is this still on? Is it going to be combined with the upcoming meeting > or is this a special event. Would someone give an update please? Yup ? Tuesday night at 7pm, most likely in West Hollywood. We should have directions and parking instructions and such early monday afternoon. :-) - ask -- http://www.askbjoernhansen.com/ From nick at docmagic.com Mon Oct 18 13:22:20 2004 From: nick at docmagic.com (Nicholas Bernstein) Date: Mon Oct 18 13:17:08 2004 Subject: [LA.pm] See if this sparks some perl talk. Message-ID: <1098123740.20049.26.camel@nick.docmagic.com> I needed to throw together a script to pull the redsox scores down from a website and text message the scores to a friend. We have a tradition of doing this for friends when they can't watch the game, and I tend to forget to keep sending scores for innings at a time. :) Anyway, since I threw this together rather quickly, didn't put enough effort in to be embarrassed by it, I figured maybe it might be a good way to spark up the list a bit. Critique, improve, extend, replace, turn into something else, etc. Right now, it's run from cron, and works. :) The log page is generated, and you can use the older URL to view an example of what I'm scraping. The one in the example should work fine. -nick ###------------------------ start script #!/usr/bin/perl -w use warnings; #use Mail::Sendmail; #use diagnostics; $^W=0; $debug = 0; =pod This script scrapes the boston.com website for the scores to Boston redsox games. It's not very dynamic, You'll need to change the opponenent Page can be found @: http://boston.com -> sports -> redsox -> log eg usage: ./scores.pl 'http://146.145.120.3/merge/tsnform.aspx?c=globe&page=mlb/scores/live/log.aspx?GameID=11880' Mail:;Sendmail: perl -MCPAN -e "install Mail::Sendmail" =cut $url = "\'" . $ARGV[0] . "\'" ; $mail_app = '/usr/bin/mail' ; $have_score = 0 ; @page = `lynx -dump $url`; $email = '8675309@vtext.com, me@nicholasbernstein.com'; $regex = '(NY Yankees \d+, [Bb]oston \d+)'; if ( defined($ARGV[2]) ) { $log = $ARGV[2]; } else { $log = "/tmp/scores.pl.log"; } print "$log\n" if ( $debug == 1 ) ; foreach ( @page ) { if ( ( $_ =~ m/$regex/) and ( $have_score == 0 )) { $score = $1; chomp($score); if ( -f $log ) { print "In log exists\n" if ($debug==1); open("LOG", "<$log") or die("problem opening file\n"); @old_score = or die("could not read log\n"); close("LOG"); print "\nLog: $old_score[0]\n" if ( $debug == 1 ); $old_score=$old_score[0]; } else { print "In log does not exist\n" if ($debug==1); open("LOG", ">", $log); print LOG "none"; close(LOG); $old_score = "none"; } chomp($old_score); if ( $score ne $old_score ) { open(MAILAPP, "|$mail_app -s \"RedSox Score\" -r \"scores\@nicholasbernstein.com\" $email"); print MAILAPP "$score" ; close("MAILAPP"); print "$score\n"; open ("LOG", ">", $log); print LOG "$score\n"; close("LOG"); print "Scores are different" if ( $debug == 1 ); } $have_score = 1 ; } } ###------------------------ end script -- Nicholas Bernstein, Unix Systems Administrator Document Systems Inc. http://docmagic.com nick@docmagic.com CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. From ask at develooper.com Mon Oct 18 18:02:17 2004 From: ask at develooper.com (=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?=) Date: Mon Oct 18 18:02:40 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th Message-ID: Here's finally the address for the meeting tomorrow! It's Tuesday October 19th, 7pm at: Ticketmaster 8800 W Sunset Blvd West Hollywood, CA 90069 http://xrl.us/djhk (Link to www.mapquest.com) http://xrl.us/djhn (Link to maps.yahoo.com) You can only get on Palm from Santa Monica or Holloway Dr. Holloway is only accessible from Santa Monica or La Cienega. SO: It's easiest just to take Santa Monica to Palm. Go North on Palm until just before Holloway/Sunset Blvd., the parking garage is on the West side of the street. When you have parked, go up to the security desk at 1st floor and someone will be there to help you upstairs. There's also group of people watching a movie in the Ticketmaster movie theater -- that's not us, so be sure not to confuse the two. =) - ask ps. let me know if you are going from around Pasadena before the meeting or to Pasadena after the meeting and can help us get Damian back and forth. -- http://www.askbjoernhansen.com/ From ben_tilly at operamail.com Mon Oct 18 20:03:36 2004 From: ben_tilly at operamail.com (Benjamin J. Tilly ) Date: Mon Oct 18 20:03:49 2004 Subject: [LA.pm] See if this sparks some perl talk. Message-ID: <20041019010337.0BCC43AA515@ws5-8.us4.outblaze.com> Nicholas Bernstein wrote: > > I needed to throw together a script to pull the redsox scores down from > a website and text message the scores to a friend. We have a tradition > of doing this for friends when they can't watch the game, and I tend to > forget to keep sending scores for innings at a time. :) > > Anyway, since I threw this together rather quickly, didn't put enough > effort in to be embarrassed by it, I figured maybe it might be a good > way to spark up the list a bit. Critique, improve, extend, replace, turn > into something else, etc. I'll just state the glaring stuff then. You should use strict and declare variables with my. As stated in perlstyle, you should test for failure of your system calls and emit errors: open(FILE, $file) or die "Cannot open '$file': $!"; I notice that you use ($foo == 1). A good habit is to reverse that and write (1 == $foo). That way if you accidentally type = instead of ==, you get a syntax error rather than always succeeding by wiping out $foo. (Warnings would catch that typo as well.) > Right now, it's run from cron, and works. :) The log page is generated, > and you can use the older URL to view an example of what I'm scraping. > The one in the example should work fine. None of the things that I cited change whether it runs. They do change how confident you are that it runs _correctly_. Cheers, Ben > -nick > > > ###------------------------ start script > > #!/usr/bin/perl -w > use warnings; > #use Mail::Sendmail; > #use diagnostics; > > $^W=0; > $debug = 0; > > =pod > > This script scrapes the boston.com website for the scores to > Boston redsox games. It's not very dynamic, You'll need to change the opponenent > > Page can be found @: > http://boston.com > -> sports > -> redsox > -> log > eg usage: > ./scores.pl 'http://146.145.120.3/merge/tsnform.aspx?c=globe&page=mlb/scores/live/log.aspx?GameID=11880' > > > Mail:;Sendmail: > perl -MCPAN -e "install Mail::Sendmail" > > =cut > > $url = "\'" . $ARGV[0] . "\'" ; > $mail_app = '/usr/bin/mail' ; > $have_score = 0 ; > @page = `lynx -dump $url`; > $email = '8675309@vtext.com, me@nicholasbernstein.com'; > $regex = '(NY Yankees \d+, [Bb]oston \d+)'; > > > if ( defined($ARGV[2]) ) { > $log = $ARGV[2]; > } else { > $log = "/tmp/scores.pl.log"; > } > > print "$log\n" if ( $debug == 1 ) ; > > foreach ( @page ) { > if ( ( $_ =~ m/$regex/) > and ( $have_score == 0 )) { > $score = $1; > chomp($score); > if ( -f $log ) { > print "In log exists\n" if ($debug==1); > open("LOG", "<$log") or die("problem opening file\n"); > @old_score = or die("could not read log\n"); > close("LOG"); > print "\nLog: $old_score[0]\n" if ( $debug == 1 ); > $old_score=$old_score[0]; > } else { > print "In log does not exist\n" if ($debug==1); > open("LOG", ">", $log); > print LOG "none"; > close(LOG); > $old_score = "none"; > } > > chomp($old_score); > > if ( $score ne $old_score ) { > open(MAILAPP, "|$mail_app -s \"RedSox Score\" -r \"scores\@nicholasbernstein.com\" $email"); > print MAILAPP "$score" ; > close("MAILAPP"); > print "$score\n"; > open ("LOG", ">", $log); > print LOG "$score\n"; > close("LOG"); > print "Scores are different" if ( $debug == 1 ); > } > $have_score = 1 ; > } > } > > ###------------------------ end script > -- > Nicholas Bernstein, Unix Systems Administrator > Document Systems Inc. > http://docmagic.com > nick@docmagic.com > > > CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. > > > _______________________________________________ > Losangeles-pm mailing list > Losangeles-pm@mail.pm.org > http://mail.pm.org/mailman/listinfo/losangeles-pm > From kevin at scaldeferri.com Tue Oct 19 12:52:25 2004 From: kevin at scaldeferri.com (Kevin Scaldeferri) Date: Tue Oct 19 12:51:28 2004 Subject: [LA.pm] See if this sparks some perl talk. In-Reply-To: <1098123740.20049.26.camel@nick.docmagic.com> References: <1098123740.20049.26.camel@nick.docmagic.com> Message-ID: On Oct 18, 2004, at 11:22 AM, Nicholas Bernstein wrote: > > Anyway, since I threw this together rather quickly, didn't put enough > effort in to be embarrassed by it, I figured maybe it might be a good > way to spark up the list a bit. Critique, improve, extend, replace, > turn > into something else, etc. Okay, I'll add a couple comments. Some are things I think are pretty universal best practices, while some are more my personal preference. > > > ###------------------------ start script > > #!/usr/bin/perl -w > use warnings; > #use Mail::Sendmail; > #use diagnostics; > > $^W=0; -w, warnings, and $^W all do nearly the same thing. You seem to be undecided about what you actually want here. > $debug = 0; > I'd make this modifiable at the command line. > > $url = "\'" . $ARGV[0] . "\'" ; This is overly verbose. You could just say $url = "'$ARGV[0]'"; however... > $mail_app = '/usr/bin/mail' ; > $have_score = 0 ; > @page = `lynx -dump $url`; The single quotes added above are presumably to protect this command, but it isn't really sufficient. (What if $url contains a single quote?) It's better to do @page = `lynx -dump \Q$url\E` to escape all non-alphanumerics > $email = '8675309@vtext.com, me@nicholasbernstein.com'; > $regex = '(NY Yankees \d+, [Bb]oston \d+)'; use qr// here > > > if ( defined($ARGV[2]) ) { > $log = $ARGV[2]; > } else { > $log = "/tmp/scores.pl.log"; > } $log = $ARGV[2] || "/tmp/scores.pl.log"; > > print "$log\n" if ( $debug == 1 ) ; > > foreach ( @page ) { > if ( ( $_ =~ m/$regex/) > and ( $have_score == 0 )) { Never write something like "$_ =~ m/.../". Either name the variable or use $_ implicitly. Using $_ explicitly is just ugly. You don't need the parens if you use 'and'. I would get rid of the $have_score flag and just call 'last' down where you set it to 1. > $score = $1; > chomp($score); Pointless, your regex don't match a trailing newline. > if ( -f $log ) { > print "In log exists\n" if ($debug==1); > open("LOG", "<$log") or die("problem opening file\n"); Don't use the 2 argument open. > @old_score = or die("could not read log\n"); If your log file gets big, this could use a bunch of memory. Pointless, especially if you're only going to use the first line. > close("LOG"); > print "\nLog: $old_score[0]\n" if ( $debug == 1 ); > $old_score=$old_score[0]; > } else { > print "In log does not > exist\n" if ($debug==1); > open("LOG", ">", $log); > print LOG "none"; > close(LOG); > $old_score = "none"; > } I'm a big fan of lexical filehandles. For little scripts, maybe it doesn't matter much, but as things get bigger, global filehandles are bad news, particuarly if you give them names like LOG or IN or OUT. > > chomp($old_score); > > if ( $score ne $old_score ) { > open(MAILAPP, "|$mail_app -s \"RedSox Score\" -r > \"scores\@nicholasbernstein.com\" $email"); How come the recipients are defined in a variable, buy not the return address? > print MAILAPP "$score" ; > close("MAILAPP"); > print "$score\n"; > open ("LOG", ">", $log); > print LOG "$score\n"; > close("LOG"); Ahh... I see here that you overwrite the log, so it's only ever 1 line. So, I guess maybe my comment above is moot. You print the same thing to three different filehandles. Seems like a good place for a loop. > print "Scores are different" if ( $debug == 1 ); You use this construct a lot. Seems like you need a "debug" subroutine. > } > $have_score = 1 ; See above, replace with 'last' > } > } > > ###------------------------ end script > -kevin From RNathan at baxglobal.com Tue Oct 19 13:23:46 2004 From: RNathan at baxglobal.com (Ranga Nathan) Date: Tue Oct 19 13:23:52 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th In-Reply-To: Message-ID: Anyone traveling from Irvine OC or nearby? I would like to car-pool. I work close to Tustin Market Place. Thanks. __________________________________________ Ranga Nathan / CSG Systems Programmer - Specialist; Technical Services; BAX Global Inc. Irvine-California Tel: 714-442-7591 Fax: 714-442-2840 Ask Bj?rn Hansen Sent by: losangeles-pm-bounces@mail.pm.org 10/18/2004 04:02 PM To: Los Angeles Perl Mongers cc: Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th Here's finally the address for the meeting tomorrow! It's Tuesday October 19th, 7pm at: Ticketmaster 8800 W Sunset Blvd West Hollywood, CA 90069 http://xrl.us/djhk (Link to www.mapquest.com) http://xrl.us/djhn (Link to maps.yahoo.com) You can only get on Palm from Santa Monica or Holloway Dr. Holloway is only accessible from Santa Monica or La Cienega. SO: It's easiest just to take Santa Monica to Palm. Go North on Palm until just before Holloway/Sunset Blvd., the parking garage is on the West side of the street. When you have parked, go up to the security desk at 1st floor and someone will be there to help you upstairs. There's also group of people watching a movie in the Ticketmaster movie theater -- that's not us, so be sure not to confuse the two. =) - ask ps. let me know if you are going from around Pasadena before the meeting or to Pasadena after the meeting and can help us get Damian back and forth. -- http://www.askbjoernhansen.com/ _______________________________________________ Losangeles-pm mailing list Losangeles-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/losangeles-pm From ben_tilly at operamail.com Wed Oct 20 14:01:36 2004 From: ben_tilly at operamail.com (Benjamin J. Tilly ) Date: Wed Oct 20 14:50:01 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th Message-ID: <20041020190136.36BBB3AA515@ws5-8.us4.outblaze.com> Ask Bjørn Hansen wrote: Now that the talk has come and been enjoyed, did *anyone* get down the URL which Nat Torkington had sent Damian causing all of those words? Thanks, Ben From onave at bizrate.com Wed Oct 20 15:32:17 2004 From: onave at bizrate.com (Ofer Nave) Date: Wed Oct 20 15:32:35 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th In-Reply-To: <20041020190136.36BBB3AA515@ws5-8.us4.outblaze.com> References: <20041020190136.36BBB3AA515@ws5-8.us4.outblaze.com> Message-ID: <4176CB51.2080704@bizrate.com> Couldn't make it, had to work late. Can anyone summarize what was discussed, out of curiosity? -ofer Benjamin J. Tilly wrote: >Ask Bjørn Hansen wrote: > >Now that the talk has come and been enjoyed, did *anyone* >get down the URL which Nat Torkington had sent Damian >causing all of those words? > >Thanks, >Ben > >_______________________________________________ >Losangeles-pm mailing list >Losangeles-pm@mail.pm.org >http://mail.pm.org/mailman/listinfo/losangeles-pm > > From ask at develooper.com Wed Oct 20 15:40:41 2004 From: ask at develooper.com (=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?=) Date: Wed Oct 20 15:40:45 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th In-Reply-To: <20041020190136.36BBB3AA515@ws5-8.us4.outblaze.com> References: <20041020190136.36BBB3AA515@ws5-8.us4.outblaze.com> Message-ID: <4EC88A96-22D8-11D9-A4AC-000A957168EC@develooper.com> On Oct 20, 2004, at 12:01, Benjamin J. Tilly wrote: > Ask Bj?rn Hansen wrote: > > Now that the talk has come and been enjoyed, did *anyone* > get down the URL which Nat Torkington had sent Damian > causing all of those words? http://users.tinyonline.co.uk/gswithenbank/unuwords.htm it's not working right now. (It did work last night though). Here's a link to the Google cache page: http://xrl.us/dkm2 - ask -- http://www.askbjoernhansen.com/ From geeksatlarge at yahoo.com Wed Oct 20 18:39:28 2004 From: geeksatlarge at yahoo.com (Ron Smith) Date: Wed Oct 20 18:39:34 2004 Subject: [LA.pm] New Message-ID: <20041020233928.18479.qmail@web42008.mail.yahoo.com> Hi everyone, I'm new to Perl, and programming in general. However, I was at the 'ticketmaster' meeting last night and thoroughly enjoyed the whole thing. Since I'm a beginner, most everything was out of reach for me so far. I was wondering if the meetings occur on a regular basis, and if you all accept Perl questions on this list? I'm thinking that you all are certainly more advanced than I am at this point. I'm working my way through the "Llama book" with a lot of enthusiasm, but what I'd like now is a little guidance from the crew. ...Just trying to get up to speed. TIA Ron __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail From ben_tilly at operamail.com Wed Oct 20 20:22:31 2004 From: ben_tilly at operamail.com (Benjamin J. Tilly ) Date: Wed Oct 20 20:22:33 2004 Subject: [LA.pm] Damian Conway / Perl 6 meeting the 19th Message-ID: <20041021012231.D411B3AA515@ws5-8.us4.outblaze.com> Ofer Nave wrote: > > Couldn't make it, had to work late. > > Can anyone summarize what was discussed, out of curiosity? No one has enough rakudo to summarize The Damian. Except by not doing so. A partial outline of his talk is at: http://rjbs.manxome.org/yapc/2004/advtech.txt This does not include the end of the talk. Nor does it include his presentation at the break encouraging people to come to YAPC::Australia. It sounds like a trip to die for. Literally. However attempting to understand the experience of The Damian from an outline is like attempting to fill yourself by reading recipies out of a cookbook. Cheers, Ben From clive at vdeck.com Thu Oct 21 16:38:25 2004 From: clive at vdeck.com (Clive Holloway) Date: Thu Oct 21 16:40:42 2004 Subject: [LA.pm] Re: Losangeles-pm Digest, Vol 16, Issue 11 In-Reply-To: <200410211700.i9LH0igw027638@www.pm.org> References: <200410211700.i9LH0igw027638@www.pm.org> Message-ID: <200410211438.25663.clive@vdeck.com> Ron, For Perl questions, I recommend you join Perlmonks: http://perlmonks.org You'll find most of the list members there. As to meetings - they seem to be really irregular. I've been on the list a year and have missed all 3 meetings in that time. LA Perlmongers on Perlmonks include: name / pm handle me - cLive ;-) Ben Tilly - tilly Ask Bjorn Hansen - ask Gary Schlosberg - bassplayer Those are just the ones I know of - I'm sure there are many more. Have fun, and see you at the monastery :) cLive ;-) On Thursday 21 October 2004 10:00 am, losangeles-pm-request@mail.pm.org wrote: > Message: 4 > Date: Wed, 20 Oct 2004 16:39:28 -0700 (PDT) > From: Ron Smith > Subject: [LA.pm] New > To: LA_Perl_Mongers > Message-ID: <20041020233928.18479.qmail@web42008.mail.yahoo.com> > Content-Type: text/plain; charset=us-ascii > > Hi everyone, > > I'm new to Perl, and programming in general. However, > I was at the 'ticketmaster' meeting last night and > thoroughly enjoyed the whole thing. Since I'm a > beginner, most everything was out of reach for me so > far. > > I was wondering if the meetings occur on a regular > basis, and if you all accept Perl questions on this > list? I'm thinking that you all are certainly more > advanced than I am at this point. I'm working my way > through the "Llama book" with a lot of enthusiasm, but > what I'd like now is a little guidance from the crew. > > ...Just trying to get up to speed. > > TIA > Ron -- Clive Holloway vDeck Project Manager http://vdeck.com From nick at docmagic.com Tue Oct 26 17:16:18 2004 From: nick at docmagic.com (Nicholas Bernstein) Date: Tue Oct 26 17:16:21 2004 Subject: [LA.pm] GetOpts::Long weirdness Message-ID: <1098828978.30929.146.camel@nick.docmagic.com> I was wondering if someone could take a look at this and tell me why $help is not being defined when the program is run with --help as a command line option. The rest of it is working fine, just for some reason GetOptions doesn't want to define it (why do the easy parts always break?) anyway, since I've been looking at this for too long, and I'm sure that all of you know a bunch more than I do, please help enlighten me. Thanks in advance, Nick #--------------------- start -------------------# #!/usr/bin/perl use warnings; use diagnostics; # CPAN Modules # ----------------- use Getopt::Long; use Digest::MD5; # Definitions # ----------------- $XML_DIR = "/u/dsi/xml/"; $host1 = "localhost"; $host2 = "localhost"; $FM = "/u/fillmagic/production/bin/fillmagic.sh"; $wait = "1"; GetOptions( "help" => \$help, "host1|h1=s" => \$host1, "host2|h2=s" => \$host2, "xml|x=s" => \$XML_DIR, "wait|w=i" => \$wait ) or die "GetOptions can't get variable"; sub print_help_msg { print " This program is used to test a new fillmagic server against a known good fillmagic server. It runs a fill against each server, computes a md5 checksum of the response, and compares the two. The minimum options to give this program are host1 and host2. The order does not matter. This is an example of the using filltester.pl with the minimum number of arguments: filltester.pl -h1 foo.foo.com -h2 bar.foo.com In this case the time waited in between responses will be 1, and the xml directory will be '/u/dsi/xml/' here is the same example with a three second wait, and a different xml directory: filltester.pl -h1 foo.foo.com -h2 bar.foo.com -w 3 -x /usr/local/fillmagicstuff/xml/ Here is a fill list of the options for this command: --host1, -h1) define host1 --host2, -h2) define host2 --xml, -x) define the xml directory --wait, -w) define the time to wait in between processing. --help, -h) prints this screen "; exit() } sub getfiles { opendir( "XMLDIR", "$_[0]"); my @files = readdir("XMLDIR"); closedir("XMLDIR"); return @files; } sub do_fillmagic { # $sum = do_fillmagic("da.docmagic.com", "some_xml_file.xml"); # do fillmagic takes a hostname, and an xml file to post # and returns an md5 digest of the output. You can # then compare this output vs another known good server # and verify that the results are the same. my $host = $_[0]; my $file = $_[1]; my $url = "http://" . $host . "/fillmagic/servlet/fillservlet"; my $pwd = $ENV{'PWD'}; my $outfile = "$pwd/out." . $host; my $reqfile = "$pwd/cachetestrequest.xml "; # run the fillmagic request # -------------------------- my $cmd = $FM . " -r " . $reqfile . $file . " -w " . $url . " -o " . $outfile ; $ENV{'DSI_HOME'} = "/u/fillmagic/production/"; $toss=" "; # just gets rid of variable was only used once warning $toss=`$cmd || echo "failed"` or die("Could not run System Command:\n$cmd"); # read the output # -------------------------- open(MYFILE, "<$outfile") or die("could not open file: $outfile \n It was probably not created by:\n\"$cmd\"\n"); @lines = ; # create md5sum # -------------------------- $ctx = Digest::MD5->new; foreach $line (@lines) { $ctx->add($line); } my $digest = $ctx->hexdigest; # Remove the output and return the results # -------------------------- close("MYFILE"); unlink($outfile); return($digest) ; } sub run_and_compare { my $hostA = $_[0]; my $hostB = $_[1]; my $file = $_[2]; my $md51 = do_fillmagic("$hostA", $file) unless ( ! -f $file) ; my $md52 = do_fillmagic("$hostB", $file) unless ( ! -f $file); if ( $md51 ne $md52 ) { #print "$file: ... FAILED\n"; format STDOUT = @<<<<<<<<<<<<<< @<<<<<<<<<<<< $file, FAILED . write ; } else { format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<< $file, OK . write; } } # main # --------------------------------------------------------------- if ( defined($help) ) { print_help_msg(); } @files = getfiles($XML_DIR); foreach $file ( @files ) { if ( ( $file =~ m/^\./ ) or ( $file =~ m/^\.\./ ) ) { #Skipping dotfile } else { qr/$file/ ; $file= $XML_DIR . $file; if ( -f $file ) { run_and_compare($host1, $host2, "$file"); sleep($wait); } elsif ( -d $file ){ # Skipping Directory $file } } } # -------------------- end ---------------------# CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. From onave at bizrate.com Tue Oct 26 17:30:58 2004 From: onave at bizrate.com (Ofer Nave) Date: Tue Oct 26 17:31:01 2004 Subject: [LA.pm] GetOpts::Long weirdness In-Reply-To: <1098828978.30929.146.camel@nick.docmagic.com> References: <1098828978.30929.146.camel@nick.docmagic.com> Message-ID: <417ED022.10205@bizrate.com> Oh boy... Well, I'll answer your question first. Kind of. I copied your code verbatim, and it works fine for me. Add this after the call to GetOptions(): print "help=$help\n"; exit; Now, if I run the script with no params, help is undefined. If I run it with --help, help=1. So it looks fine. However... you really need to use strict. There's pretty much no rational reason not to, and every reason to do so. I also think diagnostics is generally overkill, but if its only for development and you like it, that's cool. BTW-You're getting some format redifined warnings. -ofer Nicholas Bernstein wrote: >I was wondering if someone could take a look at this and tell me why >$help is not being defined when the program is run with --help as a >command line option. The rest of it is working fine, just for some >reason GetOptions doesn't want to define it (why do the easy parts >always break?) anyway, since I've been looking at this for too long, and >I'm sure that all of you know a bunch more than I do, please help >enlighten me. > >Thanks in advance, >Nick > >#--------------------- start -------------------# > >#!/usr/bin/perl > >use warnings; >use diagnostics; > ># CPAN Modules ># ----------------- > >use Getopt::Long; >use Digest::MD5; > ># Definitions ># ----------------- > >$XML_DIR = "/u/dsi/xml/"; >$host1 = "localhost"; >$host2 = "localhost"; >$FM = "/u/fillmagic/production/bin/fillmagic.sh"; >$wait = "1"; > > >GetOptions( > "help" => \$help, > "host1|h1=s" => \$host1, > "host2|h2=s" => \$host2, > "xml|x=s" => \$XML_DIR, > "wait|w=i" => \$wait > >) or die "GetOptions can't get variable"; > >sub print_help_msg { > print " > This program is used to test a new fillmagic server against a known good fillmagic server. > It runs a fill against each server, computes a md5 checksum of the response, and compares the > two. > > The minimum options to give this program are host1 and host2. The order does not matter. > This is an example of the using filltester.pl with the minimum number of arguments: > > filltester.pl -h1 foo.foo.com -h2 bar.foo.com > > In this case the time waited in between responses will be 1, and the xml directory will be > '/u/dsi/xml/' > > here is the same example with a three second wait, and a different xml directory: > > filltester.pl -h1 foo.foo.com -h2 bar.foo.com -w 3 -x /usr/local/fillmagicstuff/xml/ > > Here is a fill list of the options for this command: > > --host1, -h1) > define host1 > > --host2, -h2) > define host2 > > --xml, -x) > define the xml directory > > --wait, -w) > define the time to wait in between processing. > > --help, -h) > prints this screen >"; >exit() >} > > >sub getfiles { > opendir( "XMLDIR", "$_[0]"); > my @files = readdir("XMLDIR"); > closedir("XMLDIR"); > return @files; >} > >sub do_fillmagic { > > # $sum = do_fillmagic("da.docmagic.com", "some_xml_file.xml"); > # do fillmagic takes a hostname, and an xml file to post > # and returns an md5 digest of the output. You can > # then compare this output vs another known good server > # and verify that the results are the same. > > my $host = $_[0]; > my $file = $_[1]; > my $url = "http://" . $host . "/fillmagic/servlet/fillservlet"; > my $pwd = $ENV{'PWD'}; > my $outfile = "$pwd/out." . $host; > my $reqfile = "$pwd/cachetestrequest.xml "; > > # run the fillmagic request > # -------------------------- > > my $cmd = $FM . " -r " . $reqfile . $file . " -w " . $url . " -o " . $outfile ; > > $ENV{'DSI_HOME'} = "/u/fillmagic/production/"; > > $toss=" "; # just gets rid of variable was only used once warning > $toss=`$cmd || echo "failed"` or die("Could not run System Command:\n$cmd"); > > # read the output > # -------------------------- > open(MYFILE, "<$outfile") or die("could not open file: $outfile \n It was probably not created by:\n\"$cmd\"\n"); > @lines = ; > > # create md5sum > # -------------------------- > $ctx = Digest::MD5->new; > foreach $line (@lines) { > $ctx->add($line); > } > my $digest = $ctx->hexdigest; > > # Remove the output and return the results > # -------------------------- > close("MYFILE"); > unlink($outfile); > return($digest) ; >} > >sub run_and_compare { > my $hostA = $_[0]; > my $hostB = $_[1]; > my $file = $_[2]; > my $md51 = do_fillmagic("$hostA", $file) unless ( ! -f $file) ; > my $md52 = do_fillmagic("$hostB", $file) unless ( ! -f $file); > > if ( $md51 ne $md52 ) { > #print "$file: ... FAILED\n"; >format STDOUT = >@<<<<<<<<<<<<<< @<<<<<<<<<<<< >$file, FAILED >. > write ; > } else { >format STDOUT = >@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<< >$file, OK >. > write; > } >} > ># main ># --------------------------------------------------------------- > >if ( defined($help) ) { > print_help_msg(); >} > >@files = getfiles($XML_DIR); > >foreach $file ( @files ) { > if ( > ( $file =~ m/^\./ ) or > ( $file =~ m/^\.\./ ) > ) { > > #Skipping dotfile > > } else { > > qr/$file/ ; > $file= $XML_DIR . $file; > > if ( -f $file ) { > > run_and_compare($host1, $host2, "$file"); > sleep($wait); > > } elsif ( -d $file ){ > > # Skipping Directory $file > > } > } > } > > ># -------------------- end ---------------------# > > >CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. > > >_______________________________________________ >Losangeles-pm mailing list >Losangeles-pm@mail.pm.org >http://mail.pm.org/mailman/listinfo/losangeles-pm > > From nick at docmagic.com Tue Oct 26 18:32:26 2004 From: nick at docmagic.com (Nicholas Bernstein) Date: Tue Oct 26 18:32:30 2004 Subject: [LA.pm] GetOpts::Long weirdness In-Reply-To: <1098828978.30929.146.camel@nick.docmagic.com> References: <1098828978.30929.146.camel@nick.docmagic.com> Message-ID: <1098833545.29481.228.camel@nick.docmagic.com> Thanks to everyone who replied. Seemed like the common thread was "use strict" dammit, which made me clean things up. In the process, that fixed it. I also put the formats in a separate sub since people commented on how bad they looked, but I still really like the way format works. Anyway, Thanks again. On Tue, 2004-10-26 at 15:16, Nicholas Bernstein wrote: > I was wondering if someone could take a look at this and tell me why > $help is not being defined when the program is run with --help as a > command line option. The rest of it is working fine, just for some > reason GetOptions doesn't want to define it (why do the easy parts > always break?) anyway, since I've been looking at this for too long, and > I'm sure that all of you know a bunch more than I do, please help > enlighten me. > > Thanks in advance, > Nick > > #--------------------- start -------------------# > > #!/usr/bin/perl > > use warnings; > use diagnostics; > > # CPAN Modules > # ----------------- > > use Getopt::Long; > use Digest::MD5; > > # Definitions > # ----------------- > > $XML_DIR = "/u/dsi/xml/"; > $host1 = "localhost"; > $host2 = "localhost"; > $FM = "/u/fillmagic/production/bin/fillmagic.sh"; > $wait = "1"; > > > GetOptions( > "help" => \$help, > "host1|h1=s" => \$host1, > "host2|h2=s" => \$host2, > "xml|x=s" => \$XML_DIR, > "wait|w=i" => \$wait > > ) or die "GetOptions can't get variable"; > > sub print_help_msg { > print " > This program is used to test a new fillmagic server against a known good fillmagic server. > It runs a fill against each server, computes a md5 checksum of the response, and compares the > two. > > The minimum options to give this program are host1 and host2. The order does not matter. > This is an example of the using filltester.pl with the minimum number of arguments: > > filltester.pl -h1 foo.foo.com -h2 bar.foo.com > > In this case the time waited in between responses will be 1, and the xml directory will be > '/u/dsi/xml/' > > here is the same example with a three second wait, and a different xml directory: > > filltester.pl -h1 foo.foo.com -h2 bar.foo.com -w 3 -x /usr/local/fillmagicstuff/xml/ > > Here is a fill list of the options for this command: > > --host1, -h1) > define host1 > > --host2, -h2) > define host2 > > --xml, -x) > define the xml directory > > --wait, -w) > define the time to wait in between processing. > > --help, -h) > prints this screen > "; > exit() > } > > > sub getfiles { > opendir( "XMLDIR", "$_[0]"); > my @files = readdir("XMLDIR"); > closedir("XMLDIR"); > return @files; > } > > sub do_fillmagic { > > # $sum = do_fillmagic("da.docmagic.com", "some_xml_file.xml"); > # do fillmagic takes a hostname, and an xml file to post > # and returns an md5 digest of the output. You can > # then compare this output vs another known good server > # and verify that the results are the same. > > my $host = $_[0]; > my $file = $_[1]; > my $url = "http://" . $host . "/fillmagic/servlet/fillservlet"; > my $pwd = $ENV{'PWD'}; > my $outfile = "$pwd/out." . $host; > my $reqfile = "$pwd/cachetestrequest.xml "; > > # run the fillmagic request > # -------------------------- > > my $cmd = $FM . " -r " . $reqfile . $file . " -w " . $url . " -o " . $outfile ; > > $ENV{'DSI_HOME'} = "/u/fillmagic/production/"; > > $toss=" "; # just gets rid of variable was only used once warning > $toss=`$cmd || echo "failed"` or die("Could not run System Command:\n$cmd"); > > # read the output > # -------------------------- > open(MYFILE, "<$outfile") or die("could not open file: $outfile \n It was probably not created by:\n\"$cmd\"\n"); > @lines = ; > > # create md5sum > # -------------------------- > $ctx = Digest::MD5->new; > foreach $line (@lines) { > $ctx->add($line); > } > my $digest = $ctx->hexdigest; > > # Remove the output and return the results > # -------------------------- > close("MYFILE"); > unlink($outfile); > return($digest) ; > } > > sub run_and_compare { > my $hostA = $_[0]; > my $hostB = $_[1]; > my $file = $_[2]; > my $md51 = do_fillmagic("$hostA", $file) unless ( ! -f $file) ; > my $md52 = do_fillmagic("$hostB", $file) unless ( ! -f $file); > > if ( $md51 ne $md52 ) { > #print "$file: ... FAILED\n"; > format STDOUT = > @<<<<<<<<<<<<<< @<<<<<<<<<<<< > $file, FAILED > . > write ; > } else { > format STDOUT = > @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<< > $file, OK > . > write; > } > } > > # main > # --------------------------------------------------------------- > > if ( defined($help) ) { > print_help_msg(); > } > > @files = getfiles($XML_DIR); > > foreach $file ( @files ) { > if ( > ( $file =~ m/^\./ ) or > ( $file =~ m/^\.\./ ) > ) { > > #Skipping dotfile > > } else { > > qr/$file/ ; > $file= $XML_DIR . $file; > > if ( -f $file ) { > > run_and_compare($host1, $host2, "$file"); > sleep($wait); > > } elsif ( -d $file ){ > > # Skipping Directory $file > > } > } > } > > > # -------------------- end ---------------------# > > > CONFIDENTIALITY NOTICE: This email and any attachments thereto may contain information which is privileged and confidential, and is intended for the sole use of the recipient(s) named above. Any use whatsoever of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is strictly prohibited. If you have received this email in error, please notify the sender either by telephone, by email, or by any other written or telephonic means, and delete the material from any computer. Thank you for your cooperation. > > > _______________________________________________ > Losangeles-pm mailing list > Losangeles-pm@mail.pm.org > http://mail.pm.org/mailman/listinfo/losangeles-pm -- Nicholas Bernstein, Unix Systems Administrator Document Systems Inc. http://docmagic.com nick@docmagic.com