From shawn.c.carroll at gmail.com Wed Mar 2 14:38:58 2005 From: shawn.c.carroll at gmail.com (Shawn Carroll) Date: Wed Mar 2 14:39:11 2005 Subject: [Chicago-talk] Phalanx, HTML-Tree, and moving on Message-ID: Well, no work has been done on our project in two months since I taged a release and sent it off to Sean. I think we should close this project and move onto a new module. Any suggestions? Scalar::List::Util isn't on the top 100 list anymore... Maybe PathTools? Any suggestions? I plan on enlisting a few people on the volunteers page to help once we decidee ona module and get approval from the owner. --Shawn -- AIM: SaprkeyG123 shawn.c.carroll@gmail.com Perl Programmer Soccer Referee From andy at petdance.com Wed Mar 2 15:10:32 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 2 15:10:42 2005 Subject: [Chicago-talk] Phalanx, HTML-Tree, and moving on In-Reply-To: References: Message-ID: <20050302231031.GA19762@petdance.com> On Wed, Mar 02, 2005 at 04:38:58PM -0600, Shawn Carroll (shawn.c.carroll@gmail.com) wrote: > Scalar::List::Util isn't on the top 100 list anymore... Maybe > PathTools? Any suggestions? There's no reason you can't do Scalar::List::Util. The p100 is just a starting point. PathTools would be painful, since so much is platform-dependent. You'd have entire files uncovered. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Wed Mar 2 15:10:32 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 2 15:10:45 2005 Subject: [Chicago-talk] Phalanx, HTML-Tree, and moving on In-Reply-To: References: Message-ID: <20050302231031.GA19762@petdance.com> On Wed, Mar 02, 2005 at 04:38:58PM -0600, Shawn Carroll (shawn.c.carroll@gmail.com) wrote: > Scalar::List::Util isn't on the top 100 list anymore... Maybe > PathTools? Any suggestions? There's no reason you can't do Scalar::List::Util. The p100 is just a starting point. PathTools would be painful, since so much is platform-dependent. You'd have entire files uncovered. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From Andy_Bach at wiwb.uscourts.gov Fri Mar 4 11:15:45 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Fri Mar 4 11:16:18 2005 Subject: [Chicago-talk] [OT]: Mac script/OOP language Message-ID: Not strictly perl but I know there are a couple Mac folks here and this, it seems, is something worth looking at - at least the manual is quite impressive (132 pages!). >> TRACKING << sufficiently advanced technology : the gathering It's not the Smalltalkiness of it; it's not the Cocoaliciousness of it; it's the funky APL sideburns that's made F-SCRIPT so tempting. F-Script is a scripting language for MacOS X that takes that OS's object frameworks and slips them into a Smalltalk syntax, then left-hooks it all with an inexplicably neat multiple receiver syntax called OOPAL which lets you use things called "message templates" to fire off the same message to an array of objects, and ponce around like you just don't need loops or iterators any more. Soon you'll realise that this is brilliant, yet there's almost nothing you can do with F-Script. But wait! Along comes F-Script Everywhere that - in theory - allows you to browse and probe ObjC objects in any running application. And, finally, when you tire of that, the author hints that the next version will give F-Script the ability to create new classes of its own, which is what it desperately needs to become a first-class scripting citizen. In the meantime, come for the OOPAL, stay for the OOPAL, leave taking the OOPAL with you to your own weirdo language. http://www.fscript.org/ - the manual is pretty readable http://www.fscript.org/download/FScriptGuide.pdf - and page 25 is where it starts getting funky Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 First Law of Bicycling: No matter which way you ride, it's uphill and against the wind. ----- Forwarded by Andy Bach/WIWB/07/USCOURTS on 03/04/2005 01:14 PM ----- Dave Green Sent by: ntknow-admin@ntk.net 03/04/2005 11:54 AM To NTK now cc Subject NTK now, 2005-03-05 _ _ _____ _ __ <*the* week^H^H^H^Hfortnightly tech update for the uk> | \ | |_ _| |/ / _ __ __2005-03-05_ o join! sign up at | \| | | | | ' / | '_ \ / _ \ \ /\ / / o http://lists.ntk.net/ | |\ | | | | . \ | | | | (_) \ v v / o website (+ archive) lives at: |_| \_| |_| |_|\_\|_| |_|\___/ \_/\_/ o http://www.ntk.net/ Tips, news & gossip to tips@spesh.com - with NTK in subject line, cheers. "Michael Hulme says part of the reason why the mobile is so successful is that it takes us away from where we are..." - Mobiles 'part of social fabric' shocker, muses Click Online http://news.bbc.co.uk/1/4297993.stm ...as ingeniously symbolised by those giveaway "mobile" and "telephone" parts of its name >> HARD NEWS << largesse accrues Don't do popular things! Stop it! The government's Green Paper on the BBC caught the corporation in the "manic" stage of its traditional bi-polar swing. As the BBC continues to frenzedly chase ratings, the BBC was warned that it was getting too commercial, and should return to producing high-quality output untouched by popularist taint. Next charter, in 2016, of course, the BBC will be warned that it is too elitist, and should start trying to pander to popular tastes. But in the mean time, what of THE CREATIVE ARCHIVE, the BBC's plan to free at least some of its content for remixing under a more liberal license? "Likely to be popular with the public", warns the government, and rumbles that the it should be the very first experimental subject of the new BBC Trust's "public value and market impact tests". With commercial radio already leering hopefully at the Beeb's radio back catalogue, will the Archive be the first piece of meat thrown to the "stop being so popular so we don't have to compete" crowd? Or will those keen commercial types realise that, when it comes to "opening up new markets", everyone getting it for free always beats one company paying for access? http://www.bbccharterreview.org.uk/pdf_documents/bbc_cr_greenpaper.pdf - search for "archive", just like we did http://www.bbc.co.uk/pressoffice/pressreleases/stories/2004/05_may/26/ - "Doctor What, Everything?" is our current snappy name for it http://news.bbc.co.uk/1/4309325.stm - who else gives you PDF file sizes to three decimal places? Of course, for those who might consider the BBC license to be "dirty money", there *are* other ways of subsidising the release of freely licensed works. Jason Clifford's UK FREE SOFTWARE NETWORK, for example - the ISP that spends all its profits in donations to free software. The blood and sweat and toil of Clifford's obsessive altruism has now borne fruit, and the Association for Free Software is handing out the first round of money. Just write your grant proposal and send it off to them. There's UKP1500 to give away, with hopefully more to come. Yay! Free as in money! http://www.affs.org.uk/grants/ - "we *strongly* prefer formats usable with free software" http://www.ntk.net/index.cgi?b=02002-11-22&l=54#l - the story so far http://www.ukfsn.org/finance.html - and what he promised, open accounts >> EVENT QUEUE << GOTOs considered non-harmful The ravaged US economy creates favourable conditions for attempting the fabled "Grand Slam" of the GDC GAMES DEVELOPERS CONFERENCE (from Mon 2005-03-07, San Francisco, from $195), SXSW INTERACTIVE (from next Fri 2005-03-11, Austin, Texas, from $275), and the O'REILLY EMERGING TECHNOLOGY CONFERENCE (from next Mon 2005-03-14, San Diego, California, from $425). But for anyone sticking in the blizzard-swept UK, let's have our own crazy cutting-edge celebration right here, possibly under the aegis of NATIONAL SCIENCE WEEK (from next Fri 2005- 03-11, assorted times and venues), featuring yet another hee- hee-hilarious IG NOBEL TOUR (Oxford, Warrington, Nottingham plus an already-sold-out one in London), and unofficially culminating in our old techno-artist pals JON THOMSON and ALISON CRAIGHEAD returning - in triumph! - to DORKBOT LONDON (from 7pm, next Wed 2005-03-16, State51, Rhoda St, London E2 7EF, free), ably supported by a folksonomic black cab "derive" entitled "Taxi-onomy" (you see what they've done there?) and - of course - some RSS poetry. http://interactive.usc.edu/archives/003955.html - aren't all GDC delegates "wandering monsters", in a way? http://2005.sxsw.com/interactive/ - with blinking Malcolm Gladwell, Bruce Sterling, "Wonkette" http://conferences.oreillynet.com/etech/ - roll up for the Wired Editor and his amazing "Long Tail" http://www.dorkbot.org/dorkbotlondon/ - no, not the "John Thomson" off "The Fast Show" http://www.the-ba.net/the-ba/NationalScienceWeek/ - "compose a poem" not quite the "science" we had in mind >> ANTI-MEMES << there's smoke, flames, http://dohthehumanity.com/ reassuringly authentic-looking not-pasted-in-at-all screen: http://itsafe.gov.uk/about/picture_800.html - vs a scientist, thinking deeply: http://www.royalsoc.ac.uk/event.asp?id=2953 ... spot the test data: http://www.cs.ucla.edu/~kohler/pubs/ vs http://isotropic.org/uw/papers/chicken.pdf ... clearly one way of stopping phishers, anyone else from sending you mail: http://www.banksafeonline.org.uk/ ... which is a spoof portal which an amusingly-named Eastern European web design agency?: http://www.wankadoo.co.uk/ , http://hulan.cz/redakcni-system/ ... for one week only - "one of these not SFW like the others" http://images.google.com/images?q=%22Big+Cook%22, plus your regular http://www.google.com/search?q=pgp+%22key+singing%22 , "pedantric", "greasepoof", "freshmean", "enchanced" and http://www.google.com/search?q=%22duel+carriageway%22 ... reader Rod Begbie greases that slippery slope a little more: http://groovymother.com/archives/2005/02/28/dave_winers_wor.html >> TRACKING << sufficiently advanced technology : the gathering It's not the Smalltalkiness of it; it's not the Cocoaliciousness of it; it's the funky APL sideburns that's made F-SCRIPT so tempting. F-Script is a scripting language for MacOS X that takes that OS's object frameworks and slips them into a Smalltalk syntax, then left-hooks it all with an inexplicably neat multiple receiver syntax called OOPAL which lets you use things called "message templates" to fire off the same message to an array of objects, and ponce around like you just don't need loops or iterators any more. Soon you'll realise that this is brilliant, yet there's almost nothing you can do with F-Script. But wait! Along comes F-Script Everywhere that - in theory - allows you to browse and probe ObjC objects in any running application. And, finally, when you tire of that, the author hints that the next version will give F-Script the ability to create new classes of its own, which is what it desperately needs to become a first-class scripting citizen. In the meantime, come for the OOPAL, stay for the OOPAL, leave taking the OOPAL with you to your own weirdo language. http://www.fscript.org/ - the manual is pretty readable http://www.fscript.org/download/FScriptGuide.pdf - and page 25 is where it starts getting funky >> GEEK MEDIA << get out less TV>> the competition for "TV's Worst Tech Show" continues to hot up, with CLICK ONLINE (8.30pm, Sat; 4.30pm, Sun, BBC News 24) - which last week chose to pronounce "moblog" as "mob-log" - increasingly under threat from the sub-"Tomorrow's World" explanations of THE GADGET SHOW (7.30pm, Fri, C5), this week thrillingly comparing Linux to Microsoft Windows... Saturday is black helicopters night, in the company of not-bad Mel Gibson mind-controller CONSPIRACY THEORY (9.15pm, Sat, C4) plus Clipper-chip hacking romp SNEAKERS (11.20pm, Sat, ITV)... still, we all question the nature of reality - but do we *really* question the nature of reality? - ponders one of the best-ever episodes of THE MIGHTY BOOSH (11.40pm, Sun, BBC2)... it doesn't look like we'll be seeing Wendy Grossman appearing in HIGH SPIRITS WITH SHIRLEY GHOSTMAN (10.30pm, Sun, BBC3) any time soon: http://www.theinquirer.net/?article=20281 ... in case you were wondering, C4 *has* embarked on yet another back-slapping orgy of X-RATED: THE TV THEY TRIED TO BAN (10pm, Sun, C4), concluding with the implicit assumption that advertising per se is in some way defensible or worthwhile in X-RATED: THE ADS THEY COULDN'T SHOW (10pm, Thu, C4)... while Mode 7 "Gagfax" graphics were once considered primetime entertainment, reveals COMEDY CONNECTIONS' look back at "Three Of A Kind" (11pm, Mon, BBC1)... FILM>> the West may have largely failed to intervene in the country's horrific 1994 genocide but - to our eternal credit - we've made by far the best movie about it in HOTEL RWANDA ( http://www.bbfc.co.uk/ : Contains moderate war images and strong language)... the makers of "Dude, Where's My Car?" were at least cogent enough to rename their latest stoner odyssey from the US-burger-chain-centric "Harold & Kumar Go To White Castle" to the rib-tickling HAROLD & KUMAR GET THE MUNCHIES ( http://cndb.com/ : [Malin "Earth: Final Conflict" Akerman is] wearing shorts and a blouse with only three buttons)... and the filth continues in ideological sexologist biopic KINSEY ( http://www.cndb.com/movie.html?title=9+Songs+%282004%29 : Male nudity is not really my thing, so I can't give this a full four-star rating, but if you happen to be a Peter Sarsgaard fan, and were dissapointed with "The Center of the World", this is definitely the movie for you)... plus next Fri's widely-covered-elsewhere concert-movie-with-a-difference 9 SONGS ( http://www.bbfc.co.uk/ : Contains frequent strong real sex)... >> SMALL PRINT << Need to Know is a useful and interesting UK digest of things that happened last week or might happen next week. You can read it on Friday afternoon or print it out then take it home if you have nothing better to do. It is compiled by NTK from stuff they get sent. Registered at the Post Office as "comparatively homophone-free" http://www.qwghlm.co.uk/blog.php?article=610 NEED TO KNOW THEY STOLE OUR REVOLUTION. NOW WE'RE STEALING IT BACK. Archive - http://www.ntk.net/ Unsubscribe or subscribe at http://lists.ntk.net/ NTK now is supported by UNFORTU.NET, and by you: http://www.ntkmart.com/ (K) 2005 Special Projects. Copying is fine, but include URL: http://www.ntk.net/ Full license at: http://creativecommons.org/licenses/by/1.0 Tips, news and gossip to tips@spesh.com - with NTK in the subject, cheers. All communication is for publication, unless you beg. Remember: Your work email may be monitored if sending sensitive material. Sending >500KB attachments is forbidden by the Geneva Convention. Your country may be at risk if you fail to comply. From andy at petdance.com Fri Mar 4 12:19:58 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 4 12:20:15 2005 Subject: [Chicago-talk] Writing Perl Modules For CPAN Message-ID: <20050304201958.GA7736@petdance.com> Sam Tregar's excellent "Writing Perl Modules For CPAN" is now available as a free download. http://www.apress.com/free/ xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Wed Mar 9 07:22:01 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 9 07:22:12 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON Message-ID: <20050309152201.GA20566@petdance.com> I got two of my talks accepted at OSCON 2005. One is called "Introducting automated testing to existing projects", and the other is "Avoiding crisis: Transforming from scapegoat to hero." Now if only we had a room I could try 'em out on y'all! xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jt at plainblack.com Wed Mar 9 07:34:53 2005 From: jt at plainblack.com (JT Smith) Date: Wed Mar 9 07:35:20 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON In-Reply-To: <20050309152201.GA20566@petdance.com> References: <20050309152201.GA20566@petdance.com> Message-ID: I can always go get the grayslake library room again. On Wed, 9 Mar 2005 09:22:01 -0600 Andy Lester wrote: > I got two of my talks accepted at OSCON 2005. One is called > "Introducting automated testing to existing projects", and the other is > "Avoiding crisis: Transforming from scapegoat to hero." > > Now if only we had a room I could try 'em out on y'all! > > xoa > > -- > Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From richard at rushlogistics.com Wed Mar 9 07:35:10 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 9 07:35:23 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON In-Reply-To: <20050309152201.GA20566@petdance.com> Message-ID: <20050309153510.92711.qmail@web207.biz.mail.re2.yahoo.com> Way to go Andy! --- Andy Lester wrote: > I got two of my talks accepted at OSCON 2005. One > is called > "Introducting automated testing to existing > projects", and the other is > "Avoiding crisis: Transforming from scapegoat to > hero." > > Now if only we had a room I could try 'em out on > y'all! > > xoa > > -- > Andy Lester => andy@petdance.com => www.petdance.com > => AIM:petdance > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Wed Mar 9 11:10:33 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 9 11:10:41 2005 Subject: [Chicago-talk] removing line from file. Message-ID: <20050309191033.17917.qmail@web208.biz.mail.re2.yahoo.com> This may be annoyingly simple for most on this list, but does someone have time to take a minute to tell me what the easiest way in perl 5 to remove the first four lines from a text file? Thanks for any help. Richard From Andy_Bach at wiwb.uscourts.gov Wed Mar 9 11:17:28 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Wed Mar 9 11:14:14 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <20050309191033.17917.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: perl -ne 'next if 1 .. 4; print' file > beheaded_file using "if x .. y" falls back to using $. (current line number). a Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. Something must have gone wrong. From mongers at bsod.net Wed Mar 9 11:18:34 2005 From: mongers at bsod.net (Pete Krawczyk) Date: Wed Mar 9 11:18:46 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: Message-ID: Subject: Re: [Chicago-talk] removing line from file. From: Andy_Bach@wiwb.uscourts.gov Date: Wed, 9 Mar 2005 13:17:28 -0600 }perl -ne 'next if 1 .. 4; print' file > beheaded_file Or, to do it in place: perl -ni.bak -e 'print unless 1..4' file1 file2 file3 The .bak can be changed or eliminated if you don't want to save a copy of the file as filename.bak. -Pete K -- Pete Krawczyk mongers at bsod dot net From mongers at bsod.net Wed Mar 9 11:22:49 2005 From: mongers at bsod.net (Pete Krawczyk) Date: Wed Mar 9 11:22:57 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: Message-ID: Following up to myself... }perl -ni.bak -e 'print unless 1..4' file1 file2 file3 You can only use file1 in this instance, since $. is cumulative and doesn't reset on a new file. For things that don't rely on a counter (e.g. a search-and-replace), the multiple-file version works just fine. "perldoc perlrun" for more details on the -i switch. -Pete K -- Pete Krawczyk mongers at bsod dot net From Andy_Bach at wiwb.uscourts.gov Wed Mar 9 11:29:00 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Wed Mar 9 11:25:40 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: Message-ID: Check also perldoc -f eof so, I think: perl -ni.bak -e 'print unless 1..4; close ARGV if eof' file1 file2 file3 will make that work. untested. a Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. Something must have gone wrong. From wiggins at danconia.org Wed Mar 9 11:27:55 2005 From: wiggins at danconia.org (Wiggins d'Anconia) Date: Wed Mar 9 11:27:59 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <20050309191033.17917.qmail@web208.biz.mail.re2.yahoo.com> References: <20050309191033.17917.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: <422F4E3B.1060804@danconia.org> Richard Reina wrote: > This may be annoyingly simple for most on this list, > but does someone have time to take a minute to tell me > what the easiest way in perl 5 to remove the first > four lines from a text file? > > Thanks for any help. > > Richard > If you aren't on the command line, one solution, use strict; use warnings; use Fcntl "O_RDWR"; use Tie::File; tie my @file, 'Tie::File', 'test.txt', mode => O_RDWR or die "Can't tie file: $!"; splice @file, 0, 4; untie @file; http://danconia.org From richard at rushlogistics.com Wed Mar 9 11:28:15 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 9 11:28:24 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: Message-ID: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> Andy, In the context of a bigger program what do I need to do to get that to work? I tried: next if 1 .. 4; print' file > beheaded_file do I need to use and open? --- Andy_Bach@wiwb.uscourts.gov wrote: > perl -ne 'next if 1 .. 4; print' file > > beheaded_file > > using "if x .. y" falls back to using $. (current > line number). > > a > > Andy Bach, Sys. Mangler > Internet: andy_bach@wiwb.uscourts.gov > VOICE: (608) 261-5738 FAX 264-5932 > > In 1968 it took the computing-Power of 2 C-64 to fly > a rocket to the moon. > Now, 1997 it takes the Power of a Pentium 133 to run > Microsoft Windows 95. > Something must have gone wrong. > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From Andy_Bach at wiwb.uscourts.gov Wed Mar 9 11:41:27 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Wed Mar 9 11:38:10 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: Sorry, we were being 'cute'. A standard script behead.pl might be: #!/usr/bin/perl -w use strict; while (<>) { # ignore first 4 lines next if 1 .. 4; # do whatever you want w/ other lines ... # reset $. - line number for multiple files close ARGV if eof; } # while <> so, you could do: behead.pl file1 file2 file3 Outputting to separate files is left as AEFTR or another email. Is this what you where asking? a Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. Something must have gone wrong. From thomasoniii at gmail.com Wed Mar 9 11:41:42 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Wed Mar 9 11:41:51 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: References: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: <5cfdfaf70503091141324d420b@mail.gmail.com> > # ignore first 4 lines > next if 1 .. 4; I believe that should be: next if $. == 1 .. $. == 4; 1..4 won't work, since both 1 and 4 are true values, it never hits the 'next'. -Jim.... > # do whatever you want w/ other lines > ... > # reset $. - line number for multiple files > close ARGV if eof; > > } # while <> > > so, you could do: > behead.pl file1 file2 file3 > > Outputting to separate files is left as AEFTR or another email. Is this > what you where asking? > > a > > Andy Bach, Sys. Mangler > Internet: andy_bach@wiwb.uscourts.gov > VOICE: (608) 261-5738 FAX 264-5932 > > In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. > Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. > Something must have gone wrong. > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From thomasoniii at gmail.com Wed Mar 9 11:42:46 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Wed Mar 9 11:42:52 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <5cfdfaf70503091141324d420b@mail.gmail.com> References: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> <5cfdfaf70503091141324d420b@mail.gmail.com> Message-ID: <5cfdfaf705030911422fd2915b@mail.gmail.com> Oh, hey, I'll be, that does work. Didn't realize that was one of the many funky shortcut notations. -Jim.... On Wed, 9 Mar 2005 13:41:42 -0600, Jim Thomason wrote: > > # ignore first 4 lines > > next if 1 .. 4; > > I believe that should be: > > next if $. == 1 .. $. == 4; > > 1..4 won't work, since both 1 and 4 are true values, it never hits the 'next'. > > -Jim.... > > > # do whatever you want w/ other lines > > ... > > # reset $. - line number for multiple files > > close ARGV if eof; > > > > } # while <> > > > > so, you could do: > > behead.pl file1 file2 file3 > > > > Outputting to separate files is left as AEFTR or another email. Is this > > what you where asking? > > > > a > > > > Andy Bach, Sys. Mangler > > Internet: andy_bach@wiwb.uscourts.gov > > VOICE: (608) 261-5738 FAX 264-5932 > > > > In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. > > Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. > > Something must have gone wrong. > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > From richard at rushlogistics.com Wed Mar 9 12:01:49 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 9 12:02:03 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: Message-ID: <20050309200149.88071.qmail@web209.biz.mail.re2.yahoo.com> That's just what I needed. Thanks again for all the help. Richard --- Andy_Bach@wiwb.uscourts.gov wrote: > Sorry, we were being 'cute'. A standard script > behead.pl might be: > #!/usr/bin/perl -w > use strict; > while (<>) { > # ignore first 4 lines > next if 1 .. 4; > # do whatever you want w/ other lines > ... > # reset $. - line number for multiple files > close ARGV if eof; > > } # while <> > > > so, you could do: > behead.pl file1 file2 file3 > > Outputting to separate files is left as AEFTR or > another email. Is this > what you where asking? > > a > > Andy Bach, Sys. Mangler > Internet: andy_bach@wiwb.uscourts.gov > VOICE: (608) 261-5738 FAX 264-5932 > > In 1968 it took the computing-Power of 2 C-64 to fly > a rocket to the moon. > Now, 1997 it takes the Power of a Pentium 133 to run > Microsoft Windows 95. > Something must have gone wrong. > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From wiggins at danconia.org Wed Mar 9 12:02:51 2005 From: wiggins at danconia.org (Wiggins d'Anconia) Date: Wed Mar 9 12:02:59 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <5cfdfaf70503091141324d420b@mail.gmail.com> References: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> <5cfdfaf70503091141324d420b@mail.gmail.com> Message-ID: <422F566B.6060304@danconia.org> Jim Thomason wrote: >># ignore first 4 lines >> next if 1 .. 4; > > > I believe that should be: > > next if $. == 1 .. $. == 4; > > 1..4 won't work, since both 1 and 4 are true values, it never hits the 'next'. > > -Jim.... This is very odd. Your catch seems ok, but the reasoning seems odd. C<1..4> is a range, 1 and 4 specifically never enter the picture. And regardless the next would *always* get hit rather than 'never' because they *are* true. In this case does the 'if' get a list (1,2,3,4), or 4 (meaning the number in the list) or 4 (the last entry in the range)?? Or does it really work where Perl does some magic not looping over the range except at each iteration of the outer 'while' (which seems impossible)? Not to mention the whole binding order of .. and ==, which wouldn't that turn the above into: C, or do I have my highest/lowest backwards again? Of course, we could just opt for the less silly, next if $. < 5; :) http://danconia.org From wiggins at danconia.org Wed Mar 9 12:07:24 2005 From: wiggins at danconia.org (Wiggins d'Anconia) Date: Wed Mar 9 12:07:21 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <422F566B.6060304@danconia.org> References: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> <5cfdfaf70503091141324d420b@mail.gmail.com> <422F566B.6060304@danconia.org> Message-ID: <422F577C.3000409@danconia.org> Wiggins d'Anconia wrote: > Jim Thomason wrote: > >>> # ignore first 4 lines >>> next if 1 .. 4; >> >> >> >> I believe that should be: >> >> next if $. == 1 .. $. == 4; >> >> 1..4 won't work, since both 1 and 4 are true values, it never hits the >> 'next'. >> >> -Jim.... > > > This is very odd. Your catch seems ok, but the reasoning seems odd. > C<1..4> is a range, 1 and 4 specifically never enter the picture. And > regardless the next would *always* get hit rather than 'never' because > they *are* true. In this case does the 'if' get a list (1,2,3,4), or 4 > (meaning the number in the list) or 4 (the last entry in the range)?? Or > does it really work where Perl does some magic not looping over the > range except at each iteration of the outer 'while' (which seems > impossible)? Which of course if this was a lesser language it would be, but since it is Perl it isn't impossible, only difficult ;-).... Checking perldoc perlop reveals that the range knows its context, and in scalar context all kinds of fun stuff can occur.... Specifically the original should work.... http://danconia.org Not to mention the whole binding order of .. and ==, which > wouldn't that turn the above into: C, or do I > have my highest/lowest backwards again? > > Of course, we could just opt for the less silly, > > next if $. < 5; > > :) > From thomasoniii at gmail.com Wed Mar 9 12:07:31 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Wed Mar 9 12:07:40 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <422F566B.6060304@danconia.org> References: <20050309192815.22874.qmail@web208.biz.mail.re2.yahoo.com> <5cfdfaf70503091141324d420b@mail.gmail.com> <422F566B.6060304@danconia.org> Message-ID: <5cfdfaf70503091207396e1fc@mail.gmail.com> .. is a different operator in a scalar context. In a scalar context, it returns false until the first item returns true. Then it continues to return true until the second operator returns true, after which it returns false again. I just hadn't realized that 1..4 seems to be a shortcut for $. == 1 .. $. == 4. In normal situations (I assume when $. isn't around and being twiddled), 1..4 is a no-op. 1 evaluates to true, then 4 immediately evalutes to true, so nothing happens, and hence the next is never hit. -Jim..... > This is very odd. Your catch seems ok, but the reasoning seems odd. > C<1..4> is a range, 1 and 4 specifically never enter the picture. And > regardless the next would *always* get hit rather than 'never' because > they *are* true. In this case does the 'if' get a list (1,2,3,4), or 4 > (meaning the number in the list) or 4 (the last entry in the range)?? Or > does it really work where Perl does some magic not looping over the > range except at each iteration of the outer 'while' (which seems > impossible)? Not to mention the whole binding order of .. and ==, which > wouldn't that turn the above into: C, or do I > have my highest/lowest backwards again? > > Of course, we could just opt for the less silly, > > next if $. < 5; > > :) > > http://danconia.org > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From Andy_Bach at wiwb.uscourts.gov Wed Mar 9 12:42:37 2005 From: Andy_Bach at wiwb.uscourts.gov (Andy_Bach@wiwb.uscourts.gov) Date: Wed Mar 9 12:41:20 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: <422F566B.6060304@danconia.org> Message-ID: Larry thought of everything ... perldoc perlop ... Binary ".." is the range operator, which is really two different operators depending on the context. ... In scalar context, ".." returns a boolean value. The operator is bistable, like a flip-flop, and emulates the line-range (comma) operator of awk, and various editors. Each ".." operator maintains its own boolean state. It is false as long as its left operand is false. Once the left operand is true, the range operator stays true until the right operand is true, AFTER which the range operator becomes false again. It doesn't become false till the next time the range operator is evaluated. It can test the right operand and become false on the same evaluation it became true (as in awk), but it still returns true once. If you don't want it to test the right operand till the next evaluation, as in sed, just use three dots ("...") instead of two. In all other regards, "..." behaves just like ".." does. ... If either operand of scalar ".." is a constant expression, that operand is implicitly compared to the $. variable, the current line number. a Andy Bach, Sys. Mangler Internet: andy_bach@wiwb.uscourts.gov VOICE: (608) 261-5738 FAX 264-5932 In 1968 it took the computing-Power of 2 C-64 to fly a rocket to the moon. Now, 1997 it takes the Power of a Pentium 133 to run Microsoft Windows 95. Something must have gone wrong. From gdf at speakeasy.net Wed Mar 9 13:12:20 2005 From: gdf at speakeasy.net (Greg Fast) Date: Wed Mar 9 13:12:30 2005 Subject: [Chicago-talk] removing line from file. In-Reply-To: References: Message-ID: On Wed, 9 Mar 2005 14:42:37 -0600, Andy_Bach@wiwb.uscourts.gov wrote: > editors. Each ".." operator maintains its own boolean > state. It is false as long as its left operand is false. Aw, nuts. 'perldoc overload' says ".." isn't overloadable... I wanted to see how the context was kicked around :) Until looking, though, I didn't know that overloadable ops included dereferencing ("${}", "@{}", etc). Fun fun. package Foo; use overload '&{}' => \&do_sub; sub new { return bless { _s => ["hello, ","world","!"] }, shift; } sub do_sub { my $self = shift; my $s = shift( @{$self->{_s}} ); push( @{$self->{_s}}, $s ); return sub { print "$s" }; } 1; package main; my $f = Foo->new(); $f->(); $f->(); $f->(); -- Greg Fast http://cken.chi.groogroo.com/~gdf/ From jt at plainblack.com Fri Mar 11 12:20:20 2005 From: jt at plainblack.com (JT Smith) Date: Fri Mar 11 12:20:47 2005 Subject: [Chicago-talk] replace in place Message-ID: I remember having a really great tutorial on doing things in one line from the command line in perl, but I can't remember how it all worked. Could somebody help me out? I have a make file that has a line in it I wish to replace. The line looks like: prefix=/usr/local And I would like it to be prefix=/data/prereqs I can very easily write a little script to read in the file find and replace that string, but I'd rather do the cool single command line trick. Thanks for the help. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From andy at petdance.com Fri Mar 11 12:29:51 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 11 12:30:02 2005 Subject: [Chicago-talk] replace in place In-Reply-To: References: Message-ID: <20050311202951.GA14322@petdance.com> On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith (jt@plainblack.com) wrote: > I remember having a really great tutorial on doing things in one line from > the command line in perl, but I can't remember how it all worked. Could > somebody help me out? I have a make file that has a line in it I wish to > replace. The line looks like: "A Field Guide To The Perl Command-Line Options" at http://www.petdance.com/perl/ > prefix=/usr/local > > And I would like it to be > > prefix=/data/prereqs perl -i -p -e's[/usr/local][/data/prereqs]g' Makefile or perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq "prefix=/usr/local"' Makefile You can replace Makefile with `find . -name Makefile` to find all Makefiles in the tree if you like. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Fri Mar 11 12:29:51 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 11 12:30:05 2005 Subject: [Chicago-talk] replace in place In-Reply-To: References: Message-ID: <20050311202951.GA14322@petdance.com> On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith (jt@plainblack.com) wrote: > I remember having a really great tutorial on doing things in one line from > the command line in perl, but I can't remember how it all worked. Could > somebody help me out? I have a make file that has a line in it I wish to > replace. The line looks like: "A Field Guide To The Perl Command-Line Options" at http://www.petdance.com/perl/ > prefix=/usr/local > > And I would like it to be > > prefix=/data/prereqs perl -i -p -e's[/usr/local][/data/prereqs]g' Makefile or perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq "prefix=/usr/local"' Makefile You can replace Makefile with `find . -name Makefile` to find all Makefiles in the tree if you like. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jt at plainblack.com Fri Mar 11 12:34:10 2005 From: jt at plainblack.com (JT Smith) Date: Fri Mar 11 12:34:50 2005 Subject: [Chicago-talk] replace in place In-Reply-To: <20050311202951.GA14322@petdance.com> References: <20050311202951.GA14322@petdance.com> Message-ID: Thank you so much! On Fri, 11 Mar 2005 14:29:51 -0600 Andy Lester wrote: > On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith (jt@plainblack.com) wrote: >> I remember having a really great tutorial on doing things in one line from >> the command line in perl, but I can't remember how it all worked. Could >> somebody help me out? I have a make file that has a line in it I wish to >> replace. The line looks like: > > "A Field Guide To The Perl Command-Line Options" at > http://www.petdance.com/perl/ > >> prefix=/usr/local >> >> And I would like it to be >> >> prefix=/data/prereqs > > perl -i -p -e's[/usr/local][/data/prereqs]g' Makefile > > or > > perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq "prefix=/usr/local"' Makefile > > You can replace > > Makefile > > with > > `find . -name Makefile` > > to find all Makefiles in the tree if you like. > > > -- > Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From gdf at speakeasy.net Fri Mar 11 12:55:50 2005 From: gdf at speakeasy.net (Greg Fast) Date: Fri Mar 11 12:56:00 2005 Subject: [Chicago-talk] replace in place In-Reply-To: <20050311202951.GA14322@petdance.com> References: <20050311202951.GA14322@petdance.com> Message-ID: On Fri, 11 Mar 2005 14:29:51 -0600, Andy Lester wrote: > On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith (jt@plainblack.com) wrote: > > I remember having a really great tutorial on doing things in one line from > > the command line in perl, but I can't remember how it all worked. Could > or > > perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq "prefix=/usr/local"' Makefile > > You can replace > > Makefile > > with > > `find . -name Makefile` > > to find all Makefiles in the tree if you like. This is a good trick too: find . -name \*.java | xargs perl -ipe 's/public/private/' especially when you need complex findage, your file count starts to bump up against the command length limit of your shell (usually ~1024 characters). And if some of your filenames might have spaces or other unsafe chars in them, "find ... -print0 | xargs -0 perl ..." rules. Oh, and since perl -pe was mentioned, I'm karmically obliged to give a shout out for perl -MO=Deparse -i@@ -pe 's/foo/bar/' Makefile -- Greg Fast http://cken.chi.groogroo.com/~gdf/ From gdf at speakeasy.net Fri Mar 11 13:05:06 2005 From: gdf at speakeasy.net (Greg Fast) Date: Fri Mar 11 13:05:16 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON In-Reply-To: <20050309152201.GA20566@petdance.com> References: <20050309152201.GA20566@petdance.com> Message-ID: On Wed, 9 Mar 2005 09:22:01 -0600, Andy Lester wrote: > I got two of my talks accepted at OSCON 2005. One is called > "Introducting automated testing to existing projects", and the other is > "Avoiding crisis: Transforming from scapegoat to hero." > > Now if only we had a room I could try 'em out on y'all! It looks like I could probably get a meeting room at the Des Plaines library (http://dppl.org). It's conveniently located across the street from the DP Metra station, and might even have wifi (they have it up on the 4th floor, at least). There's a lot of contention for times though (http://plus.calendars.net/dppl2002 - they have three rooms, A B and C). I'm not sure how soon we'd be able to schedule something. -- Greg Fast http://cken.chi.groogroo.com/~gdf/ From andy at petdance.com Fri Mar 11 13:14:41 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 11 13:14:50 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON In-Reply-To: <20050311210516.B849D177E4@x6.develooper.com> References: <20050309152201.GA20566@petdance.com> <20050311210516.B849D177E4@x6.develooper.com> Message-ID: <20050311211441.GB14903@petdance.com> On Fri, Mar 11, 2005 at 03:05:06PM -0600, Greg Fast (gdf@speakeasy.net) wrote: > It looks like I could probably get a meeting room at the Des Plaines > library (http://dppl.org). It's conveniently located across the street > from the DP Metra station, and might even have wifi (they have it up on > the 4th floor, at least). There's a lot of contention for times though > (http://plus.calendars.net/dppl2002 - they have three rooms, A B and C). > I'm not sure how soon we'd be able to schedule something. Des Plaines or Vernon Hills, whichever. Can someone nail down a date/time? Thanks, Andy -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Fri Mar 11 13:14:41 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 11 13:14:51 2005 Subject: [Chicago-talk] Two of my talks are accepted at OSCON In-Reply-To: <20050311210516.B849D177E4@x6.develooper.com> References: <20050309152201.GA20566@petdance.com> <20050311210516.B849D177E4@x6.develooper.com> Message-ID: <20050311211441.GB14903@petdance.com> On Fri, Mar 11, 2005 at 03:05:06PM -0600, Greg Fast (gdf@speakeasy.net) wrote: > It looks like I could probably get a meeting room at the Des Plaines > library (http://dppl.org). It's conveniently located across the street > from the DP Metra station, and might even have wifi (they have it up on > the 4th floor, at least). There's a lot of contention for times though > (http://plus.calendars.net/dppl2002 - they have three rooms, A B and C). > I'm not sure how soon we'd be able to schedule something. Des Plaines or Vernon Hills, whichever. Can someone nail down a date/time? Thanks, Andy -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Fri Mar 11 15:26:48 2005 From: andy at petdance.com (Andy Lester) Date: Fri Mar 11 15:26:59 2005 Subject: [Chicago-talk] Attention all Perl consultants, speakers and trainers Message-ID: <20050311232648.GE14903@petdance.com> Perl.com is starting up a directory of Perl consultants, speakers and trainers, and would like to populate the database with some initial contacts before it goes live. If you do any of the above, please email me directory with "PERL DIRECTORY" in the subject, and the following info: Subject: PERL DIRECTORY Company name (if any) First/Last name URL Email City, State, ZIP Phone number Which services you offer: * On-Site Training * Online Classes * Speaking Engagements * Training Facility And tell a bit about yourself and your services. I'll collect these and forward them to O'Reilly. xoxo, Andy -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jason at multiply.org Sat Mar 12 20:33:51 2005 From: jason at multiply.org (Jason Gessner) Date: Sat Mar 12 20:34:18 2005 Subject: [Chicago-talk] replace in place In-Reply-To: <20050311205600.C8F80177E1@x6.develooper.com> References: <20050311202951.GA14322@petdance.com> <20050311205600.C8F80177E1@x6.develooper.com> Message-ID: <65db312368c1e325271aaee2c742a730@multiply.org> also, you can add an extension to -i like -i.bak to have the original files backed up......... Comes in handy if you aren't *quite* sure about what you are doing. :) -jason gessner jason@multiply.org On Mar 11, 2005, at 2:55 PM, Greg Fast wrote: > On Fri, 11 Mar 2005 14:29:51 -0600, Andy Lester > wrote: >> On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith >> (jt@plainblack.com) wrote: >>> I remember having a really great tutorial on doing things in one >>> line from >>> the command line in perl, but I can't remember how it all worked. >>> Could >> or >> >> perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq >> "prefix=/usr/local"' Makefile >> >> You can replace >> >> Makefile >> >> with >> >> `find . -name Makefile` >> >> to find all Makefiles in the tree if you like. > > This is a good trick too: > > find . -name \*.java | xargs perl -ipe 's/public/private/' > > especially when you need complex findage, your file count starts to > bump up against the command length limit of your shell (usually ~1024 > characters). And if some of your filenames might have spaces or other > unsafe chars in them, "find ... -print0 | xargs -0 perl ..." rules. > > Oh, and since perl -pe was mentioned, I'm karmically obliged to give a > shout out for > > perl -MO=Deparse -i@@ -pe 's/foo/bar/' Makefile > > -- > Greg Fast > http://cken.chi.groogroo.com/~gdf/ > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From jason at multiply.org Sat Mar 12 20:33:51 2005 From: jason at multiply.org (Jason Gessner) Date: Sat Mar 12 20:34:24 2005 Subject: [Chicago-talk] replace in place In-Reply-To: <20050311205600.C8F80177E1@x6.develooper.com> References: <20050311202951.GA14322@petdance.com> <20050311205600.C8F80177E1@x6.develooper.com> Message-ID: <65db312368c1e325271aaee2c742a730@multiply.org> also, you can add an extension to -i like -i.bak to have the original files backed up......... Comes in handy if you aren't *quite* sure about what you are doing. :) -jason gessner jason@multiply.org On Mar 11, 2005, at 2:55 PM, Greg Fast wrote: > On Fri, 11 Mar 2005 14:29:51 -0600, Andy Lester > wrote: >> On Fri, Mar 11, 2005 at 02:20:20PM -0600, JT Smith >> (jt@plainblack.com) wrote: >>> I remember having a really great tutorial on doing things in one >>> line from >>> the command line in perl, but I can't remember how it all worked. >>> Could >> or >> >> perl -i -p -l -e'$_ = "prefix=/data/prereqs" if $_ eq >> "prefix=/usr/local"' Makefile >> >> You can replace >> >> Makefile >> >> with >> >> `find . -name Makefile` >> >> to find all Makefiles in the tree if you like. > > This is a good trick too: > > find . -name \*.java | xargs perl -ipe 's/public/private/' > > especially when you need complex findage, your file count starts to > bump up against the command length limit of your shell (usually ~1024 > characters). And if some of your filenames might have spaces or other > unsafe chars in them, "find ... -print0 | xargs -0 perl ..." rules. > > Oh, and since perl -pe was mentioned, I'm karmically obliged to give a > shout out for > > perl -MO=Deparse -i@@ -pe 's/foo/bar/' Makefile > > -- > Greg Fast > http://cken.chi.groogroo.com/~gdf/ > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From briank at kappacs.com Sun Mar 13 12:10:53 2005 From: briank at kappacs.com (Brian Katzung) Date: Sun Mar 13 12:11:04 2005 Subject: [Chicago-talk] Web application developer job posting Message-ID: <42349E4D.90900@kappacs.com> I'm posting this for a colleague. Please contact them directly if interested. Regards, - Brian -------------- next part -------------- A non-text attachment was scrubbed... Name: Textura Job Posting.pdf Type: application/pdf Size: 20365 bytes Desc: not available Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20050313/23b49bfc/TexturaJobPosting.pdf From richard at rushlogistics.com Tue Mar 15 08:16:23 2005 From: richard at rushlogistics.com (Richard Reina) Date: Tue Mar 15 08:16:35 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? Message-ID: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> I know there's a handy $< to find the UID of the user executing the prorgram. Is there any handy operator to find the IP address of the local machine that is running the program. Thanks, Richard From gdf at speakeasy.net Tue Mar 15 08:24:26 2005 From: gdf at speakeasy.net (Greg Fast) Date: Tue Mar 15 08:24:42 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: On Tue, 15 Mar 2005 08:16:23 -0800 (PST), Richard Reina wrote: > I know there's a handy $< to find the UID of the user > executing the prorgram. Is there any handy operator > to find the IP address of the local machine that is > running the program. Check out perldoc -q hostname. There are a number of potential pitfalls with that solution, but it's fine on a reasonably "normal" box. -- Greg Fast http://cken.chi.groogroo.com/~gdf/ From richard at rushlogistics.com Tue Mar 15 08:38:24 2005 From: richard at rushlogistics.com (Richard Reina) Date: Tue Mar 15 08:38:37 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315162443.D50A1177E1@x6.develooper.com> Message-ID: <20050315163824.20488.qmail@web205.biz.mail.re2.yahoo.com> Thanks Greg I'll check it out. --- Greg Fast wrote: > On Tue, 15 Mar 2005 08:16:23 -0800 (PST), Richard > Reina wrote: > > I know there's a handy $< to find the UID of the > user > > executing the prorgram. Is there any handy > operator > > to find the IP address of the local machine that > is > > running the program. > > Check out perldoc -q hostname. There are a number > of potential > pitfalls with that solution, but it's fine on a > reasonably "normal" > box. > > -- > Greg Fast > http://cken.chi.groogroo.com/~gdf/ > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From gdf at speakeasy.net Tue Mar 15 08:38:43 2005 From: gdf at speakeasy.net (Greg Fast) Date: Tue Mar 15 08:38:57 2005 Subject: [Chicago-talk] Debugging Filter::Simple? Message-ID: Has anyone used Filter::Simple? Anyone know how to get it to dump out the transformed version of what it's filtered? I've got a little hack that I've used on and off for debugging for a few years, in a file called DEBUG.pm: package DEBUG; use Filter::Simple; FILTER { s/^\s*\#DEBUG //gm; } 1; Which I use in stuff like this: package Bleh::Moo::Horkage; use DEBUG; sub complex_mess { # ... #DEBUG print "Slow complex data dump: ", $data->to_human, "\n"; } If I comment out the "use DEBUG", the debug lines are just comments, but if it's uncommented, those lines get executed. Except that all of a sudden it's choking on something, and breaking the code in a module: Global symbol "$eval_str" requires explicit package name at lib/Grinder/VirtualClass.pm line 13. (etc...) Since I don't know what the filtered .pm looks like, these messages are... unhelpful. -- Greg Fast http://cken.chi.groogroo.com/~gdf/ From steve at fisharerojo.org Tue Mar 15 11:45:38 2005 From: steve at fisharerojo.org (Steve Peters) Date: Tue Mar 15 11:45:54 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <20050315194538.GA18160@mccoy.peters.homeunix.org> On Tue, Mar 15, 2005 at 08:16:23AM -0800, Richard Reina wrote: > I know there's a handy $< to find the UID of the user > executing the prorgram. Is there any handy operator > to find the IP address of the local machine that is > running the program. > Richard, The ways to get an IP address from Perl are less than 100% reliable. To get something reliable, you have to get to a fairly low level on the device. With the help of Libnet (the C library), Inline::C, and root access, its a piece of cake. Enjoy! Steve Peters steve@fisharerojo.org #!/usr/bin/perl -w use Inline ( C => 'DATA', LIBS => '-L/usr/local/lib -lnet', INC => '-I/usr/local/include', AUTO_INCLUDE => '#include "libnet.h"' ); print get_ip_address("fxp0"), "\n"; __END__ __C__ char* get_ip_address(char* device) { char* errbuf[LIBNET_ERRBUF_SIZE]; libnet_t* l; u_int32_t ip; char* addr; l = libnet_init(LIBNET_LINK, device, errbuf); if (!l) { addr = libnet_geterror(l); return addr; } ip = libnet_get_ipaddr4(l); if(-1 == ip) { addr = libnet_geterror(l); } else { addr = libnet_addr2name4(ip, LIBNET_DONT_RESOLVE); } libnet_destroy(l); return addr; } From steve at fisharerojo.org Tue Mar 15 11:45:38 2005 From: steve at fisharerojo.org (Steve Peters) Date: Tue Mar 15 11:45:54 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <20050315194538.GA18160@mccoy.peters.homeunix.org> On Tue, Mar 15, 2005 at 08:16:23AM -0800, Richard Reina wrote: > I know there's a handy $< to find the UID of the user > executing the prorgram. Is there any handy operator > to find the IP address of the local machine that is > running the program. > Richard, The ways to get an IP address from Perl are less than 100% reliable. To get something reliable, you have to get to a fairly low level on the device. With the help of Libnet (the C library), Inline::C, and root access, its a piece of cake. Enjoy! Steve Peters steve@fisharerojo.org #!/usr/bin/perl -w use Inline ( C => 'DATA', LIBS => '-L/usr/local/lib -lnet', INC => '-I/usr/local/include', AUTO_INCLUDE => '#include "libnet.h"' ); print get_ip_address("fxp0"), "\n"; __END__ __C__ char* get_ip_address(char* device) { char* errbuf[LIBNET_ERRBUF_SIZE]; libnet_t* l; u_int32_t ip; char* addr; l = libnet_init(LIBNET_LINK, device, errbuf); if (!l) { addr = libnet_geterror(l); return addr; } ip = libnet_get_ipaddr4(l); if(-1 == ip) { addr = libnet_geterror(l); } else { addr = libnet_addr2name4(ip, LIBNET_DONT_RESOLVE); } libnet_destroy(l); return addr; } From andy at petdance.com Tue Mar 15 11:50:18 2005 From: andy at petdance.com (Andy Lester) Date: Tue Mar 15 11:50:27 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315194538.GA18160@mccoy.peters.homeunix.org> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> <20050315194538.GA18160@mccoy.peters.homeunix.org> Message-ID: <20050315195018.GB22512@petdance.com> On Tue, Mar 15, 2005 at 01:45:38PM -0600, Steve Peters (steve@fisharerojo.org) wrote: > The ways to get an IP address from Perl are less than 100% reliable. To Please also note that chances are your machine answers to at least two different IPs: 127.0.0.1, and the outside. Heaven help you if you answer to multiple IPs, on multiple interfaces, or even on the same interface! -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Tue Mar 15 11:50:18 2005 From: andy at petdance.com (Andy Lester) Date: Tue Mar 15 11:50:29 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315194538.GA18160@mccoy.peters.homeunix.org> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> <20050315194538.GA18160@mccoy.peters.homeunix.org> Message-ID: <20050315195018.GB22512@petdance.com> On Tue, Mar 15, 2005 at 01:45:38PM -0600, Steve Peters (steve@fisharerojo.org) wrote: > The ways to get an IP address from Perl are less than 100% reliable. To Please also note that chances are your machine answers to at least two different IPs: 127.0.0.1, and the outside. Heaven help you if you answer to multiple IPs, on multiple interfaces, or even on the same interface! -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From warren at warrenandrachel.com Tue Mar 15 12:58:11 2005 From: warren at warrenandrachel.com (wsmith) Date: Tue Mar 15 13:01:08 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315195018.GB22512@petdance.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> <20050315194538.GA18160@mccoy.peters.homeunix.org> <20050315195018.GB22512@petdance.com> Message-ID: <1110920291.30268.0.camel@localhost.localdomain> my @ip_addresses = `/sbin/ifconfig | grep 'inet addr:' | sed -e 's/.*inet addr://' -e 's/ .*//'` On Tue, 2005-03-15 at 13:50 -0600, Andy Lester wrote: > On Tue, Mar 15, 2005 at 01:45:38PM -0600, Steve Peters (steve@fisharerojo.org) wrote: > > The ways to get an IP address from Perl are less than 100% reliable. To > > Please also note that chances are your machine answers to at least two > different IPs: 127.0.0.1, and the outside. Heaven help you if you > answer to multiple IPs, on multiple interfaces, or even on the same > interface! > From mongers at bsod.net Tue Mar 15 13:32:36 2005 From: mongers at bsod.net (Pete Krawczyk) Date: Tue Mar 15 13:32:45 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <1110920291.30268.0.camel@localhost.localdomain> Message-ID: Subject: Re: [Chicago-talk] Any handy operators for finding the local IP? From: wsmith Date: Tue, 15 Mar 2005 14:58:11 -0600 }my @ip_addresses = `/sbin/ifconfig | grep 'inet addr:' | sed -e 's/.*inet addr://' -e 's/ .*//'` That's not very portable, especially running on a Windows box, or across other platforms. For example, Mac OS X's inet lines for lo look like: inet6 ::1 prefixlen 128 inet6 fe80::1 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 And if you choose to dismiss that as "Well, it's only going to run on this box", then why not hardcode the IP in anyway? -Pete K -- Pete Krawczyk mongers at bsod dot net From steve at fisharerojo.org Tue Mar 15 13:37:57 2005 From: steve at fisharerojo.org (Steve Peters) Date: Tue Mar 15 13:38:21 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <1110920291.30268.0.camel@localhost.localdomain> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> <20050315194538.GA18160@mccoy.peters.homeunix.org> <20050315195018.GB22512@petdance.com> <1110920291.30268.0.camel@localhost.localdomain> Message-ID: <20050315213757.GA29194@mccoy.peters.homeunix.org> On Tue, Mar 15, 2005 at 02:58:11PM -0600, wsmith wrote: > my @ip_addresses = `/sbin/ifconfig | grep 'inet addr:' | sed -e > 's/.*inet addr://' -e 's/ .*//'` > > On Tue, 2005-03-15 at 13:50 -0600, Andy Lester wrote: > > On Tue, Mar 15, 2005 at 01:45:38PM -0600, Steve Peters (steve@fisharerojo.org) wrote: > > > The ways to get an IP address from Perl are less than 100% reliable. To > > > > Please also note that chances are your machine answers to at least two > > different IPs: 127.0.0.1, and the outside. Heaven help you if you > > answer to multiple IPs, on multiple interfaces, or even on the same > > interface! > > > That, unfortunately, makes assumptions about the location, availability, and required parameters for ifconfig. It will work in a single platform Linux environments, but it is not portable, and won't work if you work with Windows or certain BSDs. Steve Peters steve@fisharerojo.org From wlindsey at blackhatlounge.net Wed Mar 16 06:43:40 2005 From: wlindsey at blackhatlounge.net (Warren Lindsey) Date: Wed Mar 16 06:44:43 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <4238461C.6000102@blackhatlounge.net> I have used Win32::IPConfig on windows. I checked CPAN for the current version and there are also these cross-platform modules: Net::Ifconfig::Wrapper Sys::HostIP Net::Interface Win32::IPConfig Win32::IPHelper Cheers Richard Reina wrote: >I know there's a handy $< to find the UID of the user >executing the prorgram. Is there any handy operator >to find the IP address of the local machine that is >running the program. > >Thanks, > >Richard >_______________________________________________ >Chicago-talk mailing list >Chicago-talk@pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk > > From richard at rushlogistics.com Wed Mar 16 09:01:17 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 16 09:01:25 2005 Subject: [Chicago-talk] perl DBI ? Message-ID: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> when I run these lines of code : my $T_NO = 12569; use DBI; my $dbh = DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); my $q = "CREATE TABLE IF NOT EXISTS CS_? ( ID_NO MEDIUMINT, NAME VARCHAR(30), TYPE CHAR(1) )"; my $sth = $dbh->prepare($q); $sth->execute($T_NO); from w/in a program I get: DBD:mysql::st execute failed: You have an error in your SQL syntax near '12569 ( ID_NO MEDIUMINT, NAME VARCHAR(30), TYP' at line 2 at ./carr_s.pl line 36. However if I cut and paste the exact same code and make it it's own program then execute it, it works perfectly. Can anyone tell me what's happening and how I can fix it? Thanks, Richard From mongers at bsod.net Wed Mar 16 09:10:08 2005 From: mongers at bsod.net (Pete Krawczyk) Date: Wed Mar 16 09:10:16 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: Subject: [Chicago-talk] perl DBI ? From: Richard Reina Date: Wed, 16 Mar 2005 09:01:17 -0800 (PST) }my $q = "CREATE TABLE IF NOT EXISTS CS_? ( You can't bind like that. Binds can only be used in certain instances: SELECT item FROM table WHERE column = ? INSERT INTO table (item) VALUES (?) UPDATE table SET item = ? WHERE column = ? ...and in a few other cases, but never as keywords, and never as in: SELECT item FROM table WHERE column IN ? SELECT ? FROM table WHERE column = ? SELECT item FROM ? WHERE column = ? SELECT item FROM table WHERE ? = ? Although, you could do: SELECT item FROM table WHERE column IN (?,?) ...and supply multiple bind variables. But you can't keyword binds, and binds can't be generally be used to express nulls (i.e 'column = ?',undef is not the same as 'column IS NULL') See "Placeholders and Bind Values" in "perldoc DBI". -Pete K -- Pete Krawczyk perl at bsod dot net From andy at petdance.com Wed Mar 16 09:12:47 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 16 09:13:00 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> References: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: <20050316171247.GB1150@petdance.com> On Wed, Mar 16, 2005 at 09:01:17AM -0800, Richard Reina (richard@rushlogistics.com) wrote: > when I run these lines of code : > > my $T_NO = 12569; > use DBI; > my $dbh = > DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > > my $q = "CREATE TABLE IF NOT EXISTS CS_? ( You're trying to bind a variable to a table name somehow? So it's CREATE TABLE IF NOT EXISTS CS_12569 I don't think that's legal. Bind variables are only valid for fields. Instead, embed the $T_NO directly into the SQL. I'm concerned that you're making a bunch of identical tables, though. Why is that? xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Wed Mar 16 09:12:47 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 16 09:13:02 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> References: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: <20050316171247.GB1150@petdance.com> On Wed, Mar 16, 2005 at 09:01:17AM -0800, Richard Reina (richard@rushlogistics.com) wrote: > when I run these lines of code : > > my $T_NO = 12569; > use DBI; > my $dbh = > DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > > my $q = "CREATE TABLE IF NOT EXISTS CS_? ( You're trying to bind a variable to a table name somehow? So it's CREATE TABLE IF NOT EXISTS CS_12569 I don't think that's legal. Bind variables are only valid for fields. Instead, embed the $T_NO directly into the SQL. I'm concerned that you're making a bunch of identical tables, though. Why is that? xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From richard at rushlogistics.com Wed Mar 16 09:15:58 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 16 09:16:27 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: Message-ID: <20050316171558.68237.qmail@web208.biz.mail.re2.yahoo.com> Pete, Thanks you very much for your response. I am not refuting waht you say, as you clearly know more than I. However, do you happen to know why is it that it works when it's a stand alone program? Would you happen to know of a work around for creating a table with a unique name from w/in another program. Thanks again, Richard --- Pete Krawczyk wrote: > Subject: [Chicago-talk] perl DBI ? > From: Richard Reina > Date: Wed, 16 Mar 2005 09:01:17 -0800 (PST) > > }my $q = "CREATE TABLE IF NOT EXISTS CS_? ( > > You can't bind like that. Binds can only be used in > certain instances: > SELECT item FROM table WHERE column = ? > INSERT INTO table (item) VALUES (?) > UPDATE table SET item = ? WHERE column = ? > ...and in a few other cases, but never as keywords, > and never as in: > SELECT item FROM table WHERE column IN ? > SELECT ? FROM table WHERE column = ? > SELECT item FROM ? WHERE column = ? > SELECT item FROM table WHERE ? = ? > > Although, you could do: > SELECT item FROM table WHERE column IN (?,?) > ...and supply multiple bind variables. > > But you can't keyword binds, and binds can't be > generally be used to > express nulls (i.e 'column = ?',undef is not the > same as 'column IS NULL') > > See "Placeholders and Bind Values" in "perldoc DBI". > > -Pete K > -- > Pete Krawczyk > perl at bsod dot net > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Wed Mar 16 09:23:30 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 16 09:23:38 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316171247.GB1150@petdance.com> Message-ID: <20050316172330.4115.qmail@web201.biz.mail.re2.yahoo.com> I am actually trying to create a unique table, hense that's why I would like the script to pick the table's name based on the transaction number. --- Andy Lester wrote: > On Wed, Mar 16, 2005 at 09:01:17AM -0800, Richard > Reina (richard@rushlogistics.com) wrote: > > when I run these lines of code : > > > > my $T_NO = 12569; > > use DBI; > > my $dbh = > > > DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > > > > my $q = "CREATE TABLE IF NOT EXISTS CS_? ( > > You're trying to bind a variable to a table name > somehow? So it's > > CREATE TABLE IF NOT EXISTS CS_12569 > > I don't think that's legal. Bind variables are only > valid for fields. > Instead, embed the $T_NO directly into the SQL. > > I'm concerned that you're making a bunch of > identical tables, though. > Why is that? > > xoa > > -- > Andy Lester => andy@petdance.com => www.petdance.com > => AIM:petdance > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From andy at petdance.com Wed Mar 16 09:33:10 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 16 09:33:18 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316172330.4115.qmail@web201.biz.mail.re2.yahoo.com> References: <20050316171247.GB1150@petdance.com> <20050316172330.4115.qmail@web201.biz.mail.re2.yahoo.com> Message-ID: <20050316173310.GC1150@petdance.com> On Wed, Mar 16, 2005 at 09:23:30AM -0800, Richard Reina (richard@rushlogistics.com) wrote: > I am actually trying to create a unique table, hense > that's why I would like the script to pick the table's > name based on the transaction number. Right, but why do you need a unique table that's identical to many others? What problem does that solve? xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From mongers at bsod.net Wed Mar 16 09:42:09 2005 From: mongers at bsod.net (Pete Krawczyk) Date: Wed Mar 16 09:42:18 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316171558.68237.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: Subject: Re: [Chicago-talk] perl DBI ? From: Richard Reina Date: Wed, 16 Mar 2005 09:15:58 -0800 (PST) }However, do you happen to know why is it that it }works when it's a stand alone program? Would you }happen to know of a work around for creating a table }with a unique name from w/in another program. Well, I'll be damned: $ cat bind.pl #!/usr/bin/perl -Tw use strict; use DBI; my ($db,$un,$pw) = ('test'); my $dbh = DBI->connect("DBI:mysql:database=$db",$un,$pw); my $table_sth = $dbh->prepare('CREATE TABLE TMP_? (NAME CHAR(1))'); $table_sth->execute($$); $table_sth->finish; my $insert_sth = $dbh->prepare("INSERT INTO TMP_$$ VALUES (?)"); $insert_sth->execute("A"); $insert_sth->finish; my $select_sth = $dbh->prepare("SELECT NAME FROM TMP_?"); $select_sth->execute($$); my $vals = $select_sth->fetchall_arrayref; $select_sth->finish; print scalar(@$vals) . " rows in table TMP_$$\n"; $dbh->do("DROP TABLE TMP_$$"); $dbh->disconnect; exit(0); $ ./bind.pl 1 rows in table TMP_10493 Oh, here's why: (perldoc DBI) With most drivers, placeholders can't be used for any element of a statement that would prevent the database server from validating the statement and creating a query execution plan for it. For example: "SELECT name, age FROM ?" # wrong (will probably fail) "SELECT name, ? FROM people" # wrong (but may not 'fail') So apparently the DBD::mysql driver isn't playing by the same rules as most of the other DBD drivers, and is just inserting the binds by itself at execute time. So given that, I couldn't explain why your code works in one situation and not the other. I would also echo Andy's question about why you need to create a unique table in your code. -Pete K -- Pete Krawczyk perl at bsod dot net From richard at rushlogistics.com Wed Mar 16 10:26:22 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 16 10:26:32 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: Message-ID: <20050316182622.53247.qmail@web210.biz.mail.re2.yahoo.com> I'll try to explain as susinctly as possible. The table is a temp table that will be used temporarily (on an off for a day or two ) by a user (worker in the office) update the progress of the transaction he is working on. Hense, that's why the table is to take the name of the transaction number. By day two the transaction is either completed or lost, so the data ( that was compilled for and is specific to that unique transaction is useless and will be discarder with "drop table". I know, I know I could put the data in one table and select in by the transaction ID number -- and I still may end up doing it that way. However, not only would it mean row level locking as more than one user would need to be updating the table eventhough they are all working on diff. transactions., it would just seem much cleaner to compile the data for the transaction as it's own table and discard it when the transaction is done. Feed back ( but not flames :) ) is always welcome. Thanks, Richard --- Pete Krawczyk wrote: > Subject: Re: [Chicago-talk] perl DBI ? > From: Richard Reina > Date: Wed, 16 Mar 2005 09:15:58 -0800 (PST) > > }However, do you happen to know why is it that it > }works when it's a stand alone program? Would you > }happen to know of a work around for creating a > table > }with a unique name from w/in another program. > > Well, I'll be damned: > > $ cat bind.pl > #!/usr/bin/perl -Tw > use strict; > use DBI; > my ($db,$un,$pw) = ('test'); > > my $dbh = > DBI->connect("DBI:mysql:database=$db",$un,$pw); > my $table_sth = $dbh->prepare('CREATE TABLE TMP_? > (NAME CHAR(1))'); > $table_sth->execute($$); $table_sth->finish; > my $insert_sth = $dbh->prepare("INSERT INTO TMP_$$ > VALUES (?)"); > $insert_sth->execute("A"); $insert_sth->finish; > my $select_sth = $dbh->prepare("SELECT NAME FROM > TMP_?"); > $select_sth->execute($$); my $vals = > $select_sth->fetchall_arrayref; > $select_sth->finish; > print scalar(@$vals) . " rows in table TMP_$$\n"; > $dbh->do("DROP TABLE TMP_$$"); > $dbh->disconnect; > exit(0); > > $ ./bind.pl > 1 rows in table TMP_10493 > > Oh, here's why: (perldoc DBI) > With most drivers, placeholders can't be used > for any element of a > statement that would prevent the database server > from validating the > statement and creating a query execution plan > for it. For example: > > "SELECT name, age FROM ?" # wrong > (will probably fail) > "SELECT name, ? FROM people" # wrong (but > may not 'fail') > > So apparently the DBD::mysql driver isn't playing by > the same rules as > most of the other DBD drivers, and is just inserting > the binds by itself > at execute time. > > So given that, I couldn't explain why your code > works in one situation and > not the other. > > I would also echo Andy's question about why you need > to create a unique > table in your code. > > -Pete K > -- > Pete Krawczyk > perl at bsod dot net > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From merlyn at stonehenge.com Wed Mar 16 10:37:09 2005 From: merlyn at stonehenge.com (Randal L. Schwartz) Date: Wed Mar 16 10:37:20 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316182622.53247.qmail@web210.biz.mail.re2.yahoo.com> References: <20050316182622.53247.qmail@web210.biz.mail.re2.yahoo.com> Message-ID: <86vf7rphd6.fsf@blue.stonehenge.com> >>>>> "Richard" == Richard Reina writes: Richard> However, not only would Richard> it mean row level locking as more than one user would Richard> need to be updating the table eventhough they are all Richard> working on diff. transactions., Not sure what that means. All records belonging to a user will have a specific transaction ID distinct from any other row. That's a transparent situation, I presume. There's never be two different processes both asking for a row with trans_id = 123, for example. So why have you listed this as a negative? Richard> it would just seem Richard> much cleaner to compile the data for the transaction Richard> as it's own table and discard it when the transaction Richard> is done. Any application that alter the schema on the fly is suspect. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! From wlindsey at blackhatlounge.net Wed Mar 16 17:08:53 2005 From: wlindsey at blackhatlounge.net (Warren Lindsey) Date: Wed Mar 16 17:10:10 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> References: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> Message-ID: <4238D8A5.60307@blackhatlounge.net> Just add another column to a permanent temp table. This applies to any database system. You have to keep track of the temp tables you're creating somehow or else you end up with a system littered with temp tables. There is a huge performance hit for creating new objects in a database (DDL) vs inserting/updating/deleting a row (DML) because space must be allocated and the data-dictionary must be updated. It fragments the tablespaces in your database as you create and drop objects. It breaks your transactional integrity because DDL requires a commit. It becomes very difficult to estimate space usage when objects do not last long, sometimes they are there, sometimes they aren't. It requires the application user to have create and drop privileges that only your application owner should have. But hey, if you're going to do it, do it right :-) Create the table and catch the exception/error if it exists. This let's the database do the work and saves you a trip by not having to lookup whether it exists or not. Same trick applies when inserting a row into a unique/primary key column. Let the database do the work. Richard Reina wrote: >when I run these lines of code : > >my $T_NO = 12569; >use DBI; >my $dbh = >DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > >my $q = "CREATE TABLE IF NOT EXISTS CS_? ( >ID_NO MEDIUMINT, >NAME VARCHAR(30), >TYPE CHAR(1) >)"; >my $sth = $dbh->prepare($q); >$sth->execute($T_NO); > >from w/in a program I get: > >DBD:mysql::st execute failed: You have an error in >your SQL syntax near '12569 ( >ID_NO MEDIUMINT, >NAME VARCHAR(30), >TYP' at line 2 at ./carr_s.pl line 36. > >However if I cut and paste the exact same code and >make it it's own program then execute it, it works >perfectly. Can anyone tell me what's happening and how >I can fix it? > >Thanks, > >Richard > > >_______________________________________________ >Chicago-talk mailing list >Chicago-talk@pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk > > From richard at rushlogistics.com Wed Mar 16 18:50:30 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 16 18:50:42 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <4238D8A5.60307@blackhatlounge.net> Message-ID: <20050317025030.3534.qmail@web208.biz.mail.re2.yahoo.com> Thanks for you comments. I believe I will I put in all in one table afterall. --- Warren Lindsey wrote: > > > There is a huge performance hit for creating new > objects in a database > (DDL) vs inserting/updating/deleting a row (DML) > because space must be > allocated and the data-dictionary must be updated. > It fragments the > tablespaces in your database as you create and drop > objects. It breaks > your transactional integrity because DDL requires a > commit. It becomes > very difficult to estimate space usage when objects > do not last long, > sometimes they are there, sometimes they aren't. It > requires the > application user to have create and drop privileges > that only your > application owner should have. > > But hey, if you're going to do it, do it right :-) > Create the table and > catch the exception/error if it exists. This let's > the database do the > work and saves you a trip by not having to lookup > whether it exists or > not. Same trick applies when inserting a row into a > unique/primary key > column. Let the database do the work. > > Richard Reina wrote: > > >when I run these lines of code : > > > >my $T_NO = 12569; > >use DBI; > >my $dbh = > >DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > > > >my $q = "CREATE TABLE IF NOT EXISTS CS_? ( > >ID_NO MEDIUMINT, > >NAME VARCHAR(30), > >TYPE CHAR(1) > >)"; > >my $sth = $dbh->prepare($q); > >$sth->execute($T_NO); > > > >from w/in a program I get: > > > >DBD:mysql::st execute failed: You have an error in > >your SQL syntax near '12569 ( > >ID_NO MEDIUMINT, > >NAME VARCHAR(30), > >TYP' at line 2 at ./carr_s.pl line 36. > > > >However if I cut and paste the exact same code and > >make it it's own program then execute it, it works > >perfectly. Can anyone tell me what's happening and > how > >I can fix it? > > > >Thanks, > > > >Richard > > > > > >_______________________________________________ > >Chicago-talk mailing list > >Chicago-talk@pm.org > >http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From brian.jameson at pksi.com Thu Mar 17 15:45:33 2005 From: brian.jameson at pksi.com (Brian Jameson) Date: Thu Mar 17 15:45:51 2005 Subject: [Chicago-talk] Perl DBI / OO Development Opportunity / Trading Message-ID: <6.2.1.2.0.20050317173637.05165eb0@pksi.com> Hi All, I am looking to staff multiple positions for a project here in Downtown Chicago. We are looking for strong Perl Developers who have experience with Perl DBI and Sybase SQL. This person will be responsible for developing the data warehouse and developing data parsers/loaders utilizing OO Perl. Our client is a premier financial/trading company and it would also be a great opportunity to utilize your Perl abilities to the fullest. For more details please contact me ASAP. I am looking to have discussions with as many Perl people as possible. Even though you may not be interested/available/etc, I'd like to touch base regardless. All the Best! Brian Jameson Pegasus Knowledge Solutions, Inc. www.pksi.com brian.jameson@pksi.com Office: 312-252-7314 Cell: 847-833-8433 Fax: 847-995-1111 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/chicago-talk/attachments/20050317/9b690556/attachment.htm From zrusilla at mac.com Thu Mar 17 19:31:51 2005 From: zrusilla at mac.com (zrusilla@mac.com) Date: Thu Mar 17 19:32:04 2005 Subject: [Chicago-talk] Pulp Perl In-Reply-To: <20050316171247.GB1150@petdance.com> References: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> <20050316171247.GB1150@petdance.com> Message-ID: <6e1abfb29a4bf803db7f5800e6feed33@mac.com> I've been committing heinous acts of Photoshop abuse. The cover for Andy's testing manifesto. http://www.petdance.com/random/phalanx.jpg Book suggestions for Stas Bekman & Eric Cholet: http://www.petdance.com/random/open-source-sluts.jpg http://www.petdance.com/random/development-dominatrixes.jpg http://www.petdance.com/random/hackers-in-space.jpg Liz Cortell "The female function is to groove, relate, love, be herself, discover, explore, invent, solve problems, crack jokes, make music, all with love. In other words, create a magic world." --Valerie Solanas, S.C.U.M. Manifesto -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 619 bytes Desc: not available Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20050317/474f657d/attachment.bin From andy at petdance.com Thu Mar 17 19:54:43 2005 From: andy at petdance.com (Andy Lester) Date: Thu Mar 17 19:54:56 2005 Subject: [Chicago-talk] Pulp Perl In-Reply-To: <6e1abfb29a4bf803db7f5800e6feed33@mac.com> References: <20050316170117.72822.qmail@web202.biz.mail.re2.yahoo.com> <20050316171247.GB1150@petdance.com> <6e1abfb29a4bf803db7f5800e6feed33@mac.com> Message-ID: <3488976bfcbbfc44e78450b483bb36ad@petdance.com> > The cover for Andy's testing manifesto. > http://www.petdance.com/random/phalanx.jpg > > Book suggestions for Stas Bekman & Eric Cholet: > http://www.petdance.com/random/open-source-sluts.jpg > http://www.petdance.com/random/development-dominatrixes.jpg > http://www.petdance.com/random/hackers-in-space.jpg And she just added: http://petdance.com/random/server-room.jpg -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Thu Mar 17 20:40:20 2005 From: andy at petdance.com (Andy Lester) Date: Thu Mar 17 20:40:32 2005 Subject: [Chicago-talk] Preventing Crisis: How to go from scapegoat to rock star Message-ID: <90a08a6e9e50114ba9e7fc97ab2e157f@petdance.com> The next Chicago Perl Mongers meeting is still getting worked on, but until then, you can come hear my new talk "Preventing Crisis," as I get it ready to go for this summer's soon-to-be-announced Open Source Conference in Portland. It'll be Tuesday, 3/22 at 7pm at the Uniforum meeting at College of DuPage. http://uniforum.chi.il.us/meetings/preventcrisis.html Embarrassing bugs, late-night phone calls and impossible schedules are all crises no one wants, but are all too common. Don't accept them as inevitable: Prevent them! Learn how to change from scapegoat to rock star, and bring back the joy of development. Crisis is always bad, even when you manage to solve the problem. Crisis always reflects poorly on you and your department. It's almost a truism that development crises happen, but you don't have to work in a Dilbertesque hellhole. Crisis prevention must be an integral part of everything you and your department do. You'll learn how to: * Keep management off your back so you can get real work done. * Make honest schedules everyone can live with. * Track your progress effectively to avoid 11th hour rushes. * Stop your project from stalling, or sliding backwards. * Handle change requests without stress. * Go from scapegoats to rock stars. These techniques have all been proven under fire, and draw from a number of methodologies. I hope to see some Mongers there! xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From me at heyjay.com Sat Mar 19 07:43:45 2005 From: me at heyjay.com (Jay Strauss) Date: Sat Mar 19 07:44:00 2005 Subject: [Chicago-talk] Regex question Message-ID: <423C48B1.2000205@heyjay.com> Hi, I want to modify the /etc/skel/.bash_profile file, specifically I want to uncomment the lines: ... # include .bashrc if it exists #if [ -f ~/.bashrc ]; then # . ~/.bashrc #fi ... Removing the comments. so that when I'm done the rest of the file is unchanged but the .bashrc stanza looks like: # include .bashrc if it exists if [ -f ~/.bashrc ]; then . ~/.bashrc fi Is there a way to tell a regex to only search & replace between a certain match? Is there a name for this function that I may read about? thanks Jay From andy at petdance.com Sat Mar 19 07:57:39 2005 From: andy at petdance.com (Andy Lester) Date: Sat Mar 19 07:57:48 2005 Subject: [Chicago-talk] Regex question In-Reply-To: <423C48B1.2000205@heyjay.com> References: <423C48B1.2000205@heyjay.com> Message-ID: <99020f304d4457cae3df25e51e1daea6@petdance.com> > Is there a way to tell a regex to only search & replace between a > certain match? Is there a name for this function that I may read > about? Yes, look for the "flip-flop" operator, where it's roughly if ( /regex1/../regex2/ ) { # do something } It's taken directly from Awk. xao -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Sat Mar 19 12:23:58 2005 From: andy at petdance.com (Andy Lester) Date: Sat Mar 19 12:24:12 2005 Subject: [Chicago-talk] Yet Another Perl Conference, North America, 2005 Registration now open Message-ID: <20050319202358.GA14203@petdance.com> Registration for YAPC now open. I'm going, along with Amy & Quinn. Pete Krawczyk threatens to go as well. I expect I'll be giving a talk or two, although presentation deadline hasn't passed yet. It's $85 dollars. That's $85, not $850 or $8,500. At a price like that, you can't go wrong. xoxo, Andy ----------> Yet Another Perl Conference, North America, 2005 Registration now open. Conference dates: Monday - Wednesday 27 - 29 June 2005 Location: 89 Chestnut Street http://89chestnut.com/ University of Toronto Toronto, Ontario, Canada Info at: http://yapc.org/America Direct registration: http://donate.perlfoundation.org/index.pl?node=registrant%20info&conference_id=423 Full registration fee $85 (USD) Book now for great deals on accommodations and ensure a space for yourself. Speaking slots are still open. If you would like to present at YAPC::NA 2005, see: http://yapc.org/America/cfp-2005.shtml Details of this announcement: http://yapc.org/America/registration-announcement-2005.txt <---------- More Details ============ Registration for YAPC::NA (Yet Another Perl Conference, North America) 2005 in Toronto, Ontario, Canada is now open. The conference registration price is USD$85. This price includes admission to all aspects of the conference, respectable amounts of catering, several activities and a few conference goodies. The YAPC North America 2005 conference features... * Fantastic speakers + most are the core creators of the technology on which they present + many are professional IT authors, trainers and conference speakers * An excellent learning opportunity * A chance to meet Perl professionals from all over North America and the world + YAPC attendees tend to be very involved in Perl and so are another great way to learn more about what the language has to offer beyond just what the speakers have to say * Extra-curricular / after hours activities * A great location in downtown Toronto All this, and the price is more than an order of magnitude cheaper than what commercial conferences can offer. This is because YAPC is a 100% volunteer effort, both from its organizers and its speakers. Quality is *not* sacrificed to achieve this stunning level of affordability. YAPC provides the best value-for-dollar in IT conferences. And it's a ton of fun, too. The dates of the conference are Monday - Wednesday 27-29 June 2005. The location is 89 Chestnut Street in downtown Toronto, Ontario, Canada. (Note that a different date block was previously announced; we moved the conference date to accommodate venue availability.) http://89chestnut.com/ -- a facility within the University of Toronto If you are at all interested in attending the conference... Book now! Book now! Book now! We have room for about 400 attendees and we hope to sell out well in advance of the late June conference date. However, the critical matter is that of hotels. The YAPC::NA 2005 organizers have made group arrangements with several facilities around the city to provide _excellent_ quality accommodations in _very_ convenient locations at _terrific_ prices for the _full_ capacity of conference attendees (around 400 people). (Finding, booking and paying accommodations is the responsibility of the attendees, but we will provide you with a list of the hotels and university dorms to try first based on our group arrangement with them when you register for the conference. Also, see the web site at http://yapc.org/America/accommodations-2005.shtml. More details will be up shortly. The dorm option will be approx. C$55/night, the hotel options will be more like C$90/night, and for slightly different prices there will be options for putting more than 1 person in a room. Exact details and how to book will be emailed directly to people who have registered for the conference as soon as they become available.) *The catch is -- book now!!* The group reservations will expire in early May, at which point in time the group rates will mostly still apply, but the rooms will be given out on an "availability basis". Which means that someone else outside of the YAPC group can book the rooms as well. Make no mistake -- the rooms *will* be sold. Toronto is a very active conference city in the summer and there will be _no_ guarantee of vacancies either at the facilities we made arrangements with or anywhere else in the city if you leave it to within 6 weeks of the conference date. So, if you want to save yourself the likely-fruitless headache of scrambling around looking for accommodations at the last minute, Book now! Book now! Book now! Have any questions? Email na-help@yapc.org for more details. Additionally, we are still welcoming submissions for proposals via: http://yapc.org/America/cfp-2005.shtml The close of the call-for-papers is April 18, 2005 at 11:59 pm (Toronto time). If you have any questions regarding the call-for-papers or speaking at YAPC::NA 2005 please email na-author@yapc.org We would love to hear from potential sponsors. Please contact the organizers at na-sponsor@yapc.org to learn about the benefits of sponsorship. ----- End forwarded message ----- -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From glim at mycybernet.net Sat Mar 19 11:57:00 2005 From: glim at mycybernet.net (glim@mycybernet.net) Date: Sat Mar 19 12:24:46 2005 Subject: [Chicago-talk] Yet Another Perl Conference, North America, 2005 Registration now open Message-ID: ----------> Yet Another Perl Conference, North America, 2005 Registration now open. Conference dates: Monday - Wednesday 27 - 29 June 2005 Location: 89 Chestnut Street http://89chestnut.com/ University of Toronto Toronto, Ontario, Canada Info at: http://yapc.org/America Direct registration: http://donate.perlfoundation.org/index.pl?node=registrant%20info&conference_id=423 Full registration fee $85 (USD) Book now for great deals on accommodations and ensure a space for yourself. Speaking slots are still open. If you would like to present at YAPC::NA 2005, see: http://yapc.org/America/cfp-2005.shtml Details of this announcement: http://yapc.org/America/registration-announcement-2005.txt <---------- More Details ============ Registration for YAPC::NA (Yet Another Perl Conference, North America) 2005 in Toronto, Ontario, Canada is now open. The conference registration price is USD$85. This price includes admission to all aspects of the conference, respectable amounts of catering, several activities and a few conference goodies. The YAPC North America 2005 conference features... * Fantastic speakers + most are the core creators of the technology on which they present + many are professional IT authors, trainers and conference speakers * An excellent learning opportunity * A chance to meet Perl professionals from all over North America and the world + YAPC attendees tend to be very involved in Perl and so are another great way to learn more about what the language has to offer beyond just what the speakers have to say * Extra-curricular / after hours activities * A great location in downtown Toronto All this, and the price is more than an order of magnitude cheaper than what commercial conferences can offer. This is because YAPC is a 100% volunteer effort, both from its organizers and its speakers. Quality is *not* sacrificed to achieve this stunning level of affordability. YAPC provides the best value-for-dollar in IT conferences. And it's a ton of fun, too. The dates of the conference are Monday - Wednesday 27-29 June 2005. The location is 89 Chestnut Street in downtown Toronto, Ontario, Canada. (Note that a different date block was previously announced; we moved the conference date to accommodate venue availability.) http://89chestnut.com/ -- a facility within the University of Toronto If you are at all interested in attending the conference... Book now! Book now! Book now! We have room for about 400 attendees and we hope to sell out well in advance of the late June conference date. However, the critical matter is that of hotels. The YAPC::NA 2005 organizers have made group arrangements with several facilities around the city to provide _excellent_ quality accommodations in _very_ convenient locations at _terrific_ prices for the _full_ capacity of conference attendees (around 400 people). (Finding, booking and paying accommodations is the responsibility of the attendees, but we will provide you with a list of the hotels and university dorms to try first based on our group arrangement with them when you register for the conference. Also, see the web site at http://yapc.org/America/accommodations-2005.shtml. More details will be up shortly. The dorm option will be approx. C$55/night, the hotel options will be more like C$90/night, and for slightly different prices there will be options for putting more than 1 person in a room. Exact details and how to book will be emailed directly to people who have registered for the conference as soon as they become available.) *The catch is -- book now!!* The group reservations will expire in early May, at which point in time the group rates will mostly still apply, but the rooms will be given out on an "availability basis". Which means that someone else outside of the YAPC group can book the rooms as well. Make no mistake -- the rooms *will* be sold. Toronto is a very active conference city in the summer and there will be _no_ guarantee of vacancies either at the facilities we made arrangements with or anywhere else in the city if you leave it to within 6 weeks of the conference date. So, if you want to save yourself the likely-fruitless headache of scrambling around looking for accommodations at the last minute, Book now! Book now! Book now! Have any questions? Email na-help@yapc.org for more details. Additionally, we are still welcoming submissions for proposals via: http://yapc.org/America/cfp-2005.shtml The close of the call-for-papers is April 18, 2005 at 11:59 pm (Toronto time). If you have any questions regarding the call-for-papers or speaking at YAPC::NA 2005 please email na-author@yapc.org We would love to hear from potential sponsors. Please contact the organizers at na-sponsor@yapc.org to learn about the benefits of sponsorship. From me at heyjay.com Sat Mar 19 12:52:34 2005 From: me at heyjay.com (Jay Strauss) Date: Sat Mar 19 12:52:52 2005 Subject: [Chicago-talk] Regex question In-Reply-To: <99020f304d4457cae3df25e51e1daea6@petdance.com> References: <423C48B1.2000205@heyjay.com> <99020f304d4457cae3df25e51e1daea6@petdance.com> Message-ID: <423C9112.9050801@heyjay.com> Andy Lester wrote: >> Is there a way to tell a regex to only search & replace between a >> certain match? Is there a name for this function that I may read about? > > > Yes, look for the "flip-flop" operator, where it's roughly > > if ( /regex1/../regex2/ ) { > # do something > } > > It's taken directly from Awk. > > xao > Thanks, that's perfect Jay From richard at rushlogistics.com Sun Mar 20 18:00:39 2005 From: richard at rushlogistics.com (Richard Reina) Date: Sun Mar 20 18:00:50 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <4238D8A5.60307@blackhatlounge.net> Message-ID: <20050321020039.98430.qmail@web201.biz.mail.re2.yahoo.com> Warren, Thanks very much the reply. In the end I thought it best to make one permanent table. Thanks again, Richard --- Warren Lindsey wrote: > Just add another column to a permanent temp table. > This applies to any > database system. You have to keep track of the temp > tables you're > creating somehow or else you end up with a system > littered with temp tables. > > There is a huge performance hit for creating new > objects in a database > (DDL) vs inserting/updating/deleting a row (DML) > because space must be > allocated and the data-dictionary must be updated. > It fragments the > tablespaces in your database as you create and drop > objects. It breaks > your transactional integrity because DDL requires a > commit. It becomes > very difficult to estimate space usage when objects > do not last long, > sometimes they are there, sometimes they aren't. It > requires the > application user to have create and drop privileges > that only your > application owner should have. > > But hey, if you're going to do it, do it right :-) > Create the table and > catch the exception/error if it exists. This let's > the database do the > work and saves you a trip by not having to lookup > whether it exists or > not. Same trick applies when inserting a row into a > unique/primary key > column. Let the database do the work. > > Richard Reina wrote: > > >when I run these lines of code : > > > >my $T_NO = 12569; > >use DBI; > >my $dbh = > >DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); > > > >my $q = "CREATE TABLE IF NOT EXISTS CS_? ( > >ID_NO MEDIUMINT, > >NAME VARCHAR(30), > >TYPE CHAR(1) > >)"; > >my $sth = $dbh->prepare($q); > >$sth->execute($T_NO); > > > >from w/in a program I get: > > > >DBD:mysql::st execute failed: You have an error in > >your SQL syntax near '12569 ( > >ID_NO MEDIUMINT, > >NAME VARCHAR(30), > >TYP' at line 2 at ./carr_s.pl line 36. > > > >However if I cut and paste the exact same code and > >make it it's own program then execute it, it works > >perfectly. Can anyone tell me what's happening and > how > >I can fix it? > > > >Thanks, > > > >Richard > > > > > >_______________________________________________ > >Chicago-talk mailing list > >Chicago-talk@pm.org > >http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From wlindsey at blackhatlounge.net Mon Mar 21 18:48:57 2005 From: wlindsey at blackhatlounge.net (Warren Lindsey) Date: Mon Mar 21 18:49:25 2005 Subject: [Chicago-talk] perl DBI ? In-Reply-To: <20050321020039.98430.qmail@web201.biz.mail.re2.yahoo.com> References: <20050321020039.98430.qmail@web201.biz.mail.re2.yahoo.com> Message-ID: <423F8799.6070108@blackhatlounge.net> DBAs around the world smile upon your decision :-) Richard Reina wrote: >Warren, > >Thanks very much the reply. In the end I thought it >best to make one permanent table. > >Thanks again, > >Richard >--- Warren Lindsey >wrote: > > > >>Just add another column to a permanent temp table. >>This applies to any >>database system. You have to keep track of the temp >>tables you're >>creating somehow or else you end up with a system >>littered with temp tables. >> >>There is a huge performance hit for creating new >>objects in a database >>(DDL) vs inserting/updating/deleting a row (DML) >>because space must be >>allocated and the data-dictionary must be updated. >>It fragments the >>tablespaces in your database as you create and drop >>objects. It breaks >>your transactional integrity because DDL requires a >>commit. It becomes >>very difficult to estimate space usage when objects >>do not last long, >>sometimes they are there, sometimes they aren't. It >>requires the >>application user to have create and drop privileges >>that only your >>application owner should have. >> >>But hey, if you're going to do it, do it right :-) >>Create the table and >>catch the exception/error if it exists. This let's >>the database do the >>work and saves you a trip by not having to lookup >>whether it exists or >>not. Same trick applies when inserting a row into a >>unique/primary key >>column. Let the database do the work. >> >>Richard Reina wrote: >> >> >> >>>when I run these lines of code : >>> >>>my $T_NO = 12569; >>>use DBI; >>>my $dbh = >>> >>> >>DBI->connect("DBI:mysql:database=carr_search;192.168.0.1",user,password); >> >> >>>my $q = "CREATE TABLE IF NOT EXISTS CS_? ( >>>ID_NO MEDIUMINT, >>>NAME VARCHAR(30), >>>TYPE CHAR(1) >>>)"; >>>my $sth = $dbh->prepare($q); >>>$sth->execute($T_NO); >>> >>> >>> >>>from w/in a program I get: >> >> >>>DBD:mysql::st execute failed: You have an error in >>>your SQL syntax near '12569 ( >>>ID_NO MEDIUMINT, >>>NAME VARCHAR(30), >>>TYP' at line 2 at ./carr_s.pl line 36. >>> >>>However if I cut and paste the exact same code and >>>make it it's own program then execute it, it works >>>perfectly. Can anyone tell me what's happening and >>> >>> >>how >> >> >>>I can fix it? >>> >>>Thanks, >>> >>>Richard >>> >>> >>>_______________________________________________ >>>Chicago-talk mailing list >>>Chicago-talk@pm.org >>>http://mail.pm.org/mailman/listinfo/chicago-talk >>> >>> >>> >>> >>_______________________________________________ >>Chicago-talk mailing list >>Chicago-talk@pm.org >>http://mail.pm.org/mailman/listinfo/chicago-talk >> >> >> > >_______________________________________________ >Chicago-talk mailing list >Chicago-talk@pm.org >http://mail.pm.org/mailman/listinfo/chicago-talk > > From andy at petdance.com Mon Mar 21 20:15:41 2005 From: andy at petdance.com (Andy Lester) Date: Mon Mar 21 20:15:48 2005 Subject: [Chicago-talk] Tuesday's Uniforum meeting Message-ID: <10f8d22d4962e6c0527e881497eaa141@petdance.com> Please note that Tuesday's Uniforum meeting (my "How to run a sane software shop" talk) is NOT going to be at COD. It's close, but not at COD. It will be at the IIT Glen Ellyn campus. http://www.uniforum.chi.il.us/meetings/preventcrisis.html Also, I have so much swag saved up from the last couple of months (many Hacks books, issues of the new O'Reilly magazine Make, etc) there'll be lots of goodies to give away. See you there! -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Tue Mar 22 13:13:14 2005 From: andy at petdance.com (Andy Lester) Date: Tue Mar 22 13:13:27 2005 Subject: [Chicago-talk] Tonight's Uniforum talk Message-ID: <20050322211314.GC8515@petdance.com> If you go to the Uniforum talk tonight, not ONLY will you get to hear my EXTREMELY EXCITING talk, AND get a chance to win some good swag, you'll ALSO might get to thumb through a copy of a draft of Damian Conway's new book. Maybe. xoxo, Andy -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From adam at battleaxe.net Tue Mar 22 14:41:00 2005 From: adam at battleaxe.net (Adam Israel) Date: Tue Mar 22 14:41:10 2005 Subject: [Chicago-talk] Tonight's Uniforum talk In-Reply-To: <20050322211314.GC8515@petdance.com> References: <20050322211314.GC8515@petdance.com> Message-ID: <42409EFC.7060308@battleaxe.net> Well, I'll be there. The things I'll do for swag ;) -Adam Andy Lester wrote: >If you go to the Uniforum talk tonight, not ONLY will you get to hear >my EXTREMELY EXCITING talk, AND get a chance to win some good swag, >you'll ALSO might get to thumb through a copy of a draft of Damian >Conway's new book. > >Maybe. > >xoxo, >Andy > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 256 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20050322/091e985b/signature.bin From stigliz at gmail.com Tue Mar 22 14:56:11 2005 From: stigliz at gmail.com (Amedeo Guffanti) Date: Tue Mar 22 14:56:19 2005 Subject: [Chicago-talk] Reseach on Open Source Developers Message-ID: Hi, I'm Amedeo Guffanti, a 22 years old Italian student at Bocconi university in Milan, I' m doing a research to write a work about Open Source Movement, in particular, about the developers. I try to collect the opinions of developers like you. My little poll is at this page : http://www.alberocavo.com/OSSprojects.asp It takes less then 4 minutes. I hope the Open Source Communities will give me a help for my research. I apologize for taking your time and for my English that I hope it's understandable ^^ Sincerly, Amedeo Guffanti From lembark at wrkhors.com Tue Mar 22 20:36:17 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Tue Mar 22 20:34:57 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <1756E9E0E434733D5E9DC340@[192.168.1.2]> -- Richard Reina > I know there's a handy $< to find the UID of the user > executing the prorgram. Is there any handy operator > to find the IP address of the local machine that is > running the program. If you know the interface name it's not at all difficult to parse ifconfig's output: x qx(/sbin/ifconfig eth0) =~ /inet addr:(\S+)/ 0 '192.168.1.2' If you're writing local code then the interface name is a reasonable guess. For the general case you can use: DB<5> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet addr:(\S+)/g 0 '192.168.1.2' 1 '192.168.15.2' 2 '127.0.0.1' And pick the one that seems most useful (e.g. the lowest subnet). If all of your hosts are singly-homed (which the example above is NOT) then filtering out 127.0.0.1 works. In most cases you know the subnet you're ineterested in and can search for that: DB<6> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet addr:(192.168.\S+)/g 0 '192.168.1.2' 1 '192.168.15.2' Which would give you a single value on most systems (this was run in perl -d on a basion host with DMZ and LAN interfaces). -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From lembark at wrkhors.com Tue Mar 22 20:36:17 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Tue Mar 22 20:35:00 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> References: <20050315161623.22322.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <1756E9E0E434733D5E9DC340@[192.168.1.2]> -- Richard Reina > I know there's a handy $< to find the UID of the user > executing the prorgram. Is there any handy operator > to find the IP address of the local machine that is > running the program. If you know the interface name it's not at all difficult to parse ifconfig's output: x qx(/sbin/ifconfig eth0) =~ /inet addr:(\S+)/ 0 '192.168.1.2' If you're writing local code then the interface name is a reasonable guess. For the general case you can use: DB<5> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet addr:(\S+)/g 0 '192.168.1.2' 1 '192.168.15.2' 2 '127.0.0.1' And pick the one that seems most useful (e.g. the lowest subnet). If all of your hosts are singly-homed (which the example above is NOT) then filtering out 127.0.0.1 works. In most cases you know the subnet you're ineterested in and can search for that: DB<6> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet addr:(192.168.\S+)/g 0 '192.168.1.2' 1 '192.168.15.2' Which would give you a single value on most systems (this was run in perl -d on a basion host with DMZ and LAN interfaces). -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From richard at rushlogistics.com Wed Mar 23 04:56:00 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 23 04:56:14 2005 Subject: [Chicago-talk] Any handy operators for finding the local IP? In-Reply-To: <1756E9E0E434733D5E9DC340@[192.168.1.2]> Message-ID: <20050323125600.11728.qmail@web207.biz.mail.re2.yahoo.com> Steve, Thanks that code seems a lot more of a foolproof than the hostname function that I am using now. I'll give it a try. Thanks again. Hope you are well. Hows NY? Richard --- Steven Lembark wrote: > > > -- Richard Reina > > > I know there's a handy $< to find the UID of the > user > > executing the prorgram. Is there any handy > operator > > to find the IP address of the local machine that > is > > running the program. > > If you know the interface name it's not at all > difficult > to parse ifconfig's output: > > x qx(/sbin/ifconfig eth0) =~ /inet addr:(\S+)/ > 0 '192.168.1.2' > > If you're writing local code then the interface name > is a reasonable guess. For the general case you can > use: > > DB<5> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet > addr:(\S+)/g > 0 '192.168.1.2' > 1 '192.168.15.2' > 2 '127.0.0.1' > > And pick the one that seems most useful (e.g. the > lowest subnet). > > If all of your hosts are singly-homed (which the > example > above is NOT) then filtering out 127.0.0.1 works. In > most > cases you know the subnet you're ineterested in and > can > search for that: > > DB<6> x ( $a = qx( /sbin/ifconfig ) ) =~ /inet > addr:(192.168.\S+)/g > 0 '192.168.1.2' > 1 '192.168.15.2' > > Which would give you a single value on most systems > (this > was run in perl -d on a basion host with DMZ and LAN > interfaces). > > > > -- > Steven Lembark > 85-09 90th Street > Workhorse Computing > Woodhaven, NY 11421 > lembark@wrkhors.com > 1 888 359 3508 > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Wed Mar 23 17:33:07 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 23 17:33:16 2005 Subject: [Chicago-talk] Anyone help installing a perl module? Message-ID: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> I'm having problems installing GD-2.23 on Fedora Core 3. It compiles perfect but blows up at make test. My gd version is gd-2.0.33 and I did not change any of the install directories ( I went strictly with the defaults ). I also installed ( in the following order ): zlib-1.2.2. libpng-1.2.8 gd-2.0.33 This is my make test output: [root@localhost GD-2.23]# make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/GD..........Can't load './blib/arch/auto/GD/GD.so' for module GD: ./blib/arch/auto/GD/GD.so: undefined symbol: gdImageGifAnimAddPtr at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230. at t/GD.t line 14 Compilation failed in require at t/GD.t line 14. BEGIN failed--compilation aborted at t/GD.t line 14. t/GD..........dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 1-12 Failed 12/12 tests, 0.00% okay t/Polyline....Can't load '/usr/local/src/rushclient/GD-2.23/blib/arch/auto/GD/GD.so' for module GD: /usr/local/src/rushclient/GD-2.23/blib/arch/auto/GD/GD.so: undefined symbol: gdImageGifAnimAddPtr at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230. at GD/Polyline.pm line 45 Compilation failed in require at GD/Polyline.pm line 45. BEGIN failed--compilation aborted at GD/Polyline.pm line 45. Compilation failed in require at t/Polyline.t line 10. BEGIN failed--compilation aborted at t/Polyline.t line 10. t/Polyline....dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/GD.t 255 65280 12 23 191.67% 1-12 t/Polyline.t 255 65280 1 2 200.00% 1 Failed 2/2 test scripts, 0.00% okay. 13/13 subtests failed, 0.00% okay. make: *** [test_dynamic] Error 255 If you would help me I would be very greatful. Thanks, Richard Reina Delete Reply Forward Move... Previous | Next | Back to Messages From andy at petdance.com Wed Mar 23 18:55:41 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 23 18:55:52 2005 Subject: [Chicago-talk] Anyone help installing a perl module? In-Reply-To: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> References: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> Message-ID: > It compiles perfect but blows up at make test. That's because the compilation doesn't actually load the library to use. It's the test that tries to pull it in. Here's how we build it on our dev server: alester@blitz[/usr/src]$ cat config.GD #!/bin/sh perl Makefile.PL -lib_gd_path="/usr/local/lib" -options="PNG" If you don't keep configs in a config.whatever file in your /usr/src directory, do so. You WILL need them again. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From andy at petdance.com Wed Mar 23 18:55:41 2005 From: andy at petdance.com (Andy Lester) Date: Wed Mar 23 18:55:53 2005 Subject: [Chicago-talk] Anyone help installing a perl module? In-Reply-To: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> References: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> Message-ID: > It compiles perfect but blows up at make test. That's because the compilation doesn't actually load the library to use. It's the test that tries to pull it in. Here's how we build it on our dev server: alester@blitz[/usr/src]$ cat config.GD #!/bin/sh perl Makefile.PL -lib_gd_path="/usr/local/lib" -options="PNG" If you don't keep configs in a config.whatever file in your /usr/src directory, do so. You WILL need them again. xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From richard at rushlogistics.com Thu Mar 24 10:55:17 2005 From: richard at rushlogistics.com (Richard Reina) Date: Thu Mar 24 10:55:32 2005 Subject: [Chicago-talk] Anyone help installing a perl module? In-Reply-To: Message-ID: <20050324185518.36627.qmail@web208.biz.mail.re2.yahoo.com> --- Andy Lester wrote: > > It compiles perfect but blows up at make test. > > That's because the compilation doesn't actually load > the library to > use. It's the test that tries to pull it in. > > Here's how we build it on our dev server: > > alester@blitz[/usr/src]$ cat config.GD > #!/bin/sh > > perl Makefile.PL -lib_gd_path="/usr/local/lib" > -options="PNG" > > If you don't keep configs in a config.whatever file > in your /usr/src > directory, do so. You WILL need them again. > > That was perfect. Thanks a lot! I owe you a beer next time I see you. Richard From jkeen at verizon.net Thu Mar 24 16:00:02 2005 From: jkeen at verizon.net (James Keenan) Date: Thu Mar 24 16:00:18 2005 Subject: [Chicago-talk] Anyone help installing a perl module? In-Reply-To: References: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> Message-ID: On Mar 23, 2005, at 9:55 PM, Andy Lester wrote: > Here's how we build it on our dev server: > > alester@blitz[/usr/src]$ cat config.GD > #!/bin/sh > > perl Makefile.PL -lib_gd_path="/usr/local/lib" -options="PNG" > > If you don't keep configs in a config.whatever file in your /usr/src > directory, do so. You WILL need them again. > Andy: For what percentage of your modules do you maintain such a config file? Or, perhaps better put, what are the characteristics of modules that merit such a config file? Thanks. jimk From andy at petdance.com Thu Mar 24 19:27:07 2005 From: andy at petdance.com (Andy Lester) Date: Thu Mar 24 19:27:22 2005 Subject: [Chicago-talk] Anyone help installing a perl module? In-Reply-To: References: <20050324013307.91806.qmail@web205.biz.mail.re2.yahoo.com> Message-ID: >> > Andy: For what percentage of your modules do you maintain such a > config file? > > Or, perhaps better put, what are the characteristics of modules that > merit such a config file? Anything beyond "perl Makefile.PL" xoa -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From thomasoniii at gmail.com Sat Mar 26 13:11:45 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Sat Mar 26 13:11:55 2005 Subject: [Chicago-talk] Basset on CPAN Message-ID: <5cfdfaf7050326131158331ec3@mail.gmail.com> For those of you that might've been interested, I've finally gotten off of my duff and uploaded my Basset framework onto CPAN (at least, the core stuff. More modules are on http://www.bassetsoftware.com/) Basset is the OO framework that I've been developing for the past 2 years or so (with bits of it being around 6 years old, by this point), so it's reasonably established. I open sourced it last year, but never got around to putting it on CPAN, mainly since I wanted a better installer. I still need a better installer, but I figured that since I haven't done it yet, I wasn't gonna do it any time soon, so I bit the bullet and released it as is. Just means that you need to manage the conf file location by hand, really. I'll actually make a prettier configulator at some point. Honest. Please do kick the tires. -Jim.... From me at heyjay.com Sat Mar 26 14:31:06 2005 From: me at heyjay.com (Jay Strauss) Date: Sat Mar 26 14:31:15 2005 Subject: [Chicago-talk] Jonathan Steinert - You got your ears on? Message-ID: <4245E2AA.7000000@heyjay.com> Jon, When you presented POE last year, you have a nice long example of a POE script. But that script is not on the Chicago Perl website. Do you still have it? Thanks Jay From richard at rushlogistics.com Sat Mar 26 17:10:49 2005 From: richard at rushlogistics.com (Richard Reina) Date: Sat Mar 26 17:10:58 2005 Subject: [Chicago-talk] writing log files to a DB Message-ID: <20050327011049.49144.qmail@web207.biz.mail.re2.yahoo.com> I wrote a simple script that reads an application's log file and dumps it into a database table. Like this: @ARGV = "log_files"; while (<>) { my ($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, $dur) = split(",",$_); my $q = "REPLACE INTO master_log VALUES (?,?,?,?,?,?,?,?)"; my $sth = $dbh->prepare($q); $sth->execute($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, $dur); } This seems inefficient because it reinserts the whole file each time it's run and the file keeps getting larger. So I was going to change so that it first gets the timestamp value of the last record in the table and then only starts inserting the the lines/values after thet record in file. Like this: while (<>) { my ($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, $dur) = split(",",$_); while ($timestamp > $TS) { my $q = "REPLACE INTO master_log VALUES (?,?,?,?,?,?,?,?)"; my $sth = $dbh->prepare($q); $sth->execute($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, $dur); } } Is this the most efficient way of writing a script like this? From me at heyjay.com Sat Mar 26 22:05:17 2005 From: me at heyjay.com (Jay Strauss) Date: Sat Mar 26 21:54:47 2005 Subject: [Chicago-talk] writing log files to a DB References: <20050327011049.49144.qmail@web207.biz.mail.re2.yahoo.com> Message-ID: <001b01c53292$f8bb84e0$6405a8c0@washington> you shouldn't prepare your statement in every iteration of the loop, that's a big database killer. Why don't you sort your input file by timestamp decending (hi -> lo), then insert while your timestamp from the file is >= the max(timestamp) in your database. Sorta like: sort -r -n -t, --key=7,7 log_files | perl your_file.pl #cat your_file.pl my $q = "REPLACE INTO master_log VALUES (?,?,?,?,?,?,?,?)"; my $sth = $dbh->prepare($q); $TS # Populate this with a select max(timestamp) from your db while (<>) { my ($src, $dsc, $clid, $chn, $PU, $HU, $timestamp,$dur) = split(",",$_); exit if $TS > $timestamp; $sth->execute($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, $dur); } Jay From richard at rushlogistics.com Sun Mar 27 18:26:37 2005 From: richard at rushlogistics.com (Richard Reina) Date: Sun Mar 27 18:26:48 2005 Subject: [Chicago-talk] writing log files to a DB In-Reply-To: <001b01c53292$f8bb84e0$6405a8c0@washington> Message-ID: <20050328022638.87720.qmail@web204.biz.mail.re2.yahoo.com> Jay, Thank you very much for your response. --- Jay Strauss wrote: > you shouldn't prepare your statement in every > iteration of the loop, > that's a big database killer. This is obviosly very good advice and something I should have noticed. I will make that change immediately. > > Why don't you sort your input file by timestamp > decending (hi -> lo), > then insert while your timestamp from the file is >= > the max(timestamp) > in your database. Sorta like: > > sort -r -n -t, --key=7,7 log_files | perl > your_file.pl > > #cat your_file.pl > > my $q = "REPLACE INTO master_log VALUES > (?,?,?,?,?,?,?,?)"; > my $sth = $dbh->prepare($q); > > $TS # Populate this with a select max(timestamp) > from your db > > while (<>) { > > my ($src, $dsc, $clid, $chn, $PU, $HU, > $timestamp,$dur) = > split(",",$_); > > exit if $TS > $timestamp; > > $sth->execute($src, $dsc, $clid, $chn, $PU, $HU, > $timestamp, $dur); > > } > > Jay > If I understand this correctly, this begins to enter entries in the file from newest to older until it comes to an entry that was already in the table and stops. Am I understanding it correctly? Does it then put the entries/records in the table from oldest newest to oldest? Does this matter? Do I need to index the file? > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From lembark at wrkhors.com Sun Mar 27 21:47:23 2005 From: lembark at wrkhors.com (Steven Lembark) Date: Sun Mar 27 21:45:36 2005 Subject: [Chicago-talk] writing log files to a DB In-Reply-To: <20050327011049.49144.qmail@web207.biz.mail.re2.yahoo.com> References: <20050327011049.49144.qmail@web207.biz.mail.re2.yahoo.com> Message-ID: > @ARGV = "log_files"; > while (<>) { > > my ($src, $dsc, $clid, $chn, $PU, $HU, $timestamp, > $dur) = split(",",$_); > > my $q = "REPLACE INTO master_log VALUES > (?,?,?,?,?,?,?,?)"; > my $sth = $dbh->prepare($q); > $sth->execute($src, $dsc, $clid, $chn, $PU, $HU, > $timestamp, $dur); > } > > This seems inefficient because it reinserts the whole > file each time it's run and the file keeps getting > larger. So I was going to change so that it first gets Use a decent keyspace in the database, one that includes a timestamp, and the duplicate records will be rejected. Given that this is a single-user application, you don't have to be [too] paranoid about logic races. In that case you can just "select max(timestamp) from tablename" and only commit records newer than the timestamp - 1 sec. The simplest fix is to insert the stuff into a scratch table that is emptied prior to each use. You then insert into the permenant table where temp table's timestamp is >= max(timestamp) from the real table. That leaves your DBI running quickly and the database dealing with the messiest part in bulk (vs. record-by-record). If the logging can have a sequence number then use that instead of a timestamp. If you're doing much more of this I'd strongly suggest C J. Date, _An Introduction to Database Systems_ -- last I saw it was up to the 7th edition, though for your stuff anything from the 5th on up will do nicely. -- Steven Lembark 85-09 90th Street Workhorse Computing Woodhaven, NY 11421 lembark@wrkhors.com 1 888 359 3508 From richard at rushlogistics.com Mon Mar 28 05:24:52 2005 From: richard at rushlogistics.com (Richard Reina) Date: Mon Mar 28 05:25:00 2005 Subject: [Chicago-talk] transl. php to perl? Message-ID: <20050328132452.12551.qmail@web209.biz.mail.re2.yahoo.com> perl is the only language I know, and even that is debatable. So any of you know enogh php to help me translate the script below? I know which lines are the comments that's about it. #!/usr/bin/php4 -q References: <20050328132452.12551.qmail@web209.biz.mail.re2.yahoo.com> Message-ID: <1112017828.20201.5.camel@localhost.localdomain> Ahh agi. Perhaps you should look for Asterisk::AGI. It does all this work for you ;). But anyways, here goes... #!/usr/bin/perl use strict; use warnings; my $debug = 0; my %agi = (); while() { chomp; # get a line from stdin and put it into $_ last unless $_; # exit early if $_ is empty print "read: $_\n" if $debug; my ($var, $value) = split /: /; # split $_ into two parts $var =~ s/^agi_//; # strip off agi_ prefix $value =~ s/\s*(.*?)\s*/$1/; # trim $value $agi{$var} = $value; # save value } On Mon, 2005-03-28 at 05:24 -0800, Richard Reina wrote: > perl is the only language I know, and even that is > debatable. So any of you know enogh php to help me > translate the script below? I know which lines are the > comments that's about it. > > > #!/usr/bin/php4 -q > ob_implicit_flush(true); > set_time_limit(6); > $in = fopen("php://stdin","r"); > $stdlog = fopen("/var/log/asterisk/my_agi.log", "w"); > // toggle debugging output (more verbose) > $debug = false; > // Do function definitions before we start the main > loop > function read() { > global $in, $debug, $stdlog; > $input = str_replace("\n", "", fgets($in, 4096)); > if ($debug) fputs($stdlog, "read: $input\n"); > return $input; > } > > // parse agi headers into array > while ($env=read()) { > $s = split(": ",$env); > $agi[str_replace("agi_","",$s[0])] = trim($s[1]); > if (($env == "") || ($env == "\n")) { > break; > } > } > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From me at heyjay.com Mon Mar 28 06:16:40 2005 From: me at heyjay.com (Jay Strauss) Date: Mon Mar 28 06:16:50 2005 Subject: [Chicago-talk] writing log files to a DB In-Reply-To: <20050328022638.87720.qmail@web204.biz.mail.re2.yahoo.com> References: <20050328022638.87720.qmail@web204.biz.mail.re2.yahoo.com> Message-ID: <424811C8.7080604@heyjay.com> > If I understand this correctly, this begins to enter > entries in the file from newest to older until it > comes to an entry that was already in the table and > stops. Am I understanding it correctly? > > Does it then put the entries/records in the table from > oldest newest to oldest? Does this matter? Do I need > to index the file? Your database does not guarantee the order of rows returned, unless you specifically ask for them to be sequenced (via order by). So it shouldn't matter what order you insert the rows. Without knowing anything about your database I can't tell you what indexes you may or may not need. But in general indexes help you find rows fast, when constraining (in the where clause) by the columns in the index. Same thing goes with when querying with an "order by". Steve makes a couple of points that are important. You probably want to build a unique constraint on some set of columns of this table that uniquely identify the rows. That is, there are some subset of the columns in this table, that when used in combination, make each row unique. This set of columns it commonly called the "primary key", you typically have a primary key on every table. You should go thru the exercise of identifying them. Also the idea of a scratch/temp table moves the duplicate checking out of your perl. Though the sql to move the data from the scratch table to the real table becomes more complicated From richard at rushlogistics.com Mon Mar 28 08:02:16 2005 From: richard at rushlogistics.com (Richard Reina) Date: Mon Mar 28 08:02:27 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <1112017828.20201.5.camel@localhost.localdomain> Message-ID: <20050328160216.75697.qmail@web210.biz.mail.re2.yahoo.com> --- Warren Smith wrote: > Ahh agi. Perhaps you should look for Asterisk::AGI. > It does all this > work for you ;). But anyways, here goes... > I did but I can't seem to find an AGI command that will pass the called id number to another machine on my local network? Do you know of one? Thanks for the translation help. Richard > #!/usr/bin/perl > > use strict; > use warnings; > > my $debug = 0; > my %agi = (); > > while() { > chomp; # get a line from stdin and put it into $_ > last unless $_; # exit early if $_ is empty > print "read: $_\n" if $debug; > my ($var, $value) = split /: /; # split $_ into two > parts > $var =~ s/^agi_//; # strip off agi_ prefix > $value =~ s/\s*(.*?)\s*/$1/; # trim $value > $agi{$var} = $value; # save value > } > > On Mon, 2005-03-28 at 05:24 -0800, Richard Reina > wrote: > > perl is the only language I know, and even that is > > debatable. So any of you know enogh php to help > me > > translate the script below? I know which lines are > the > > comments that's about it. > > > > > > #!/usr/bin/php4 -q > > > ob_implicit_flush(true); > > set_time_limit(6); > > $in = fopen("php://stdin","r"); > > $stdlog = fopen("/var/log/asterisk/my_agi.log", > "w"); > > // toggle debugging output (more verbose) > > $debug = false; > > // Do function definitions before we start the > main > > loop > > function read() { > > global $in, $debug, $stdlog; > > $input = str_replace("\n", "", fgets($in, 4096)); > > if ($debug) fputs($stdlog, "read: $input\n"); > > return $input; > > } > > > > // parse agi headers into array > > while ($env=read()) { > > $s = split(": ",$env); > > $agi[str_replace("agi_","",$s[0])] = trim($s[1]); > > if (($env == "") || ($env == "\n")) { > > break; > > } > > } > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Mon Mar 28 08:03:56 2005 From: richard at rushlogistics.com (Richard Reina) Date: Mon Mar 28 08:04:07 2005 Subject: [Chicago-talk] writing log files to a DB In-Reply-To: <424811C8.7080604@heyjay.com> Message-ID: <20050328160356.38520.qmail@web207.biz.mail.re2.yahoo.com> Thanks for the help. Richard --- Jay Strauss wrote: > > > If I understand this correctly, this begins to > enter > > entries in the file from newest to older until it > > comes to an entry that was already in the table > and > > stops. Am I understanding it correctly? > > > > Does it then put the entries/records in the table > from > > oldest newest to oldest? Does this matter? Do I > need > > to index the file? > > Your database does not guarantee the order of rows > returned, unless you > specifically ask for them to be sequenced (via order > by). So it > shouldn't matter what order you insert the rows. > Without knowing > anything about your database I can't tell you what > indexes you may or > may not need. > > But in general indexes help you find rows fast, when > constraining (in > the where clause) by the columns in the index. Same > thing goes with > when querying with an "order by". > > Steve makes a couple of points that are important. > You probably want to > build a unique constraint on some set of columns of > this table that > uniquely identify the rows. That is, there are some > subset of the > columns in this table, that when used in > combination, make each row > unique. This set of columns it commonly called the > "primary key", you > typically have a primary key on every table. You > should go thru the > exercise of identifying them. > > Also the idea of a scratch/temp table moves the > duplicate checking out > of your perl. Though the sql to move the data from > the scratch table to > the real table becomes more complicated > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From warren at warrenandrachel.com Mon Mar 28 08:13:47 2005 From: warren at warrenandrachel.com (Warren Smith) Date: Mon Mar 28 08:17:37 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <20050328160216.75697.qmail@web210.biz.mail.re2.yahoo.com> References: <20050328160216.75697.qmail@web210.biz.mail.re2.yahoo.com> Message-ID: <1112026427.28750.4.camel@localhost.localdomain> Richard, I dunno if one exists, but I wrote one that does summarily this: use Asterisk::AGI; use RPC::XML::Client; use RPC::XML; my $agi = Asterisk::AGI->new(); my $input = $agi->ReadParse(); my $clid = $input{callerid}; # caller id my $dnid = $input{dnid}; # dialed number id my $cli = RPC::XML::Client->new('http://my.rpc.server/RPC'); $cli->send_request( 'call.incoming', RPC_STRING($clid), RPC_STRING($dnid)); Where my.rpc.server provides the method call.incoming and does something useful with it. Hope this helps. (I've done a *lot* of AGI development, so if you have any other questions (perl-related or not), don't hesitate to ask). -Warren On Mon, 2005-03-28 at 08:02 -0800, Richard Reina wrote: > --- Warren Smith wrote: > > > Ahh agi. Perhaps you should look for Asterisk::AGI. > > It does all this > > work for you ;). But anyways, here goes... > > > > I did but I can't seem to find an AGI command that > will pass the called id number to another machine on > my local network? Do you know of one? > > Thanks for the translation help. > > Richard > > > > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > my $debug = 0; > > my %agi = (); > > > > while() { > > chomp; # get a line from stdin and put it into $_ > > last unless $_; # exit early if $_ is empty > > print "read: $_\n" if $debug; > > my ($var, $value) = split /: /; # split $_ into two > > parts > > $var =~ s/^agi_//; # strip off agi_ prefix > > $value =~ s/\s*(.*?)\s*/$1/; # trim $value > > $agi{$var} = $value; # save value > > } > > > > On Mon, 2005-03-28 at 05:24 -0800, Richard Reina > > wrote: > > > perl is the only language I know, and even that is > > > debatable. So any of you know enogh php to help > > me > > > translate the script below? I know which lines are > > the > > > comments that's about it. > > > > > > > > > #!/usr/bin/php4 -q > > > > > ob_implicit_flush(true); > > > set_time_limit(6); > > > $in = fopen("php://stdin","r"); > > > $stdlog = fopen("/var/log/asterisk/my_agi.log", > > "w"); > > > // toggle debugging output (more verbose) > > > $debug = false; > > > // Do function definitions before we start the > > main > > > loop > > > function read() { > > > global $in, $debug, $stdlog; > > > $input = str_replace("\n", "", fgets($in, 4096)); > > > if ($debug) fputs($stdlog, "read: $input\n"); > > > return $input; > > > } > > > > > > // parse agi headers into array > > > while ($env=read()) { > > > $s = split(": ",$env); > > > $agi[str_replace("agi_","",$s[0])] = trim($s[1]); > > > if (($env == "") || ($env == "\n")) { > > > break; > > > } > > > } > > > _______________________________________________ > > > Chicago-talk mailing list > > > Chicago-talk@pm.org > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From thomasoniii at gmail.com Mon Mar 28 08:55:47 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 08:55:58 2005 Subject: [Chicago-talk] I want to evangelize Message-ID: <5cfdfaf70503280855247a10dc@mail.gmail.com> Okay, I've got Basset up on CPAN. IMESHO, it kicks a lot of ass, and I'm quite proud of it. However, my pride in my work does not necessarily translate into other people wanting to use it. "Oh, look at wacky Jim and his wacky little hobby project. Time for real work." I hate that attitude (and yes, I have encountered it). But I don't necessarily know what would convince people to try it out, kick the tires, and run with it. So I'm opening it up to you guys. What sort of things would you all want to see in a software product before you'd consider it? Documentation? Examples? Speed tests? Preaching? Honestly, would anything convince you to look at it? (I'm not being critical or anything, just speaking generally - we all tend to get set in our ways with things, so I know I have an uphill fight). This is my standard issue with my software - since I know it so intimately, I don't necessarily know where to begin. To me, it's obvious. What would convince you? -Jim... From jt at plainblack.com Mon Mar 28 09:06:17 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 09:07:11 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280855247a10dc@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> Message-ID: > So I'm opening it up to you guys. What sort of things would you all > want to see in a software product before you'd consider it? > Documentation? Examples? Speed tests? Preaching? Honestly, would For me, and I suspect anyone on this list that is working on large perl projects professionally, I already have a massive code base and am not likely to switch over to basset or anything else. However, I could see scavenging it for ideas to make my own codebase better. I'm sure that's not what you'd want to hear, but it's the truth. The only place this doesn't hold true is for someone who is looking to do a ground up rewrite of their system. For anyone starting a new project, they're going to need more than just a cpan module. They'll need a web site which includes the same things you might see from a company trying to sell you a piece of software: Features list (how's basset going to save me time/code) Examples (build a cookbook of examples) Docs (assuming you have them in POD already, should be pretty easy to publish them to HTML) People Using (a list of projects using your software, so they know its ready for prime time) I think the POE web site is a good example of what you'd need to have: http://poe.perl.org/ And if you're looking to commercialize it (leave the code FOSS, but sell services), then you may want to have a look at our web site http://www.plainblack.com/webgui JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From jason at multiply.org Mon Mar 28 09:10:12 2005 From: jason at multiply.org (jason@multiply.org) Date: Mon Mar 28 09:10:31 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280855247a10dc@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> Message-ID: <20050328111012.c6o65jnhm6asw8oc@manage.multiply.org> Quoting Jim Thomason : > Okay, I've got Basset up on CPAN. IMESHO, it kicks a lot of ass, and > I'm quite proud of it. However, my pride in my work does not > necessarily translate into other people wanting to use it. > > So I'm opening it up to you guys. What sort of things would you all > want to see in a software product before you'd consider it? > Documentation? Examples? Speed tests? Preaching? Honestly, would > anything convince you to look at it? (I'm not being critical or > anything, just speaking generally - we all tend to get set in our ways > with things, so I know I have an uphill fight). > > This is my standard issue with my software - since I know it so > intimately, I don't necessarily know where to begin. To me, it's > obvious. What would convince you? Well, for starters, a "minimum configuration file" that is a couple hundred lines long and that doesn't have a bunch of stuff i am told not to touch. :) That scares me. Also, with a web application framework, you have a couple of things going against you: a) there are lots of web frameworks out there b) there are a few awesome web frameworks out there (HTML::Mason, Rails, Struts for java folks, etc.) c) A description of a "new web application framework" doesn't prepare people for what programming habits they have now that Framework X either reinforces or changes completely and throws out the window. So, in a nutshell, good examples. An interesting application written with the software, plus examples of why someone would want to code in the style that the app enforces. -jason gessner jason@multiply.org From thomasoniii at gmail.com Mon Mar 28 09:27:23 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 09:27:35 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <20050328111012.c6o65jnhm6asw8oc@manage.multiply.org> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <20050328111012.c6o65jnhm6asw8oc@manage.multiply.org> Message-ID: <5cfdfaf70503280927f0c7c04@mail.gmail.com> > Well, for starters, a "minimum configuration file" that is a couple hundred > lines long and that doesn't have a bunch of stuff i am told not to touch. :) > That scares me. Oh, it's not that bad. The types entry shouldn't be touched until you know what you're doing, since they're used by the abstract factory. And it does say that, ya know. ;-) > Also, with a web application framework This note irks me the most, I've obviously gotta be more clear in my docs - since it's not just a web application framework. It's just an application framework. You can use it on the web, if you'd like, but it operates quite nicely as a standalone framework as well. It's not just web specific. And calling HTML::Mason an awesome framework is a bit of a stretch, I think. You ever try upgrading a version of mason? It's like pulling teeth considering how often the API changes (at least going from an older install -> a newer one) > So, in a nutshell, good examples. An interesting application written with the > software, plus examples of why someone would want to code in the style Good examples I can handle. Any suggestions as to what you'd consider an "interesting application"? Thanks for the suggestions. I'm gonna win this uphill fight, dammit. -Jim.... From andy at petdance.com Mon Mar 28 09:38:42 2005 From: andy at petdance.com (Andy Lester) Date: Mon Mar 28 09:38:54 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280855247a10dc@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> Message-ID: <20050328173842.GA6807@petdance.com> On Mon, Mar 28, 2005 at 10:55:47AM -0600, Jim Thomason (thomasoniii@gmail.com) wrote: > This is my standard issue with my software - since I know it so > intimately, I don't necessarily know where to begin. To me, it's > obvious. What would convince you? Why, in 25 words or less, is X better than what we have now? For example, for Mechanize: "It puts a scriptable web browser into an object that takes care of lots of form and link drudgery that LWP::UserAgent doesn't handle." For prove: "prove makes it simple to run only certain tests, with certain options, and it makes test-first coding a breeze." What's the similar pitch for Bassett? -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From thomasoniii at gmail.com Mon Mar 28 09:44:26 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 09:44:38 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: References: <5cfdfaf70503280855247a10dc@mail.gmail.com> Message-ID: <5cfdfaf70503280944638e130@mail.gmail.com> > For me, and I suspect anyone on this list that is working on large perl projects > professionally, I already have a massive code base and am not likely to switch over to > basset or anything else. However, I could see scavenging it for ideas to make my own > codebase better. I'm sure that's not what you'd want to hear, but it's the truth. The > only place this doesn't hold true is for someone who is looking to do a ground up > rewrite of their system. That's a reasonable statement. While I think my framework's great, I'm not convinced that any one framework is enough of a benefit over any other framework to justify the huge costs of switching it. Any one framework is probably a benefit over no framework, however. Regardless, I'd just like to see about getting raised up to the l33t level wherein someone says, "Hey, you're starting a project. Basset is a good framework to use." Much the same way that someone nowadays would say to use POE or Mason or whatever. > For anyone starting a new project, they're going to need more than just a cpan module. Heh. And if only that were true. It still amazes me the number of serious professional programmers that I have met and worked with who are perfectly content to use any piece of crap that shows up on CPAN. Likewise the ones that I've told about basset who look at me crosseyed when I say that it's not on CPAN (back when it wasn't). I have no clue why simply appearing on there is enough of a seal of quality for so many people. > Features list (how's basset going to save me time/code) > Examples (build a cookbook of examples) > Docs (assuming you have them in POD already, should be pretty easy to publish them to > HTML) > People Using (a list of projects using your software, so they know its ready for prime > time) > > I think the POE web site is a good example of what you'd need to have: Good ideas, I'll start jumping on 'em. Examples always throw me off, though. You have a laundry list of examples that you'd consider to be "good" or otherwise useful to see? I always feel like I start off too contrived, then move towards too convoluted. What sort of things do you think would get you running? -Jim... From jt at plainblack.com Mon Mar 28 09:44:16 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 09:44:57 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280927f0c7c04@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <20050328111012.c6o65jnhm6asw8oc@manage.multiply.org> <5cfdfaf70503280927f0c7c04@mail.gmail.com> Message-ID: I think that taking criticism is key to winning your uphill battle. I could be reading something into it, but you seem a little defensive toward these comments. On Mon, 28 Mar 2005 11:27:23 -0600 Jim Thomason wrote: >> Well, for starters, a "minimum configuration file" that is a couple hundred >> lines long and that doesn't have a bunch of stuff i am told not to touch. :) >> That scares me. > > Oh, it's not that bad. The types entry shouldn't be touched until you > know what you're doing, since they're used by the abstract factory. > And it does say that, ya know. ;-) > >> Also, with a web application framework > > This note irks me the most, I've obviously gotta be more clear in my > docs - since it's not just a web application framework. It's just an > application framework. You can use it on the web, if you'd like, but > it operates quite nicely as a standalone framework as well. It's not > just web specific. > > And calling HTML::Mason an awesome framework is a bit of a stretch, I > think. You ever try upgrading a version of mason? It's like pulling > teeth considering how often the API changes (at least going from an > older install -> a newer one) > >> So, in a nutshell, good examples. An interesting application written with the >> software, plus examples of why someone would want to code in the style > > Good examples I can handle. Any suggestions as to what you'd consider > an "interesting application"? > > Thanks for the suggestions. I'm gonna win this uphill fight, dammit. > > -Jim.... > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From thomasoniii at gmail.com Mon Mar 28 09:50:38 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 09:51:12 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <20050328111012.c6o65jnhm6asw8oc@manage.multiply.org> <5cfdfaf70503280927f0c7c04@mail.gmail.com> Message-ID: <5cfdfaf705032809503f47422a@mail.gmail.com> On Mon, 28 Mar 2005 11:44:16 -0600, JT Smith wrote: > I think that taking criticism is key to winning your uphill battle. I could be reading > something into it, but you seem a little defensive toward these comments. You're reading into it. But cut me some slack, some defensiveness should be expected. This is my baby we're talking about here. Regardless, misconceptions about what it is or how to use it are clearly my fault and things that I need to resolve. Hence, for example, being irked about it being referred to as a web applications framework - if that's what people are walking away with, I screwed something up. And everybody, please do critique away. I don't know what to elaborate upon or defend unless I know what's people don't like or don't get. -Jim... From jt at plainblack.com Mon Mar 28 09:55:43 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 09:56:10 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280944638e130@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> Message-ID: > Regardless, I'd just like to see about getting raised up to the l33t > level wherein someone says, "Hey, you're starting a project. Basset is > a good framework to use." Much the same way that someone nowadays > would say to use POE or Mason or whatever. If WebGUI didn't already exist, and I was starting it today, I'd probably start with Basset or something like it. I certainly wouldn't start with Mason. > Good ideas, I'll start jumping on 'em. Examples always throw me off, > though. You have a laundry list of examples that you'd consider to be > "good" or otherwise useful to see? I always feel like I start off too > contrived, then move towards too convoluted. What sort of things do > you think would get you running? You said in a previous post that it's not just a web app framework. So I guess writing something non-web related would be a good example. For instance, maybe you want to write a network app like a tiny chat server. Or perhaps you want to write a logging daemon with it. From the web side, I think a simple page publisher kind of thing that required a login to publish, but not to view, would be a good start. Though there are already 10,000 of those out there. I can't really come up with good examples for you though cuz I'm not sure what the intention of basset was when you wrote it. Only you know that. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From magog at the-wire.com Mon Mar 28 10:29:25 2005 From: magog at the-wire.com (Michael Graham) Date: Mon Mar 28 10:27:55 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf70503280855247a10dc@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> Message-ID: <20050328132017.C9F6.MAGOG@the-wire.com> > So I'm opening it up to you guys. What sort of things would you all > want to see in a software product before you'd consider it? I'll confess that I had a look at Basset when you announced it, and I had a difficult time figuring out what it actually does - what niches it fills. I think maybe a feature list and a 10,000 foot overview would be nice. The FAQ and README focus more on "why a new framework?" rather than what it does. But then, I'm probably not your target audience - I'm reinventing at least two of my own wheels at the moment, so I'm in "steal spokes from other wheels" mode. :) Michael -- Michael Graham From hachi at kuiki.net Mon Mar 28 10:40:03 2005 From: hachi at kuiki.net (Jonathan Steinert) Date: Mon Mar 28 10:42:46 2005 Subject: [Chicago-talk] Jonathan Steinert - You got your ears on? In-Reply-To: <4245E2AA.7000000@heyjay.com> References: <4245E2AA.7000000@heyjay.com> Message-ID: <42484F83.9010202@kuiki.net> Jay Strauss wrote: > Do you still have it? I would be willing to bet that I do, but after looking around for a while I can't find this script you speak of. Do you happen to remember what it did if it was useful? Sorry, I do still have one more machine to check on though so perhaps I'll find it this evening. --Jonathan From shild at sbcglobal.net Mon Mar 28 10:44:00 2005 From: shild at sbcglobal.net (Scott T. Hildreth) Date: Mon Mar 28 10:44:56 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> Message-ID: <1112035440.894.10.camel@fbsd1.dyndns.org> > > If WebGUI didn't already exist, and I was starting it today, I'd probably start with > Basset or something like it. > I certainly wouldn't start with Mason. Why not Mason? > > > > JT ~ Plain Black > ph: 703-286-2525 ext. 810 > fax: 312-264-5382 > http://www.plainblack.com > > Create like a god, command like a king, work like a slave. > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk -- Scott T. Hildreth From jt at plainblack.com Mon Mar 28 11:16:25 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 11:16:58 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <1112035440.894.10.camel@fbsd1.dyndns.org> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> <1112035440.894.10.camel@fbsd1.dyndns.org> Message-ID: > Why not Mason? A lot of reasons, some personal, some technical. Personally I hate server page languages. I believe in true seperation of presentation and logic. Personal feelings aside though, Mason is big, bloated, and complicated. Most people have no need for a system as big as that, and if they do, they should probably look at one of the 300+ content management systems on the market. If they're looking for something useful just to build a small app or web site, I highly recommend either HTML::Template or Template Toolkit. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From thomasoniii at gmail.com Mon Mar 28 11:30:28 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 11:30:44 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> <1112035440.894.10.camel@fbsd1.dyndns.org> Message-ID: <5cfdfaf705032811307fcd6bfd@mail.gmail.com> >If they're looking for something > useful just to build a small app or web site, I highly recommend either HTML::Template > or Template Toolkit. Of course, Template::Toolkit is also big, bloated, and complicated. Plus it introduces the need to learn a whole new language (albeit a simple one) in order to develop your templates, as opposed to Mason which just lets you write 'em in Perl. That's a concern depending upon your audience. The complexity of any open source project tends to approach infinity given enough time. Eventually, people drop out of projects, other people come in, directions change, something else seems cool, stuff gets grafted in, and it becomes huge. -Jim..... From jt at plainblack.com Mon Mar 28 11:35:50 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 11:36:15 2005 Subject: [Chicago-talk] I want to evangelize In-Reply-To: <5cfdfaf705032811307fcd6bfd@mail.gmail.com> References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> <1112035440.894.10.camel@fbsd1.dyndns.org> <5cfdfaf705032811307fcd6bfd@mail.gmail.com> Message-ID: > Of course, Template::Toolkit is also big, bloated, and complicated. > Plus it introduces the need to learn a whole new language (albeit a > simple one) in order to develop your templates, as opposed to Mason > which just lets you write 'em in Perl. That's a concern depending upon > your audience. My favorite templating language in perl is HTML::Template, but Template Toolkit is more powerful. Yes it's big and complicated, but I disagree that it's bloated. It uses less memory and is nearly twice as fast as Mason. Also, the whole point of a templating language (at least from my point of view) is to eliminate the backend programming language as something that the templaters need to know. With TT you can make your tags as simple as HTML and only tell your templaters about a few of them. That way they really only need to know HTML plus a few extra tags. That's also the advantage of HTML::Template. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From me at heyjay.com Mon Mar 28 11:50:39 2005 From: me at heyjay.com (Jay Strauss) Date: Mon Mar 28 11:49:41 2005 Subject: [Chicago-talk] Jonathan Steinert - You got your ears on? In-Reply-To: <42484F83.9010202@kuiki.net> References: <4245E2AA.7000000@heyjay.com> <42484F83.9010202@kuiki.net> Message-ID: <4248600F.7000407@heyjay.com> > I would be willing to bet that I do Do you mean you'd be willing to bet that you "still have your ears on" :) , but after looking around for a > while I can't find this script you speak of. Do you happen to remember > what it did if it was useful? > > Sorry, I do still have one more machine to check on though so perhaps > I'll find it this evening. > It's not a big deal, I'm using Component::Server&&Client::TCP (though I can't figure out why I can yield the session, but can't post to it). It didn't do anything particularly great :) You just built it along the way while you were presenting POE to the pm group. It was easy to see how the parts fit together. At one point you posted (or maybe just sent to me) a link to the source. I think it may have just been a bare bones implementation of like: Component::Server::TCP, but built out of wheels and sockets, as opposed to using the prebuilt component. Jay From thomasoniii at gmail.com Mon Mar 28 12:53:46 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 12:53:56 2005 Subject: [Chicago-talk] Basset Bullet Points Message-ID: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> I've been yapping with Andy. We've come up with some bullet points. The short blurb is simply that Basset is a framework designed to let you build your application the way you want to, in a consistent and easy to maintain way. So what does that mean? * It's not just a tool for building websites - you're welcome to build web apps (it comes with a templating module (if you want to use it)), but it's equally happy working inside your shell program or a cron job or in a Tk widget. You can build what you want with it. * It makes reading from and writing to a persistent object store (usually a RDBMS) easy - if that's something you want to do. But you can also build strictly in-memory objects, or widgets, or controllers. You're not locked in to only building your database model objects in Basset - you can build -all- your objects in Basset. * Which leads to the key point - Basset is completely consistent. When you're working with a Basset object, you know how it's going to behave. You know how your errors will be reported, you know how your accessors and mutators will work, you know how introspection functions. You don't need to worry about your persistence layer not playing with your root class not playing with your controller not playing with your templates. It's all the same. Basically, when using Basset, you can build your entire application out of legos, instead of building some of it out of legos, some out of tinker toys, some with an erector set, some with k'nex, and then trying to balance all of those disparate parts together into something reasonable. Everything always plugs together in the way it's supposed to. * But you're not locked into anything. Since the framework is completely internally consistent, you can change the parts of it you don't like and insert new parts that you do. Want to use your own persistence layer? Drop it in. Want to use your own template? Drop it in. Missing some snazzy piece of functionality? Create a new module. As long as you can make your new pieces play by the rules so the rest of the framework knows that your part will behave the same way it does, you can use whatever parts you want. * And you can even change the rules (at least to some extent in some directions). Don't want to use error codes? Use exceptions. Don't like how class attributes are created? Re-define it. Basset's key concern is that you play by the rules, but it's much less concerned with who wrote the rule book. * Finally, it's fast (at least relatively speaking). OO in perl is naturally going to be slightly slower. Persistence layers will naturally be slower than straight DBI calls. Dispatching takes time. But it's all been carefully tuned and optimized (and being refined all the time) to deliver the consistency and flexibility as fast as possible. So you get improved programmer efficiency and write your application faster, while not needing to worry about whether your application is becoming slower in the process. Thoughts? -Jim..... From andy at petdance.com Mon Mar 28 13:04:53 2005 From: andy at petdance.com (Andy Lester) Date: Mon Mar 28 13:05:05 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> Message-ID: <20050328210453.GD10484@petdance.com> On Mon, Mar 28, 2005 at 02:53:46PM -0600, Jim Thomason (thomasoniii@gmail.com) wrote: > I've been yapping with Andy. We've come up with some bullet points. Those aren't bullet points. They're bullet paragraphs. Basset is: * An application framework for web, shell, Tk, or anything. * Makes object persistence easy, but doesn't require an RDBMS. * Self-contained, so you don't have to add components into a Frankeinstein's monster of two or twelve modules. * Parts of Basset that you want to replace can be replaced, if you DO want to bring in outside help. * Fast, considering how flexible it is. -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jt at plainblack.com Mon Mar 28 13:11:05 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 13:11:28 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: <20050328210453.GD10484@petdance.com> References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> <20050328210453.GD10484@petdance.com> Message-ID: I would also express: a) What is basset not. b) What are the pros and cons of Basset compared with POE, Mason, WebGUI, or any other app framework written in perl POE makes writing network servers easier. Mason is a rapid prototyping system for web pages. WebGUI is a web content application server. Basset is a ......, and here's why you'd use Basset over each of the above. On Mon, 28 Mar 2005 15:04:53 -0600 Andy Lester wrote: > On Mon, Mar 28, 2005 at 02:53:46PM -0600, Jim Thomason (thomasoniii@gmail.com) wrote: >> I've been yapping with Andy. We've come up with some bullet points. > > Those aren't bullet points. They're bullet paragraphs. > > Basset is: > > * An application framework for web, shell, Tk, or anything. > > * Makes object persistence easy, but doesn't require an RDBMS. > > * Self-contained, so you don't have to add components into a >Frankeinstein's monster of two or twelve modules. > > * Parts of Basset that you want to replace can be replaced, if you DO > want to bring in outside help. > > * Fast, considering how flexible it is. > > > -- > Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From richard at rushlogistics.com Mon Mar 28 13:17:01 2005 From: richard at rushlogistics.com (Richard Reina) Date: Mon Mar 28 13:17:13 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <1112026427.28750.4.camel@localhost.localdomain> Message-ID: <20050328211702.41490.qmail@web203.biz.mail.re2.yahoo.com> Warren, Thanks so much for your help thus far. Forgive for my ignorance. But I am confused about exactly how this script interfaces with *. When (and how) do you execute it so that it coincides with each incoming phone call? > > I dunno if one exists, but I wrote one that does > summarily this: > > use Asterisk::AGI; > use RPC::XML::Client; > use RPC::XML; > my $agi = Asterisk::AGI->new(); > my $input = $agi->ReadParse(); > > my $clid = $input{callerid}; # caller id > my $dnid = $input{dnid}; # dialed number id > > my $cli = > RPC::XML::Client->new('http://my.rpc.server/RPC'); > $cli->send_request( > 'call.incoming', RPC_STRING($clid), > RPC_STRING($dnid)); > > > Where my.rpc.server provides the method > call.incoming and does something > useful with it. > > Hope this helps. (I've done a *lot* of AGI > development, so if you have > any other questions (perl-related or not), don't > hesitate to ask). > > -Warren > > > > On Mon, 2005-03-28 at 08:02 -0800, Richard Reina > wrote: > > --- Warren Smith > wrote: > > > > > Ahh agi. Perhaps you should look for > Asterisk::AGI. > > > It does all this > > > work for you ;). But anyways, here goes... > > > > > > > I did but I can't seem to find an AGI command that > > will pass the called id number to another machine > on > > my local network? Do you know of one? > > > > Thanks for the translation help. > > > > Richard > > > > > > > #!/usr/bin/perl > > > > > > use strict; > > > use warnings; > > > > > > my $debug = 0; > > > my %agi = (); > > > > > > while() { > > > chomp; # get a line from stdin and put it into > $_ > > > last unless $_; # exit early if $_ is empty > > > print "read: $_\n" if $debug; > > > my ($var, $value) = split /: /; # split $_ into > two > > > parts > > > $var =~ s/^agi_//; # strip off agi_ prefix > > > $value =~ s/\s*(.*?)\s*/$1/; # trim $value > > > $agi{$var} = $value; # save value > > > } > > > > > > On Mon, 2005-03-28 at 05:24 -0800, Richard Reina > > > wrote: > > > > perl is the only language I know, and even > that is > > > > debatable. So any of you know enogh php to > help > > > me > > > > translate the script below? I know which lines > are > > > the > > > > comments that's about it. > > > > > > > > > > > > #!/usr/bin/php4 -q > > > > > > > ob_implicit_flush(true); > > > > set_time_limit(6); > > > > $in = fopen("php://stdin","r"); > > > > $stdlog = > fopen("/var/log/asterisk/my_agi.log", > > > "w"); > > > > // toggle debugging output (more verbose) > > > > $debug = false; > > > > // Do function definitions before we start the > > > main > > > > loop > > > > function read() { > > > > global $in, $debug, $stdlog; > > > > $input = str_replace("\n", "", fgets($in, > 4096)); > > > > if ($debug) fputs($stdlog, "read: $input\n"); > > > > return $input; > > > > } > > > > > > > > // parse agi headers into array > > > > while ($env=read()) { > > > > $s = split(": ",$env); > > > > $agi[str_replace("agi_","",$s[0])] = > trim($s[1]); > > > > if (($env == "") || ($env == "\n")) { > > > > break; > > > > } > > > > } > > > > > _______________________________________________ > > > > Chicago-talk mailing list > > > > Chicago-talk@pm.org > > > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > > > > _______________________________________________ > > > Chicago-talk mailing list > > > Chicago-talk@pm.org > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From warren at warrenandrachel.com Mon Mar 28 13:18:06 2005 From: warren at warrenandrachel.com (Warren Smith) Date: Mon Mar 28 13:21:43 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <20050328211702.41490.qmail@web203.biz.mail.re2.yahoo.com> References: <20050328211702.41490.qmail@web203.biz.mail.re2.yahoo.com> Message-ID: <1112044686.18614.0.camel@localhost.localdomain> In my [incoming] context (where all my zapata calls go), this is the first thing executed. I.E. exten => s,1,AGI(send-clid.agi) exten => s,2,Background(greeting) ... On Mon, 2005-03-28 at 13:17 -0800, Richard Reina wrote: > Warren, > > Thanks so much for your help thus far. Forgive for my > ignorance. But I am confused about exactly how this > script interfaces with *. When (and how) do you > execute it so that it coincides with each incoming > phone call? > > > > I dunno if one exists, but I wrote one that does > > summarily this: > > > > use Asterisk::AGI; > > use RPC::XML::Client; > > use RPC::XML; > > my $agi = Asterisk::AGI->new(); > > my $input = $agi->ReadParse(); > > > > my $clid = $input{callerid}; # caller id > > my $dnid = $input{dnid}; # dialed number id > > > > my $cli = > > RPC::XML::Client->new('http://my.rpc.server/RPC'); > > $cli->send_request( > > 'call.incoming', RPC_STRING($clid), > > RPC_STRING($dnid)); > > > > > > Where my.rpc.server provides the method > > call.incoming and does something > > useful with it. > > > > Hope this helps. (I've done a *lot* of AGI > > development, so if you have > > any other questions (perl-related or not), don't > > hesitate to ask). > > > > -Warren > > > > > > > > On Mon, 2005-03-28 at 08:02 -0800, Richard Reina > > wrote: > > > --- Warren Smith > > wrote: > > > > > > > Ahh agi. Perhaps you should look for > > Asterisk::AGI. > > > > It does all this > > > > work for you ;). But anyways, here goes... > > > > > > > > > > I did but I can't seem to find an AGI command that > > > will pass the called id number to another machine > > on > > > my local network? Do you know of one? > > > > > > Thanks for the translation help. > > > > > > Richard > > > > > > > > > > #!/usr/bin/perl > > > > > > > > use strict; > > > > use warnings; > > > > > > > > my $debug = 0; > > > > my %agi = (); > > > > > > > > while() { > > > > chomp; # get a line from stdin and put it into > > $_ > > > > last unless $_; # exit early if $_ is empty > > > > print "read: $_\n" if $debug; > > > > my ($var, $value) = split /: /; # split $_ into > > two > > > > parts > > > > $var =~ s/^agi_//; # strip off agi_ prefix > > > > $value =~ s/\s*(.*?)\s*/$1/; # trim $value > > > > $agi{$var} = $value; # save value > > > > } > > > > > > > > On Mon, 2005-03-28 at 05:24 -0800, Richard Reina > > > > wrote: > > > > > perl is the only language I know, and even > > that is > > > > > debatable. So any of you know enogh php to > > help > > > > me > > > > > translate the script below? I know which lines > > are > > > > the > > > > > comments that's about it. > > > > > > > > > > > > > > > #!/usr/bin/php4 -q > > > > > > > > > ob_implicit_flush(true); > > > > > set_time_limit(6); > > > > > $in = fopen("php://stdin","r"); > > > > > $stdlog = > > fopen("/var/log/asterisk/my_agi.log", > > > > "w"); > > > > > // toggle debugging output (more verbose) > > > > > $debug = false; > > > > > // Do function definitions before we start the > > > > main > > > > > loop > > > > > function read() { > > > > > global $in, $debug, $stdlog; > > > > > $input = str_replace("\n", "", fgets($in, > > 4096)); > > > > > if ($debug) fputs($stdlog, "read: $input\n"); > > > > > return $input; > > > > > } > > > > > > > > > > // parse agi headers into array > > > > > while ($env=read()) { > > > > > $s = split(": ",$env); > > > > > $agi[str_replace("agi_","",$s[0])] = > > trim($s[1]); > > > > > if (($env == "") || ($env == "\n")) { > > > > > break; > > > > > } > > > > > } > > > > > > > _______________________________________________ > > > > > Chicago-talk mailing list > > > > > Chicago-talk@pm.org > > > > > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > > > > > > > _______________________________________________ > > > > Chicago-talk mailing list > > > > Chicago-talk@pm.org > > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > > > > _______________________________________________ > > > Chicago-talk mailing list > > > Chicago-talk@pm.org > > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From comdog at panix.com Mon Mar 28 13:25:19 2005 From: comdog at panix.com (brian d foy) Date: Mon Mar 28 13:25:27 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> <20050328210453.GD10484@petdance.com> Message-ID: On Mon, 28 Mar 2005, JT Smith wrote: > I would also express: > > a) What is basset not. > > b) What are the pros and cons of Basset compared with POE, Mason, WebGUI, or > any other app framework written in perl I've always wanted to publish a Consumer Reports style comparison of these sorts of things. :) -- brian d foy From jt at plainblack.com Mon Mar 28 13:32:43 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 13:34:00 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> <20050328210453.GD10484@petdance.com> Message-ID: > I've always wanted to publish a Consumer Reports style comparison of these sorts of >things. :) At least in the webapp area, I have: www.cmsmatrix.org JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From thomasoniii at gmail.com Mon Mar 28 13:53:56 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Mon Mar 28 13:54:07 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> <20050328210453.GD10484@petdance.com> Message-ID: <5cfdfaf7050328135347b60197@mail.gmail.com> I suppose I'm not allowed to lie. "Basset turns water into wine. POE will give you cancer. Mason will make you become sexually attracted to penguins." I'll give it a crack, though. Basset is a consistent toolbox. You always know what a screwdriver looks like, and when to use one. It gives you some tools to use to build your application, and the rules to allow you to create your own tools as you need them. You do not download and "run basset", you only get building blocks out of the box; you get the foundation on which to build your application. As for a detailed comparison between those guys, I can't do it off the top of my head, since I haven't done terribly detailed comparisons. As a first shot, I'd say that you can use Basset as a core foundation for building any of those other technologies, but you can't use those technologies to build each other, or basset. No, I'm not claiming that basset is feature complete with all of those frameworks, just that it's lower level (as I understand it). I end up fighting more against Class::DBI, so I can probably hit more bullet points comparing Basset's persistence layer (Basset::Object::Persistent) against CDBI's. * BOP allows exceptions or error codes, CDBI locks you into exceptions. * BOP allows multi-column foreign keys. * BOP allows transparent multi-table -> single class mappings. * BOP tries to address more OO <-> RDBMS impedence mismatches. * BOP is 20-60% faster. (though I do admit that I need to write up a wider benchmark suite) * BOP will either figure things out for itself (as possible), or trust you to provide it. * CDBI is more widely used and has been hammered on more. * CDBI has more built-in trigger points -Jim..... On Mon, 28 Mar 2005 15:11:05 -0600, JT Smith wrote: > I would also express: > > a) What is basset not. > > b) What are the pros and cons of Basset compared with POE, Mason, WebGUI, or any other > app framework written in perl > > POE makes writing network servers easier. > > Mason is a rapid prototyping system for web pages. > > WebGUI is a web content application server. > > Basset is a ......, and here's why you'd use Basset over each of the above. > > On Mon, 28 Mar 2005 15:04:53 -0600 > Andy Lester wrote: > > On Mon, Mar 28, 2005 at 02:53:46PM -0600, Jim Thomason (thomasoniii@gmail.com) wrote: > >> I've been yapping with Andy. We've come up with some bullet points. > > > > Those aren't bullet points. They're bullet paragraphs. > > > > Basset is: > > > > * An application framework for web, shell, Tk, or anything. > > > > * Makes object persistence easy, but doesn't require an RDBMS. > > > > * Self-contained, so you don't have to add components into a > >Frankeinstein's monster of two or twelve modules. > > > > * Parts of Basset that you want to replace can be replaced, if you DO > > want to bring in outside help. > > > > * Fast, considering how flexible it is. > > > > > > -- > > Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance > > _______________________________________________ > > Chicago-talk mailing list > > Chicago-talk@pm.org > > http://mail.pm.org/mailman/listinfo/chicago-talk > > JT ~ Plain Black > ph: 703-286-2525 ext. 810 > fax: 312-264-5382 > http://www.plainblack.com > > Create like a god, command like a king, work like a slave. > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From jt at plainblack.com Mon Mar 28 14:00:07 2005 From: jt at plainblack.com (JT Smith) Date: Mon Mar 28 14:00:46 2005 Subject: [Chicago-talk] Basset Bullet Points In-Reply-To: <5cfdfaf7050328135347b60197@mail.gmail.com> References: <5cfdfaf705032812533a9ad5bc@mail.gmail.com> <20050328210453.GD10484@petdance.com> <5cfdfaf7050328135347b60197@mail.gmail.com> Message-ID: That's the ticket right there. It helps the reader make an educated decision about when to use Basset compared with a competitor to Basset. It's ok that you can't compare Basset to POE and Mason, etc. They probably aren't direct competitors to what you're doing anyway, where CDBI is. Now all this info that you've gathered today, put onto a web site somewhere, and link to it from the POD. > I end up fighting more against Class::DBI, so I can probably hit more > bullet points comparing Basset's persistence layer > (Basset::Object::Persistent) against CDBI's. > > * BOP allows exceptions or error codes, CDBI locks you into exceptions. > * BOP allows multi-column foreign keys. > * BOP allows transparent multi-table -> single class mappings. > * BOP tries to address more OO <-> RDBMS impedence mismatches. > * BOP is 20-60% faster. (though I do admit that I need to write up a > wider benchmark suite) > * BOP will either figure things out for itself (as possible), or trust > you to provide it. > * CDBI is more widely used and has been hammered on more. > * CDBI has more built-in trigger points JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From me at heyjay.com Tue Mar 29 06:00:05 2005 From: me at heyjay.com (Jay Strauss) Date: Tue Mar 29 06:00:23 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" Message-ID: <42495F65.8010505@heyjay.com> Hi, The Basset thread obviously prompted this. Jim mentioned Basset gets compared with CDBI a lot, but I wouldn't call CDBI a application framework. TT and Mason I'd call templating engines, good a generating forms (web or paper) based on variables and input. Maypole too, I've been lurking on that mailing group, seems like a 2nd generation templating system (that is it does a lot of the grunt generation based on some setup stuff, to produce web pages) what is the litmus test for something to be a application framework? Thanks Jay From jt at plainblack.com Tue Mar 29 06:09:13 2005 From: jt at plainblack.com (JT Smith) Date: Tue Mar 29 06:09:52 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <42495F65.8010505@heyjay.com> References: <42495F65.8010505@heyjay.com> Message-ID: > what is the litmus test for something to be a application framework? Myself I think it is any toolkit that provides APIs for user sessions, persistance, security, forms (or data input), and other utility functions that allow you to build applications more quickly. In other words, you don't have to worry about the basics, so you can get to writing your "need-specific" stuff faster. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From thomasoniii at gmail.com Tue Mar 29 06:37:58 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Tue Mar 29 06:38:10 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <42495F65.8010505@heyjay.com> References: <42495F65.8010505@heyjay.com> Message-ID: <5cfdfaf705032906374bd749b9@mail.gmail.com> >Jim mentioned Basset get compared with CDBI a lot, but I wouldn't call CDBI a application > framework. TT and Mason I'd call templating engines, good a generating > forms (web or paper) based on variables and input. Maypole too For the record, I detest the comparison to CDBI. It comes about from people looking at the persistent object class and then saying, "Oh, this is just what CDBI does. Use that." And it's a silly argument since Basset provides much more functionality, but that's the bit people focus on, for some reason. Otherwise, yeah, what JT said sounds good. For the record, Basset also has modules for sessions, security, data input, users, etc., but I haven't deployed those in the distro simply because that then ties the user into particular tables, structures, databases, etc., and I wasn't sure I wanted to do that. Those bits are up on the website. Actually, on that note, what do you guys think of bundling that functionality in? Do you think people would generally want to look at it and say, "Okay, I need to set up tables x, y, and z this way to get this stuff." Or do you think they'd rather grab the modules later, then use their guts to build their own version? -Jim..... From wlindsey at blackhatlounge.net Tue Mar 29 06:43:27 2005 From: wlindsey at blackhatlounge.net (Warren Lindsey) Date: Tue Mar 29 06:43:45 2005 Subject: [Chicago-talk] Jonathan Steinert - You got your ears on? In-Reply-To: <42484F83.9010202@kuiki.net> References: <4245E2AA.7000000@heyjay.com> <42484F83.9010202@kuiki.net> Message-ID: <4249698F.3020000@blackhatlounge.net> [Chicago-talk] Here's the code you asked for Jay http://mail.pm.org/pipermail/chicago-talk/2004-February/001048.html Jonathan Steinert wrote: > Jay Strauss wrote: > >> Do you still have it? > > > I would be willing to bet that I do, but after looking around for a > while I can't find this script you speak of. Do you happen to remember > what it did if it was useful? > > Sorry, I do still have one more machine to check on though so perhaps > I'll find it this evening. > > --Jonathan > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk From me at heyjay.com Tue Mar 29 07:13:44 2005 From: me at heyjay.com (Jay Strauss) Date: Tue Mar 29 07:12:51 2005 Subject: [Chicago-talk] Jonathan Steinert - You got your ears on? In-Reply-To: <4249698F.3020000@blackhatlounge.net> References: <4245E2AA.7000000@heyjay.com> <42484F83.9010202@kuiki.net> <4249698F.3020000@blackhatlounge.net> Message-ID: <424970A8.7060300@heyjay.com> Right on, thanks Warren Jay From jt at plainblack.com Tue Mar 29 07:15:06 2005 From: jt at plainblack.com (JT Smith) Date: Tue Mar 29 07:15:47 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <5cfdfaf705032906374bd749b9@mail.gmail.com> References: <42495F65.8010505@heyjay.com> <5cfdfaf705032906374bd749b9@mail.gmail.com> Message-ID: > Actually, on that note, what do you guys think of bundling that > functionality in? Do you think people would generally want to look at > it and say, "Okay, I need to set up tables x, y, and z this way to get > this stuff." Or do you think they'd rather grab the modules later, > then use their guts to build their own version? Couldn't you bundle them as seperate packages in CPAN? It would do three things: a) Make your project look bigger. b) Allow the people that needed the base to get the base, and the people that needed more to get more. c) Give people the idea of committing their own framework addon components. JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com Create like a god, command like a king, work like a slave. From andy at petdance.com Tue Mar 29 07:32:55 2005 From: andy at petdance.com (Andy Lester) Date: Tue Mar 29 07:33:13 2005 Subject: [Chicago-talk] Fwd: [wanted: short-term Perl programmer: emorgan@nd.edu] Message-ID: <20050329153254.GC24240@petdance.com> ----- Forwarded message from Eric Lease Morgan ----- To: OSS4Lib OSS4Lib , code4lib Libraries , perl4lib From: Eric Lease Morgan Subject: wanted: short-term Perl programmer Date: Tue, 29 Mar 2005 08:56:17 -0500 This is a want-ad for a short-term Perl programmer. Please share it as you see fit. Short-term Perl programmer The University Libraries of Notre Dame Libraries is seeking an expert Perl programmer to work on a short-term project for a professional salary. Description: The Libraries is involved in a national research and development activity. One of the activity's goals is to enhance an information retrieval system with a Find More Like This One feature. This feature will: 1. Allow users to identify a desirable record from a list of search results 2. Select characteristics from the record the user deems significant 3. Return those characteristics back to the system 4. The system will then use things like locally created dictionaries, WordNet, and/or other semantic tools to return additional searches to be applied against other internal or external indexes Requirements: The successful candidate must have exceptional skills in reading and writing object oriented Perl programs in a Unix/Linux environment. The position requires the candidate to be able document their code with comments as well as in the form of PODs. The positon requires the candidate to be able to work in a collaborative environment. Thus, the candidate must posess well-developed communication skills. Highly desireable: Applicants who demonstrate an understanding of relational database techniques, XML and Web Services, academia, as well as the principles of open source software will be given preference. Work environment: The University Libraries is located in Notre Dame, IN (just outside South Bend) about ninety miles east of Chicago. Because of the location, telecommuting is possible, but regular weekly site visits are necessary. Start date: Immmediately End date: No later than August 31, 2005 Salary: Starting at $24/hour and negotiable depending on qualifications, experience, and flexibility Application: Send cover letters, resumes, and questions to Eric Lease Morgan (developer@dewey.library.nd.edu). All inquires will be acknowledged. -- Eric Lease Morgan Head, Digital Access and Information Architecture Department University Libraries of Notre Dame (574) 631-8604 ----- End forwarded message ----- -- Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance From jason at multiply.org Tue Mar 29 07:49:32 2005 From: jason at multiply.org (Jason Gessner) Date: Tue Mar 29 07:50:04 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <5cfdfaf705032906374bd749b9@mail.gmail.com> References: <42495F65.8010505@heyjay.com> <5cfdfaf705032906374bd749b9@mail.gmail.com> Message-ID: <31704b9b3345f7862b6de40d279cae1e@multiply.org> On Mar 29, 2005, at 8:37 AM, Jim Thomason wrote: >> Jim mentioned Basset get compared with CDBI a lot, but I wouldn't > call CDBI a application >> framework. TT and Mason I'd call templating engines, good a >> generating >> forms (web or paper) based on variables and input. Maypole too > > For the record, I detest the comparison to CDBI. It comes about from > people looking at the persistent object class and then saying, "Oh, > this is just what CDBI does. Use that." And it's a silly argument > since Basset provides much more functionality, but that's the bit > people focus on, for some reason. > Why are you so defensive about the C::DBI comparison? Data access is so crucial that people want something good, fast and simple. Until you start trying to shoehorn C::DBI into being a reporting engine, it is quite a bit simpler than your basset examples (and requires no configuration file or editing of the module sources). As for speed, again, it has its optimal uses, and its suboptimal uses. If bassett is a totally general purpose application framework, then concentrate on being the glue between the MVC components, not rewriting them. As glue it may be good. But is your templating engine really better than mason, html::template or tt? Probably not. Is your DB access better than C::DBI? Again, probably not. If you concentrate on stripping out everything but the glue, perhaps your app can become as good as some of those apps. As an example of a good domain specific application framework, Bryar provides a totally generic set of hooks to deal with its data persistence, front end and display components and consequently has many combinations of application setups available. Despite some of its other issues, it is a very well designed framework for blog-esque publishing. i wouldn't be so defensive. You are putting your app out there and saying it is better than x. ok, fine. prove it. Or prove even why it may be better than x in circumstance y. Otherwise, relax a bit. :) -jason From richard at rushlogistics.com Tue Mar 29 08:47:54 2005 From: richard at rushlogistics.com (Richard Reina) Date: Tue Mar 29 08:48:05 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <1112044686.18614.0.camel@localhost.localdomain> Message-ID: <20050329164754.18240.qmail@web201.biz.mail.re2.yahoo.com> Warren, I think I'm getting a little closer. I installed the AGI perl library then put the following script in a file called /var/lib/asterisk/agi-bin/send_clid.agi, updated my [incoming] context with exten => s,1,AGI(send_clid.agi) and did a reload. use Asterisk::AGI; my $agi = Asterisk::AGI->new(); my %input = $agi->ReadParse(); my $clid = $input{callerid}; my $dnid = $input{dnid}; open(CS, ">call_id_test"); print CS "INCOMING CALL FROM " . $clid . "\n"; print CS $dnid . "\n"; close(CS) || die "can't close\n"; system("wall $clid"); The >cli seems to indicate it worked: Launched agi script /var/lib/asterisk/agi-bin/send_clid.agi AGI script send_clid.agi completed, returning 0 however I see no output from wall and if I do a cat call_id_test it's empty. call_id_test has permission set to 777. Any idea what I'm doing wrong? Thanks, again for all the help thus far. Richard --- Warren Smith wrote: > In my [incoming] context (where all my zapata calls > go), this is the > first thing executed. I.E. > > exten => s,1,AGI(send-clid.agi) > exten => s,2,Background(greeting) > ... > From thomasoniii at gmail.com Tue Mar 29 09:31:57 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Tue Mar 29 09:32:05 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <31704b9b3345f7862b6de40d279cae1e@multiply.org> References: <42495F65.8010505@heyjay.com> <5cfdfaf705032906374bd749b9@mail.gmail.com> <31704b9b3345f7862b6de40d279cae1e@multiply.org> Message-ID: <5cfdfaf70503290931c2f74d4@mail.gmail.com> > Why are you so defensive about the C::DBI comparison? Data access is > so crucial that people want something good, fast and simple. I'm defensive about it because it's a pigeon holing issue. CDBI is a persistence layer, Basset is a framework. Yes, I do think my stuff is better, but I'll freely admit that I'm completely biased. I just don't want to be pigeon holed. -Jim... From me at heyjay.com Tue Mar 29 10:03:51 2005 From: me at heyjay.com (Jay Strauss) Date: Tue Mar 29 10:02:56 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <5cfdfaf70503290931c2f74d4@mail.gmail.com> References: <42495F65.8010505@heyjay.com> <5cfdfaf705032906374bd749b9@mail.gmail.com> <31704b9b3345f7862b6de40d279cae1e@multiply.org> <5cfdfaf70503290931c2f74d4@mail.gmail.com> Message-ID: <42499887.9080007@heyjay.com> Jim Thomason wrote: >>Why are you so defensive about the C::DBI comparison? Data access is >>so crucial that people want something good, fast and simple. > > > I'm defensive about it because it's a pigeon holing issue. CDBI is a > persistence layer, Basset is a framework. Since Basset and CDBI are BOTH persistence layers, why is Basset better than CDBI? :) Although I wouldn't mind hearing why Basset's persistence layer is better than CDBI (at least when persisting into an RDBMS). I'm sort of a fan of CDBI. Jay From thomasoniii at gmail.com Tue Mar 29 10:21:54 2005 From: thomasoniii at gmail.com (Jim Thomason) Date: Tue Mar 29 10:28:17 2005 Subject: [Chicago-talk] What exactly is a "Application Framework" In-Reply-To: <42499887.9080007@heyjay.com> References: <42495F65.8010505@heyjay.com> <5cfdfaf705032906374bd749b9@mail.gmail.com> <31704b9b3345f7862b6de40d279cae1e@multiply.org> <5cfdfaf70503290931c2f74d4@mail.gmail.com> <42499887.9080007@heyjay.com> Message-ID: <5cfdfaf70503291021dd9d817@mail.gmail.com> > Although I wouldn't mind hearing why Basset's persistence layer is > better than CDBI (at least when persisting into an RDBMS). I'm sort of > a fan of CDBI. I'd rattled off my list back in an earlier post, maybe in another thread. I don't like CDBI for the same reason that I don't like a lot of the other CPAN stuff - they all play by their own rules and don't necessarily play together. CDBI, for example, cannot be properly used if you want to use error codes instead of exceptions (not claiming to take sides in that religious debate, just an example), short of major hacking of its internals (AFAIK). Grand scheme of things? Realistically? I'm not convinced that there are compelling arguments for any one persistent layer vs. another, other than inertia. If it works for you and you can live with the constraints, the speed, and the impedence mismatch, then go for it. Going from nothing -> something is more important going from something -> something else. All I've really wanted here is suggestions as to what people would like to see to help me get basset elevated to the "something" level. I really don't care about bashing the other options since it's not going to accomplish anything. There are lots of good products out there that I have no interest in using, and I'm really trying to refrain on the issue. I can live with people thinking that my software sucks and they hate it and it doesn't do what they want it to - no skin off of my stiff upper lip. I do get ticked when it's dismissed out of hand because of an existing solution, though. -Jim.... From warren at warrenandrachel.com Tue Mar 29 10:32:42 2005 From: warren at warrenandrachel.com (Warren Smith) Date: Tue Mar 29 10:36:30 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <20050329164754.18240.qmail@web201.biz.mail.re2.yahoo.com> References: <20050329164754.18240.qmail@web201.biz.mail.re2.yahoo.com> Message-ID: <1112121162.28200.3.camel@localhost.localdomain> Try changing this line: open(CS, ">call_id_test"); to this line: open(CS, ">>call_id_test"); Depending on your dialplan, send_clid.agi may be executed twice. Also check that send_clid.agi has permissions 755. Everything else looks okay, however, wall expects a filename to write to everyone. I.E. wall call_id_test instead of wall $clid. Hope this helps. You can see what other neat variables asterisk sends you by: use Data::Dumper; print CS Dumper(\%input); -Warren On Tue, 2005-03-29 at 08:47 -0800, Richard Reina wrote: > Warren, > > I think I'm getting a little closer. I installed the > AGI perl library then put the following script in a > file called /var/lib/asterisk/agi-bin/send_clid.agi, > updated my [incoming] context with exten => > s,1,AGI(send_clid.agi) and did a reload. > > use Asterisk::AGI; > my $agi = Asterisk::AGI->new(); > my %input = $agi->ReadParse(); > > my $clid = $input{callerid}; > my $dnid = $input{dnid}; > > open(CS, ">call_id_test"); > print CS "INCOMING CALL FROM " . $clid . "\n"; > print CS $dnid . "\n"; > close(CS) || die "can't close\n"; > system("wall $clid"); > > The >cli seems to indicate it worked: > Launched agi script > /var/lib/asterisk/agi-bin/send_clid.agi > AGI script send_clid.agi completed, returning 0 > > however I see no output from wall and if I do a cat > call_id_test it's empty. call_id_test has permission > set to 777. > > Any idea what I'm doing wrong? > > Thanks, again for all the help thus far. > > Richard > > --- Warren Smith wrote: > > > In my [incoming] context (where all my zapata calls > > go), this is the > > first thing executed. I.E. > > > > exten => s,1,AGI(send-clid.agi) > > exten => s,2,Background(greeting) > > ... > > > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > From richard at rushlogistics.com Wed Mar 30 04:50:50 2005 From: richard at rushlogistics.com (Richard Reina) Date: Wed Mar 30 04:51:00 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <1112121162.28200.3.camel@localhost.localdomain> Message-ID: <20050330125050.80818.qmail@web208.biz.mail.re2.yahoo.com> > Try changing this line: > open(CS, ">call_id_test"); > to this line: > open(CS, ">>call_id_test"); > Warren, I made this change and made sure that send_clid.agi permission's were set to 755, but the script still does not work. If you have any other ideas let me know. Richrd From zrusilla at mac.com Wed Mar 30 07:21:37 2005 From: zrusilla at mac.com (zrusilla@mac.com) Date: Wed Mar 30 07:21:50 2005 Subject: [Chicago-talk] The Perl Hacker's Passover Story In-Reply-To: References: <5cfdfaf70503280855247a10dc@mail.gmail.com> <5cfdfaf70503280944638e130@mail.gmail.com> <1112035440.894.10.camel@fbsd1.dyndns.org> <5cfdfaf705032811307fcd6bfd@mail.gmail.com> Message-ID: <95aaac5a6c80649d141b3eff87f93d91@mac.com> Passover is coming up in a few weeks. In honor of the commemoration of the Exodus I recast the story in terms Perl hackers can understand. It was originally written to spoof a friend but has been genericized. * * * * * * * * * The Perl Hacker's Passover Story Moses was found in a reed basket in the Nile by Pharaoh's daughter, who adopted him as her own. While growing up he saw the Israelite hackers slaving away on Pharaoh's web site. He was commanded by Larry Wall to lead the hackers out of MitzraimSoft into the Promised Land of Perl, where servers hum day and night and requests are always answered. "Why me?" asked Moses. "I am but JAPH, and I write bad documentation." "Your POD is fine," said Larry. "Now go do it." Moses went before Pharaoh. "Let my people hack," he said. Pharaoh refused to let the hackers work less than 80 hours a week, so Moses visited the ten plagues upon him: worms, viruses, spam, trojans, spyware, buffer overruns, DDOS, spoofed IPs, man-in-the-middle attacks, and crashes of the first-spawn processes. Pharaoh's clients threatened to take their business elsewhere, so he fired his entire Israelite IT department and had security escort them out. The Israelites gathered up their PowerBooks and left in such a hurry, they had no time let their C programs finish compiling (which is why they use bytecode interpreted languages to this day). Pharaoh then realized he had no one to fix his bugs, so he bade his management chase the Israelites and bring back some system administrators, at least. The Israelites safely crossed across the Internet backbone but the Egyptian management was drowned in packets. Moses was called up to Sinai where Larry Wall presented him with the Camel Book. However, when he returned he found his hackers all programming in Java. They were severely punished. After forty years of wandering, they entered the Promised Land of Perl, except for Moses, who was not allowed into the Promised Land because he didn't answer the beeper one night. Liz Cortell The purpose of satire is to strip off the veneer of comforting illusion and cozy half-truth, and our job is to put it back again. -- Michael Flanders From richard at rushlogistics.com Thu Mar 31 14:35:56 2005 From: richard at rushlogistics.com (Richard Reina) Date: Thu Mar 31 14:36:05 2005 Subject: [Chicago-talk] transl. php to perl? In-Reply-To: <20050330125050.80818.qmail@web208.biz.mail.re2.yahoo.com> Message-ID: <20050331223556.74444.qmail@web202.biz.mail.re2.yahoo.com> SOLVED. My problem was that my shebang in send_lcid.agi was #!/usr/bin/perl5 -w. I changed it to #!/usr/bin/perl and it worked. Thank you Warren for all the help. Richard --- Richard Reina wrote: > > > Try changing this line: > > open(CS, ">call_id_test"); > > to this line: > > open(CS, ">>call_id_test"); > > > > Warren, > > I made this change and made sure that send_clid.agi > permission's were set to 755, but the script still > does not work. If you have any other ideas let me > know. > > Richrd > _______________________________________________ > Chicago-talk mailing list > Chicago-talk@pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk >