From gwadej at anomaly.org Mon Sep 5 18:28:29 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Mon, 5 Sep 2011 20:28:29 -0500 Subject: [pm-h] Thursday's Meeting: Lightning Talks? Message-ID: <20110905202829.4a778195@cygnus> Our next technical meeting is coming up this Thursday and I've only had one (provisional) volunteer for a lightning talk. Surely some of you are working on things or interested in things that you could present to the group in 5 minutes or less. If you have an idea for a talk, but you're not sure if anyone would be interested, here's a low-risk way to find out. If you're done a cool little hack that you'd like to share, now is the time. If you know of a module that has really saved you time or hassle, give it a shout out at the meeting. Anyone who is interested in doing a lightning talk, please let me know soon, so I can try to make certain we are prepared before the meeting, this Thursday. If we have time, I'll still accept "walk on" talks. But the more I know about ahead of time, the better. I look forward to seeing you there (even if you don't want to present). G. Wade -- DON'T PANIC! I'm a trained professional, and far more qualified to panic in this situation than you are. From mrallen1 at yahoo.com Tue Sep 6 07:25:15 2011 From: mrallen1 at yahoo.com (Mark Allen) Date: Tue, 6 Sep 2011 07:25:15 -0700 (PDT) Subject: [pm-h] Thursday's Meeting: Lightning Talks? In-Reply-To: <20110905202829.4a778195@cygnus> References: <20110905202829.4a778195@cygnus> Message-ID: <1315319115.33112.YahooMailNeo@web65810.mail.ac4.yahoo.com> I have a couple of lightning talks but I won't be able to make the meeting this month unfortunately. ?Maybe in October. ? Speaking of October, is anyone from Houston.pm going to the Pittsburgh Perl Workshop? Mark ________________________________ From: G. Wade Johnson To: Houston Perl Mongers Sent: Monday, September 5, 2011 8:28 PM Subject: [pm-h] Thursday's Meeting: Lightning Talks? Our next technical meeting is coming up this Thursday and I've only had one (provisional) volunteer for a lightning talk. Surely some of you are working on things or interested in things that you could present to the group in 5 minutes or less. If you have an idea for a talk, but you're not sure if anyone would be interested, here's a low-risk way to find out. If you're done a cool little hack that you'd like to share, now is the time. If you know of a module that has really saved you time or hassle, give it a shout out at the meeting. Anyone who is interested in doing a lightning talk, please let me know soon, so I can try to make certain we are prepared before the meeting, this Thursday. If we have time, I'll still accept "walk on" talks. But the more I know about ahead of time, the better. I look forward to seeing you there (even if you don't want to present). G. Wade -- DON'T PANIC! I'm a trained professional, and far more qualified to panic in this situation than you are. _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston Website: http://houston.pm.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob at cpanel.net Tue Sep 6 17:53:28 2011 From: jacob at cpanel.net (Jake Gelbman) Date: Tue, 6 Sep 2011 19:53:28 -0500 Subject: [pm-h] Thursday's Meeting: Lightning Talks? In-Reply-To: <1315319115.33112.YahooMailNeo@web65810.mail.ac4.yahoo.com> References: <20110905202829.4a778195@cygnus> <1315319115.33112.YahooMailNeo@web65810.mail.ac4.yahoo.com> Message-ID: <20110907005328.GA1386@mu> I recently was thinking about some bit hacks to convert IP Ranges with a mask to ranged format. For example: 1.2.3.5/28 to 1.2.3.0-15 1.2.3.5/255.0.255.0 to 1.-.3.- And can present a talk thats a bit longer than a lightning talk but still less than a regular talk on a good way to do it. Attached are the slides, they are in vroom format. https://metacpan.org/module/Vroom On Tue, Sep 06, 2011 at 07:25:15AM -0700, Mark Allen wrote: > I have a couple of lightning talks but I won't be able to make the meeting this month unfortunately. ?Maybe in October. ? > > Speaking of October, is anyone from Houston.pm going to the Pittsburgh Perl Workshop? > > Mark > > > ________________________________ > From: G. Wade Johnson > To: Houston Perl Mongers > Sent: Monday, September 5, 2011 8:28 PM > Subject: [pm-h] Thursday's Meeting: Lightning Talks? > > Our next technical meeting is coming up this Thursday and I've only had > one (provisional) volunteer for a lightning talk. > > Surely some of you are working on things or interested in things that > you could present to the group in 5 minutes or less. > > If you have an idea for a talk, but you're not sure if anyone would be > interested, here's a low-risk way to find out. > > If you're done a cool little hack that you'd like to share, now is the > time. > > If you know of a module that has really saved you time or hassle, give > it a shout out at the meeting. > > Anyone who is interested in doing a lightning talk, please let me know > soon, so I can try to make certain we are prepared before the meeting, > this Thursday. > > If we have time, I'll still accept "walk on" talks. But the more I know > about ahead of time, the better. > > I look forward to seeing you there (even if you don't want to > present). > > G. Wade > -- > DON'T PANIC! I'm a trained professional, and far more qualified to > panic in this situation than you are. > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ -------------- next part -------------- ---- config title: Bit Hacks on IP Ranges indent: 4 height: 18 width: 69 skip: 0 ---- center Bit Hacks on IP Ranges by Jake Gelbman ---- IP::Range accepts the following formats: ---- * 1.2.3.5 +* 1.2.3.5,105,205 +* 1.2.3.5-55 +* 1.2.3.- +* 1.2.3.5 8.13.21.34 +* 1.2.3.4/24 +* 1.2.3.4/255.255.255.0 ---- Just like nmap(1) http://nmap.org/book/man-target-specification.html ---- And parses it into a nested array ref structure: ---- perl my $r = IP::Range->new("1.2-3,5-8,13.21.34"); ---- perl $VAR1 = bless({ str => '1.2-3,5-8,13.21.34', ranges => [ [ [1], [[2, 3], [5, 8], 13], [21], [34], ] ] }, "IP::Range"); ---- Which it uses to see if an IP address is in the range specified: ---- perl $r->match("1.2.3.4"); # Nope $r->match("1.7.21.34"); # Yeah! ---- And can create a mysql query out of it: ---- perl $r->mysql("expr"); ---- sql -- expr in ip range 1.2-3,5-8,13.21.34 (inet_aton(expr) & 0xff000000) >> 24 = 1 and ((inet_aton(expr) & 0x00ff0000) >> 16 between 2 and 3 or (inet_aton(expr) & 0x00ff0000) >> 16 between 5 and 8 or (inet_aton(expr) & 0x00ff0000) >> 16 = 13) and (inet_aton(expr) & 0x0000ff00) >> 8 = 21 and (inet_aton(expr) & 0x000000ff) >> 0 = 34 ---- However, the CIDR or bitmask style: 1.2.3.5/24 1.2.3.5/255.255.255.0 has to be handled specially when matching or generating the mysql criteria. ---- So, I wanted some way to convert the specification into the other format for ranges: 1.2.3.5/28 to 1.2.3.0-15 1.2.3.5/255.255.255.0 to 1.2.3.- ---- Or 1.2.3.5/160.225.152.186 to 0-31,64-95 . 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 . 0-7,32-39,64-71,96-103 . 0-1,4-5,64-65,68-69 ---- Which is a bit slower than using the mask, but has the benefit of not needing to handle special cases when matching. ---- First convert /numbits to a mask. Which is the more general case. /24 becomes /255.255.255.0 ---- perl my $m = ~0 << 32 - $numbits ---- The initial IP range and mask are then converted to an array of 4 one byte numbers. ---- perl [($m & 0xff000000) >> 24, ($m & 0x00ff0000) >> 16, ($m & 0x0000ff00) >> 8, ($m & 0x000000ff) >> 0]; ---- For each of the octets of the range, I needed to iterate through all the possible values. So If the number, x, was 0000 and the mask, m, was 1100, I would need to iterate: 0000, 0001, 0010, 0011 If x was 1010 and m was 1001: 1000, 1010, 1100, 1110 ---- The easiest way to do this would be to iterate all numbers for ($x & $m .. ($x & $m) + (~$m & 0xff)) { next if $_ != $_ & $m; ... } ---- But that would make too many iterations, 2**(sizeof octet) instead of 2**(number of bits unset in the mask). Which isnt so bad for an octet of 8 bits but huge if it was a 32 bit number or greater. ---- At first I thought to do it with a recursive subroutine, starting at bit 8 decrementing and each time the mask was 0 (bit not held constant) I would branch. ---- But I really wanted to do it with simple bit arithmetic. So I thought about it for a while... ---- And came up with nothing. ---- So I asked a question on stackoverflow for a good way to do it. ---- And someone pointed to Knuth's "The Art of Computer Programming" volume 4A ?7.1.3; see p.150 ---- And that described how to count up through a mask. i[n] = i[n-1] + m + 1 & ~m + i[0] = 0 +Which works because adding the number to the mask and adding 1 skips over the set bits. Masking the additional bits at the end if the number carries past. ---- i[0] = 0, m = 0110 +i[n] = i[n-1] + m + 1 & ~m +i[1] = 0000 + 0110 + 1 & 1001 = 0111 & 1001 = 0001 +i[2] = 0001 + 0110 + 1 & 1001 = 1000 & 1001 = 1000 +i[3] = 1000 + 0110 + 1 & 1001 = 1111 & 1001 = 1001 +i[4] = 1001 + 0110 + 1 & 1001 = 10000 & 1001 = 0000 # done! ---- In my case, the given value of x can be any number, so to drop the number to the lowest in the range, it needs to be and-ed with the mask. x[0] = x[given] & m ---- Calculating the next value becomes: x[n] = x[0] + i[n] + = x[0] + (i[n-1] + m + 1 & ~m) ---- x[given] = 1100, m = 0110 +x[0] = x[given] & m = 1100 & 0110 = 0100 +x[n] = x[0] + i[n] +x[1] = x[0] + i[1] = 0100 + 0001 = 0101 +x[2] = x[0] + i[2] = 0100 + 1000 = 1100 +x[3] = x[0] + i[3] = 0100 + 1001 = 1101 ---- But that only gave a list of numbers which the IP range could match against. I wanted to consolidate consecutive numbers. +To do this I needed the number unset least significant bits before a set bit in the mask. ---- For example, a mask of 0110 has one unset least significant bit, so it ranges 2**1, or 2, numbers before it "jumps" +i = [0000, 0001, 1000, 1001] = [0, 1, 8, 9]; ---- A mask of 0100 has two unset lsb's, so it ranges 2**2, or 4 numbers before it "jumps". +i = [0000, 0001, 0010, 0011, 1000, 1001, 1010, 1011] = [0, 1, 2, 3, 8, 9, 10, 11]; ---- perl sub n_unset_lsbs { my ($m) = @_; for (1 .. 8) { return $_ - 1 if ~(~0 << $_) & $m; } 8; } ---- The next value of i is generated from the end of the range of lsb's: ---- perl sub create_range_from_mask { my ($o, $m) = @_; my $r = []; my $x = $o & $m; my $l = n_unset_lsbs($m); my $i = 0; while (1) { my $j = $i + (1 << $l) - 1; push @$r, $l ? [$x + $i, $x + $j] : $x + $i; $i = $j + $m + 1 & ~$m & 0xff; last if !$i; } $r; } ---- The library and slides can be found here: http://10.1.4.65/lab/iprange/ ---- == The End From gwadej at anomaly.org Tue Sep 6 19:16:30 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 6 Sep 2011 21:16:30 -0500 Subject: [pm-h] Thursday's Meeting: Lightning Talks? In-Reply-To: <20110907005328.GA1386@mu> References: <20110905202829.4a778195@cygnus> <1315319115.33112.YahooMailNeo@web65810.mail.ac4.yahoo.com> <20110907005328.GA1386@mu> Message-ID: <20110906211630.2e7bb243@cygnus> On Tue, 6 Sep 2011 19:53:28 -0500 Jake Gelbman wrote: > I recently was thinking about some bit hacks to convert IP Ranges with > a mask to ranged format. For example: > > 1.2.3.5/28 to 1.2.3.0-15 > 1.2.3.5/255.0.255.0 to 1.-.3.- > > And can present a talk thats a bit longer than a lightning talk but > still less than a regular talk on a good way to do it. > > Attached are the slides, they are in vroom format. > > https://metacpan.org/module/Vroom Thanks, Jake. With the 3-5 people we have volunteered for lightning talks and the main talk, your talk would work great. I'll add you to the schedule. G. Wade -- The three principal virtues of a programmer are Laziness, Impatience, and Hubris. -- Larry Wall From estrabd at gmail.com Thu Sep 8 20:31:36 2011 From: estrabd at gmail.com (B. Estrade) Date: Thu, 8 Sep 2011 22:31:36 -0500 Subject: [pm-h] Qore talk slides Message-ID: <20110909033136.GI2077@x2045.x.rootbsd.net> I really enjoyed the meeting tonight. It was great to have so many people talking about stuff. Thanks for organizing it, Wade. Thanks to Jake for pointing out a typo. Under Perl's threading/async options I had "Core". I meant, "Coro". Fixed. https://docs.google.com/present/view?id=dcqfscq4_337hkvxt6fc Brett -- B. Estrade From estrabd at gmail.com Fri Sep 9 06:39:52 2011 From: estrabd at gmail.com (B. Estrade) Date: Fri, 9 Sep 2011 08:39:52 -0500 Subject: [pm-h] Qore talk slides In-Reply-To: <20110909033136.GI2077@x2045.x.rootbsd.net> References: <20110909033136.GI2077@x2045.x.rootbsd.net> Message-ID: <20110909133952.GL2077@x2045.x.rootbsd.net> I updated the slides a bit. I added something in the possible talk/discussion section. Because the regex example is valid in both Perl and Qore, I came up with something called the "Perqore" challenge (based on 'parkour') - the challenge is simply to write code that is valid in both Perl and Qore. I can't think of what it's called, but it'd almost be like when you try to have a single file that combines different programming languages, but is valid in all of them - e.g., hiding some of language X inside of what looks like a comment block to language Y. I've seen examples that combine 4 or more languages. I just can't find them atm. For Perl/Qore, it's a little different. You'll probably end up molding Perl to accept Qore's quirks rather than the other way around. So, there's no real hiding of code. IDK, just something to keep you busy....if anyone decides to accept such a challenge, it might make for an interesting lightning talk. Brett On Thu, Sep 08, 2011 at 10:31:36PM -0500, B. Estrade wrote: > I really enjoyed the meeting tonight. It was great to have so many > people talking about stuff. Thanks for organizing it, Wade. > > Thanks to Jake for pointing out a typo. Under Perl's threading/async > options I had "Core". I meant, "Coro". > > Fixed. > > https://docs.google.com/present/view?id=dcqfscq4_337hkvxt6fc > > Brett > > -- > B. Estrade > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ -- B. Estrade From erin at morderwerk.de Fri Sep 9 07:40:43 2011 From: erin at morderwerk.de (Erin Schoenhals) Date: Fri, 9 Sep 2011 09:40:43 -0500 Subject: [pm-h] Qore talk slides In-Reply-To: <20110909133952.GL2077@x2045.x.rootbsd.net> References: <20110909033136.GI2077@x2045.x.rootbsd.net> <20110909133952.GL2077@x2045.x.rootbsd.net> Message-ID: Polyglots? On Fri, Sep 9, 2011 at 8:39 AM, B. Estrade wrote: > I updated the slides a bit. I added something in the possible > talk/discussion section. > > Because the regex example is valid in both Perl and Qore, I came up > with something called the "Perqore" challenge (based on 'parkour') - > the challenge is simply to write code that is valid in both Perl and > Qore. > > I can't think of what it's called, but it'd almost be like when you > try to have a single file that combines different programming > languages, but is valid in all of them - e.g., hiding some of language > X inside of what looks like a comment block to language Y. I've seen > examples that combine 4 or more languages. I just can't find them atm. > > For Perl/Qore, it's a little different. You'll probably end up molding > Perl to accept Qore's quirks rather than the other way around. So, > there's no real hiding of code. > > IDK, just something to keep you busy....if anyone decides to accept > such a challenge, it might make for an interesting lightning talk. > > Brett > > On Thu, Sep 08, 2011 at 10:31:36PM -0500, B. Estrade wrote: > > I really enjoyed the meeting tonight. It was great to have so many > > people talking about stuff. Thanks for organizing it, Wade. > > > > Thanks to Jake for pointing out a typo. Under Perl's threading/async > > options I had "Core". I meant, "Coro". > > > > Fixed. > > > > https://docs.google.com/present/view?id=dcqfscq4_337hkvxt6fc > > > > Brett > > > > -- > > B. Estrade > > _______________________________________________ > > Houston mailing list > > Houston at pm.org > > http://mail.pm.org/mailman/listinfo/houston > > Website: http://houston.pm.org/ > > -- > B. Estrade > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From estrabd at gmail.com Fri Sep 9 07:43:57 2011 From: estrabd at gmail.com (B. Estrade) Date: Fri, 9 Sep 2011 09:43:57 -0500 Subject: [pm-h] Qore talk slides In-Reply-To: References: <20110909033136.GI2077@x2045.x.rootbsd.net> <20110909133952.GL2077@x2045.x.rootbsd.net> Message-ID: On Fri, Sep 9, 2011 at 9:40 AM, Erin Schoenhals wrote: > Polyglots? That's it! Thanks, Brett > > On Fri, Sep 9, 2011 at 8:39 AM, B. Estrade wrote: >> >> I updated the slides a bit. I added something in the possible >> talk/discussion section. >> >> Because the regex example is valid in both Perl and Qore, I came up >> with something called the "Perqore" challenge (based on 'parkour') - >> the challenge is simply to write code that is valid in both Perl and >> Qore. >> >> I can't think of what it's called, but it'd almost be like when you >> try to have a single file that combines different programming >> languages, but is valid in all of them - e.g., hiding some of language >> X inside of what looks like a comment block to language Y. I've seen >> examples that combine 4 or more languages. I just can't find them atm. >> >> For Perl/Qore, it's a little different. You'll probably end up molding >> Perl to accept Qore's quirks rather than the other way around. So, >> there's no real hiding of code. >> >> IDK, just something to keep you busy....if anyone decides to accept >> such a challenge, it might make for an interesting lightning talk. >> >> Brett >> >> On Thu, Sep 08, 2011 at 10:31:36PM -0500, B. Estrade wrote: >> > I really enjoyed the meeting tonight. It was great to have so many >> > people talking about stuff. Thanks for organizing it, Wade. >> > >> > Thanks to Jake for pointing out a typo. Under Perl's threading/async >> > options I had "Core". I meant, "Coro". >> > >> > Fixed. >> > >> > ? ? ? https://docs.google.com/present/view?id=dcqfscq4_337hkvxt6fc >> > >> > Brett >> > >> > -- >> > B. Estrade >> > _______________________________________________ >> > Houston mailing list >> > Houston at pm.org >> > http://mail.pm.org/mailman/listinfo/houston >> > Website: http://houston.pm.org/ >> >> -- >> B. Estrade >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > From estrabd at gmail.com Fri Sep 9 07:45:43 2011 From: estrabd at gmail.com (B. Estrade) Date: Fri, 9 Sep 2011 09:45:43 -0500 Subject: [pm-h] Qore talk slides In-Reply-To: References: <20110909033136.GI2077@x2045.x.rootbsd.net> <20110909133952.GL2077@x2045.x.rootbsd.net> Message-ID: Here's one in 8 languages - http://ideology.com.au/polyglot/ Brett On Fri, Sep 9, 2011 at 9:43 AM, B. Estrade wrote: > On Fri, Sep 9, 2011 at 9:40 AM, Erin Schoenhals wrote: >> Polyglots? > > That's it! Thanks, > > Brett > >> >> On Fri, Sep 9, 2011 at 8:39 AM, B. Estrade wrote: >>> >>> I updated the slides a bit. I added something in the possible >>> talk/discussion section. >>> >>> Because the regex example is valid in both Perl and Qore, I came up >>> with something called the "Perqore" challenge (based on 'parkour') - >>> the challenge is simply to write code that is valid in both Perl and >>> Qore. >>> >>> I can't think of what it's called, but it'd almost be like when you >>> try to have a single file that combines different programming >>> languages, but is valid in all of them - e.g., hiding some of language >>> X inside of what looks like a comment block to language Y. I've seen >>> examples that combine 4 or more languages. I just can't find them atm. >>> >>> For Perl/Qore, it's a little different. You'll probably end up molding >>> Perl to accept Qore's quirks rather than the other way around. So, >>> there's no real hiding of code. >>> >>> IDK, just something to keep you busy....if anyone decides to accept >>> such a challenge, it might make for an interesting lightning talk. >>> >>> Brett >>> >>> On Thu, Sep 08, 2011 at 10:31:36PM -0500, B. Estrade wrote: >>> > I really enjoyed the meeting tonight. It was great to have so many >>> > people talking about stuff. Thanks for organizing it, Wade. >>> > >>> > Thanks to Jake for pointing out a typo. Under Perl's threading/async >>> > options I had "Core". I meant, "Coro". >>> > >>> > Fixed. >>> > >>> > ? ? ? https://docs.google.com/present/view?id=dcqfscq4_337hkvxt6fc >>> > >>> > Brett >>> > >>> > -- >>> > B. Estrade >>> > _______________________________________________ >>> > Houston mailing list >>> > Houston at pm.org >>> > http://mail.pm.org/mailman/listinfo/houston >>> > Website: http://houston.pm.org/ >>> >>> -- >>> B. Estrade >>> _______________________________________________ >>> Houston mailing list >>> Houston at pm.org >>> http://mail.pm.org/mailman/listinfo/houston >>> Website: http://houston.pm.org/ >> >> >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ >> > From estrabd at gmail.com Mon Sep 12 08:15:48 2011 From: estrabd at gmail.com (B. Estrade) Date: Mon, 12 Sep 2011 10:15:48 -0500 Subject: [pm-h] [gabor@szabgab.com: [Perlweekly] The current Perl Weekly News - Issue #7] Message-ID: <20110912150947.GL983@x2045.x.rootbsd.net> Enjoy. Brett ----- Forwarded message from Gabor Szabo ----- Date: Sun, 11 Sep 2011 23:24:20 -0700 From: Gabor Szabo To: perlweekly at perlweekly.com Subject: [Perlweekly] The current Perl Weekly News - Issue #7 Perl Weekly Issue #7 - September 12, 2011 http://perlweekly.com/ You can read the newsletter on the web, if you prefer. http://perlweekly.com/archive/7.html Hi there, It seems the pas week brought us less articles but nevertheless I found a few interesting ones. The Perl Weekly was mentioned in the DevOps Weekly that brought us a few more subscribers. I also found out that the subscribe button of the Perl Weekly was partially broken due to the same-origin policy enforced in some browsers more than in others. I fixed this now. I hope. Not to the posts: Articles DotCloud::Environment http://blogs.perl.org/users/polettix/2011/09/dotcloudenvironment.html Flavio Poletti introduces his 'yet to be fully released' module to make it easy to handle the environment in DotCloud -------------- Testing with sqlite http://engineerofdanger.blogspot.com/2011/09/testing-with-sqlite.html Anthony Pallatto (actualeyes) suggests to use SQLite in your testing environment instead of the database used in production. Using SQLite certainly has some advantages but there is the great danger of anything in production being different from the testing environment. SQLite can be good to reduce the complexity to setup development and testing environments but just as you do full test cycles every now and then (preferably frequently) so should you use a system as close to the deployment environment as possible. -------------- Perl says 'Hello I-Programmer' http://www.i-programmer.info/programming/perl/3001-perl-says-hi-to-i-programmer.html This is the first article I wrote to the I-Programmer.info web site. It probably won't be an earth shattering experience for you but it is my first one on I-Programmer. It is mostly there so I'll have an in-house article to refer to on how to start using Perl when I write more complex examples. -------------- Lessons from running Perl Weekly for the first 6 weeks http://szabgab.com/blog/2011/09/lessons-from-running-perl-weekly-for-the-first-6-weeks.html This is another article I wrote, this time on my own blog, describing my experience with this list. It might be interesting to you if you'd like to look a bit at the details. I am also comparing the experience with that of Peter Cooper who runs the Ruby Weekly which was the inspiration to this newsletter. -------------- ============= Parrot Parrot is a foundering project on top of a wonderful vision. http://lists.parrot.org/pipermail/parrot-dev/2011-September/006179.html Christoph Otto took off the gloves and started to describe how he wants Parrot, and more importantly the Parrot development process to change. This is a link to the opening message on the parrot-dev mailing list with many important responses. -------------- Parrot, the Smoke Clears http://whiteknight.github.com/2011/09/10/dust_settles.html Andrew Whitworth (aka Whiteknight on black background) takes the above e-mail discussion and writes a lengthy article about the interaction between the Parrot and the Rakudo (Perl 6) projects. Compared with the JVM and the CLR how they have a primary language but how they have started to be good targets for other languages as well. -------------- ============= Code Parameterized Roles with MooseX::Declare http://metacpan.perldition.org/articles/Parameterized%20Roles%20with%20MooseX%3A%3ADeclare.pod Florian Ragwitz (rafl) shows the new, undocumented feature of MooseX::Declare and points to the Github repository where you could help improve the documentation. -------------- Going Postal (with Dancer) http://babyl.dyndns.org/techblog/entry/going-postal Yanick Champoux (yanick), in his usual colorful way, describes how he wrote a plugin for Dancer to handle postal fees in Canada. I am sure if it can be done in Canada it can be done elsewhere as well. The nice thing is that he even provides a way to save money. Even if not on the actual postal fees. -------------- Simple Mojolicious RSS feed http://markam.posterous.com/simple-mojolicious-rss-feed Mark Meyer (mark) gives a nice and simple example on how distribute updates about changes in a system with a very simple Mojolicious application. If only the fonts were bigger on this blog... -------------- How to Run a Long Background Process in a Web App http://twiki.org/cgi-bin/view/Blog/BlogEntry201109x2 Peter Thoeny from Twiki explains a way how to handle long running processes in response to browser requests. This is an ongoing question that trips a lot of people who want to build a web interface to an existing system. Eg. a build machine. Unfortunately this solution does not work on Windows. -------------- Memory::Usage - Aktuelle Speichernutzung (Current memory usage) in German http://perl-howto.de/2011/09/memoryusage-aktuelle-speichernutzung.html Thomas Fahle gives a code example and explains (in German) how to check what is the memory usage of the current process. So a script or application could report its own memory usage. (This is also Linux/Unix only.) -------------- ============= Perl 6 'nom' branch is now default, release status http://rakudo.org/2011/09/09/nom-branch-default/ Patrick Michaud (pmichaud) provides us with an update on the status of the Rakudo development. The next release is further delayed but the good news that it will already come from the new 'nom' branch that is the new rewrite of the whole engine. -------------- -n and -p http://strangelyconsistent.org/blog/dash-n-and-dash-p-part-three This is the third part of the series Carl M??sak has written showing us how the -n and -p parameters work in Rakudo Perl 6. The others are on his blog as well. -------------- ============= Padre Fancy syntax checking with Padre http://ahmadzawawi.blogspot.com/2011/09/fancy-syntax-checking-with-padre.html Ahmad M. Zawawi (azawawi) shows a screenshot of his new addition to Padre, the Perl IDE. You don't even have to wait for the next release of Padre to use that. You can run it directly from the development environment. -------------- ============= Events Portuguese Perl Workshop http://workshop.perl.pt/ptpw2011/ September 22-23, 2011, Lisbon, Portugal -------------- OSDC.fr - French Open Source Developers' Conference http://act.osdc.fr/osdc2011fr/ September 23-24, 2011, Paris, France -------------- The Pittsburgh Perl Workshop http://pghpw.org/ppw2011/ October 8-9, 2011, Pittsburgh, PA, USA -------------- YAPC::Asia http://yapcasia.org/2011/ October 13-15, 2011, Tokyo, Japan. The biggest Perl conference in the world. -------------- Black Perl 2011 Workshop http://black-perl.org/bp2011/ September 30 - October 2, 2011, Black Sea, Ukraine -------------- German Perl workshop http://conferences.yapceurope.org/gpw2011/ October 19-21, 2011, Frankfurt Am Main, Germany -------------- London Perl Workshop (LPW2011) http://conferences.yapceurope.org/lpw2011/ November 12, 2011, London, UK (what a surprise :) -------------- ============= You joined the Perl Weekly to get weekly e-mails about the Perl programming language and related topics. Want to see more? See the archives ( http://perlweekly.com/archive/ ) of all the issues. Reading this as a non-subscriber? Join us free of charge. http://perlweekly.com/ (c) Gabor Szabo http://szabgab.com/ If you don't want to receive mails any more you can unsubscribe here: http://perlweekly.com/unsubscribe.html _______________________________________________ Perlweekly mailing list Perlweekly at perlweekly.com http://mail.perlweekly.com/mailman/listinfo/perlweekly ----- End forwarded message ----- -- B. Estrade From estrabd at gmail.com Tue Sep 13 08:16:03 2011 From: estrabd at gmail.com (B. Estrade) Date: Tue, 13 Sep 2011 10:16:03 -0500 Subject: [pm-h] Happy Programmers' Day! Message-ID: <20110913151603.GN46208@x2045.x.rootbsd.net> http://en.wikipedia.org/wiki/Programmers_Day And here I thought sys admins were the ones who got all the hugs. Brett -- B. Estrade From rlharris at oplink.net Tue Sep 20 14:42:18 2011 From: rlharris at oplink.net (Russell L. Harris) Date: Tue, 20 Sep 2011 16:42:18 -0500 Subject: [pm-h] File::Find and system Message-ID: <20110920214217.GA4052@broadcaster.org> Running Linux, I need to execute various system utilities (including "dos2unix") on multiple files in multiple directories. The file structure is similar to the following: foo/jan/01.txt foo/jan/02.txt foo/jan/03.txt ... foo/feb/01.txt foo/feb/02.txt foo/feb/03.txt ... foo/dec/01.txt foo/dec/02.txt foo/dec/03.txt ... bar/jan/01.txt bar/jan/02.txt bar/jan/03.txt ... bar/feb/01.txt bar/feb/02.txt bar/feb/03.txt ... bar/dec/01.txt bar/dec/02.txt bar/dec/03.txt ... foobar/jan/01.txt foobar/jan/02.txt foobar/jan/03.txt ... foobar/feb/01.txt foobar/feb/02.txt foobar/feb/03.txt ... foobar/dec/01.txt foobar/dec/02.txt foobar/dec/03.txt ... Regrettably, not all Linux utilities have a recursive option, and I do not wish to take the time to re-write and debug functions which already are available as a standard utilities. A very tedious approach would be to "cd" to "foo/jan/" and run "dos2unix *.txt", then "cd" to "foo/feb/" and run "dos2unix *.txt", etc. I know that a Perl script can automate the process. I just discovered the Perl "File::Find" module and the Perl "system" function, and now I am perusing the O'Reilly Perl books, trying to understand how to combine the two into a script. Afterward, I need to do involved search-and-replace processing on these files which cannot be handled with system utilities. I previously have used Perl scripts for similar tasks, but never on a multi-level directory. So, learning how to run system utilities with "File::Find" appears to me to be the logical first step. RLH From mrallen1 at yahoo.com Tue Sep 20 15:16:37 2011 From: mrallen1 at yahoo.com (Mark Allen) Date: Tue, 20 Sep 2011 15:16:37 -0700 (PDT) Subject: [pm-h] File::Find and system In-Reply-To: <20110920214217.GA4052@broadcaster.org> References: <20110920214217.GA4052@broadcaster.org> Message-ID: <1316556997.44668.YahooMailNeo@web65810.mail.ac4.yahoo.com> Find::File is definitely more cross platform and tested for edge cases, but something like this works pretty well too. == SNIP == use strict; use warnings; my $base = $1 || $ENV{'PWD'}; my @dirs = ( $base ); foreach my $dir ( @dirs ) { ? ? ? opendir DIR, $dir; ? ? ? while ( my $file = readdir DIR ) { ? ? ? ? ? ? ? if ( -d "$dir/$file" ) { ? ? ? ? ? ? ? ? ? next if ( $file eq "." or $file eq ".." ); ? ? ? ? ? ? ? ? ? push @dirs, "$dir/$file"; ? ? ? ? ? ? ? ? ? next; ? ? ? ? ? ? ? } ? ? ? ? ? ? ? # do stuff, like maybe ? ? ? ? ? ? ? print "Now processing $dir/$file..."; ? ? ? ? ? ? ? `/usr/bin/dos2unix $dir/$file`; ? ? ? ? ? ? ? print "done\n"; ? ? ? } ? ? ? closedir DIR; } == SNIP END == Mark ________________________________ From: Russell L. Harris To: houston at pm.org Sent: Tuesday, September 20, 2011 4:42 PM Subject: [pm-h] File::Find and system Running Linux, I need to execute various system utilities (including "dos2unix") on multiple files in multiple directories.? The file structure is similar to the following: ? ? foo/jan/01.txt ? ? foo/jan/02.txt ? ? foo/jan/03.txt ? ? ... ? ? foo/feb/01.txt ? ? foo/feb/02.txt ? ? foo/feb/03.txt ? ? ... ? ? foo/dec/01.txt ? ? foo/dec/02.txt ? ? foo/dec/03.txt ? ? ... ? ? bar/jan/01.txt ? ? bar/jan/02.txt ? ? bar/jan/03.txt ? ? ... ? ? bar/feb/01.txt ? ? bar/feb/02.txt ? ? bar/feb/03.txt ? ? ... ? ? bar/dec/01.txt ? ? bar/dec/02.txt ? ? bar/dec/03.txt ? ? ... ? ? foobar/jan/01.txt ? ? foobar/jan/02.txt ? ? foobar/jan/03.txt ? ? ... ? ? foobar/feb/01.txt ? ? foobar/feb/02.txt ? ? foobar/feb/03.txt ? ? ... ? ? foobar/dec/01.txt ? ? foobar/dec/02.txt ? ? foobar/dec/03.txt ? ? ... Regrettably, not all Linux utilities have a recursive option, and I do not wish to take the time to re-write and debug functions which already are available as a standard utilities. A very tedious approach would be to "cd" to "foo/jan/" and run "dos2unix *.txt", then "cd" to "foo/feb/" and run "dos2unix *.txt", etc. I know that a Perl script can automate the process.? I just discovered the Perl "File::Find" module and the Perl "system" function, and now I am perusing the O'Reilly Perl books, trying to understand how to combine the two into a script. Afterward, I need to do involved search-and-replace processing on these files which cannot be handled with system utilities.? I previously have used Perl scripts for similar tasks, but never on a multi-level directory. So, learning how to run system utilities with "File::Find" appears to me to be the logical first step. RLH _______________________________________________ Houston mailing list Houston at pm.org http://mail.pm.org/mailman/listinfo/houston Website: http://houston.pm.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lanny.ripple at gmail.com Tue Sep 20 16:40:49 2011 From: lanny.ripple at gmail.com (Lanny Ripple) Date: Tue, 20 Sep 2011 18:40:49 -0500 Subject: [pm-h] File::Find and system In-Reply-To: <1316556997.44668.YahooMailNeo@web65810.mail.ac4.yahoo.com> References: <20110920214217.GA4052@broadcaster.org> <1316556997.44668.YahooMailNeo@web65810.mail.ac4.yahoo.com> Message-ID: <4E792481.3000806@gmail.com> First to Russell -- perldoc is your friend. `perldoc File::Find` will give you the documentation on File::Find and has several examples which pretty much cover everything you are looking for. The File::Find module, part of the standard perl install, should put `find2perl` in your path so you can execute the following find2perl . -type f -exec dos2unix which will give you a perl script doing what you want and ready for changes to implement your search-and-replace processing. Change "." to your target directory if you want to hard-code that. If not then you'll need to be in your target directory when you run the script. Mark -- You can golf your readdir down. See `perldoc -f readdir`. Enjoy, -ljr On 09/20/2011 05:16 PM, Mark Allen wrote: > Find::File is definitely more cross platform and tested for edge cases, but something like this works pretty well too. > > == SNIP == > > use strict; > use warnings; > > my $base = $1 || $ENV{'PWD'}; > > my @dirs = ( $base ); > > foreach my $dir ( @dirs ) { > opendir DIR, $dir; > while ( my $file = readdir DIR ) { > if ( -d "$dir/$file" ) { > next if ( $file eq "." or $file eq ".." ); > push @dirs, "$dir/$file"; > next; > } > > # do stuff, like maybe > print "Now processing $dir/$file..."; > `/usr/bin/dos2unix $dir/$file`; > print "done\n"; > } > closedir DIR; > } > > == SNIP END == > > Mark > > > > ________________________________ > From: Russell L. Harris > To: houston at pm.org > Sent: Tuesday, September 20, 2011 4:42 PM > Subject: [pm-h] File::Find and system > > Running Linux, I need to execute various system utilities (including > "dos2unix") on multiple files in multiple directories. The file > structure is similar to the following: > > foo/jan/01.txt > foo/jan/02.txt > foo/jan/03.txt > ... > foo/feb/01.txt > foo/feb/02.txt > foo/feb/03.txt > ... > foo/dec/01.txt > foo/dec/02.txt > foo/dec/03.txt > ... > bar/jan/01.txt > bar/jan/02.txt > bar/jan/03.txt > ... > bar/feb/01.txt > bar/feb/02.txt > bar/feb/03.txt > ... > bar/dec/01.txt > bar/dec/02.txt > bar/dec/03.txt > ... > foobar/jan/01.txt > foobar/jan/02.txt > foobar/jan/03.txt > ... > foobar/feb/01.txt > foobar/feb/02.txt > foobar/feb/03.txt > ... > foobar/dec/01.txt > foobar/dec/02.txt > foobar/dec/03.txt > ... > > Regrettably, not all Linux utilities have a recursive option, and I do > not wish to take the time to re-write and debug functions which > already are available as a standard utilities. > > A very tedious approach would be to "cd" to "foo/jan/" and run > "dos2unix *.txt", then "cd" to "foo/feb/" and run "dos2unix *.txt", > etc. > > I know that a Perl script can automate the process. I just discovered > the Perl "File::Find" module and the Perl "system" function, and now I > am perusing the O'Reilly Perl books, trying to understand how to > combine the two into a script. > > Afterward, I need to do involved search-and-replace processing on > these files which cannot be handled with system utilities. I > previously have used Perl scripts for similar tasks, but never on a > multi-level directory. > > So, learning how to run system utilities with "File::Find" appears to > me to be the logical first step. > > RLH > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ From gwadej at anomaly.org Tue Sep 20 19:11:26 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 20 Sep 2011 21:11:26 -0500 Subject: [pm-h] Fw: [Perlweekly] The current Perl Weekly News - Issue #8 Message-ID: <20110920211126.7d7752e0@cygnus> For those who haven't seen it yet, Gabor has been publishing a weekly newsletter on Perl. Here's the latest. Begin forwarded message: Date: Mon, 19 Sep 2011 00:23:59 -0700 From: Gabor Szabo To: perlweekly at perlweekly.com Subject: [Perlweekly] The current Perl Weekly News - Issue #8 Perl Weekly Issue #8 - September 19, 2011 http://perlweekly.com/ You can read the newsletter on the web, if you prefer. http://perlweekly.com/archive/8.html Hi there, This issue was mostly prepared on the train from Helsinki to Tampere. It's great to have wifi on trains, even it that means I missed some of the views of Finland. Never mind. I still caught a glimpse of the beautiful sky and we still have the trip back. New event: The Twin City Perl Workshop 2011 in Vienna and Bratislava, between 4-5 November has been announced. See details below. Experiment: The links to the articles are now using bit.ly in the e-mail. This will allow me to gain some insight which articles are more popular. Please let me know if something is not working. Poll: I am preparing a poll asking people (both Perl Weekly subscribers and others) what kind of articles would they be interested to read. I'd appreciate your help telling me what should be the options? Please reply in email! Now to the posts... Headlines The New OO Docs of Dave Rolsky for the Perl Core Have Been Merged http://bit.ly/pw_1000 After many months of working the new OOP docs written by Dave Rolsky finally reached the point when they could be merged into the core perl documentation. This means they will be part of the next official release of perl. If you are impatient to wait you can check out his blog entry and from there the link to the documentation. -------------- ack: 1.96 released with Groovy support http://betterthangrep.com/ ack is like grep, just better. -------------- ============= Articles How to Use Regular Expressions to Parse Nested Structures http://bit.ly/pw_1001 Peter Thoeny uses the SpreadSheetPlugin of TWiki as an example to show how to build a mixture of subroutines and regular expressions to parse data that can have nested elements. (eg. XML or HTML) -------------- Corelist web interface http://bit.ly/pw_1002 Tina M?ller (tinita) mentioned the web interface for the Corelist module she rebuilt. I have not seen this website earlier but I think it is really nice that you can check when was a module first included in the standard Perl distribution and which version of a module was included in each version of Perl. -------------- Perl for Google Fusion Tables http://bit.ly/pw_1003 'Fusion Tables is a new Google product for data storage: a kind of database' writes Robin Clarke (RCL) while introducing his new module Google::Fusion encapsulating the access to the service. -------------- 02packages.dependencies.txt.gz && apt-cpan http://bit.ly/pw_1004 For a long time I wanted a solution to be able to use CPAN.pm to install a module but let it default to apt-get (or yum) if a dependency is already available from the vendor. Jozef shows his solution using the MetaCPAN::API -------------- ============= Discussion Which is the better language to learn Perl or PHP? http://bit.ly/pw_1005 I wrote this article in response to a question I got. I tried to make the comparison related to the job opportunities. The article was quite popular but the strange thing was that some of the comments on Google Plus and Twitter related to the relative qualities of the two languages and not the career opportunities. -------------- RESTful Perl Resources http://bit.ly/pw_1006 chromatic asked for directions on how to explain and teach REST for Perl programmers. Several comments from well known Perl programmers pointed to the 'REST in Practice' book, a few articles and a CPAN module to help with the task. -------------- ============= Video Mojocast Authentication, Helpers, and Plugins http://bit.ly/pw_1007 Glen Hinkle (tempire) released the third episode of his Mojolicious screencast. -------------- Hello World http://bit.ly/pw_1008 Leo Lapworth (Ranguard) has just released a new, 2 minute screencast showing how to write hello world on the command line. -------------- ============= Games prisk (Games::Risk) gains its own map format, allowing translations! http://bit.ly/pw_1009 I have already managed to waste a lot of time playing Risk using prisk written by Jerome Quelin (jq). Now its your turn. New map format and a partial move to Moose will allow more people to get involved in the development and the localization of the game. -------------- ============= Code How to find files with Path::Class::Rule http://bit.ly/pw_1010 David Golden (dagolden) introduces his new module for traversing a directory structure an processing files and directories based on some rule. Think about a Perlish way of using the Unix find command. -------------- Faster HTTP usage http://bit.ly/pw_1011 Martin Evans compares the speed of LWP to WWW::Curl::Easy and shows how the latter is faster. The code is more complex though and I am not sure if being faster on the CPU really matters. After all these both solve network intensive tasks. Waiting for the HTTP request still takes a lot more time than the CPU usage. -------------- Tool for Perl Scripting - Devel::Comments http://bit.ly/pw_1012 Tyler Slijboom shows how to use your comments to have seamless logging in your code for easier debugging. Though it is not mentioned in the blog but Devel::Comments is a fork of Smart::Comments. For some reason I never used either of those but I should give them a try as the idea seems to be good. -------------- Perl Examples: Array of Arrays, Hash of Arrays, Hash of Hashes, Stack http://bit.ly/pw_1018 Sathiya Moorthy gives 5 simple examples dealing with complex data structures in Perl. -------------- ============= Perl 6 This is not enough! http://bit.ly/pw_1013 One of the biggest issues I had with Rakudo Perl 6 was its speed. I can program around some bugs. I can implement some missing CPAN modules but if it takes minutes to run my code instead of seconds I'll easily lose my patience. Jonathan Worthington describes how, getting a new and faster machine got him to improve the speed of Rakudo even further. - I think it is time for me to take another look at Rakudo. -------------- ============= Padre Padre realtime diff :) http://bit.ly/pw_1017 Ahmad M. Zawawi (azawawi) shows further progress in the development of Padre. Improved integration with VCS tools allows the Padre user to see the -------------- ============= Not Perl Bootstrap && Perl http://bit.ly/pw_1014 As miguel prz (niceperl) also pointed out this is not exactly a Perl post but I hope people from the Perl community will pick up the idea and integrate Bootstrap with their web framework. -------------- Success or failure ? with open source http://bit.ly/pw_1015 This is not a Perl specific post but I think people who are involved in open source Perl projects or who are using one - in short anyone using Perl - could benefit from reading and thinking about the question: 'What makes an open source project successful?' Is that what Ulrich Habel (rhaen) wrote or is that something else? -------------- ============= Events Twin City Perl Workshop http://bit.ly/pw_1016 November 4-5, 2011, Vienna, Austria and Bratislava, Slovakia -------------- ============= You joined the Perl Weekly to get weekly e-mails about the Perl programming language and related topics. Want to see more? See the archives ( http://perlweekly.com/archive/ ) of all the issues. Reading this as a non-subscriber? Join us free of charge. http://perlweekly.com/ (c) Gabor Szabo http://szabgab.com/ If you don't want to receive mails any more you can unsubscribe here: http://perlweekly.com/unsubscribe.html -- Never express yourself more clearly than you think. -- Niels Bohr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ Perlweekly mailing list Perlweekly at perlweekly.com http://mail.perlweekly.com/mailman/listinfo/perlweekly From toddr at cpanel.net Tue Sep 20 20:02:39 2011 From: toddr at cpanel.net (Todd Rinaldo) Date: Tue, 20 Sep 2011 22:02:39 -0500 Subject: [pm-h] File::Find and system In-Reply-To: <20110920214217.GA4052@broadcaster.org> References: <20110920214217.GA4052@broadcaster.org> Message-ID: Perl can do this but if you're just talking dos2unix and equally simple commands, you can go the shell route on this one... $> for file in (foo|bar|foobar)/*/*.txt; do dos2unix $file; done Add more commands if you like. On Sep 20, 2011, at 4:42 PM, Russell L. Harris wrote: > Running Linux, I need to execute various system utilities (including > "dos2unix") on multiple files in multiple directories. The file > structure is similar to the following: > > foo/jan/01.txt > foo/jan/02.txt > foo/jan/03.txt > ... > foo/feb/01.txt > foo/feb/02.txt > foo/feb/03.txt > ... > foo/dec/01.txt > foo/dec/02.txt > foo/dec/03.txt > ... > bar/jan/01.txt > bar/jan/02.txt > bar/jan/03.txt > ... > bar/feb/01.txt > bar/feb/02.txt > bar/feb/03.txt > ... > bar/dec/01.txt > bar/dec/02.txt > bar/dec/03.txt > ... > foobar/jan/01.txt > foobar/jan/02.txt > foobar/jan/03.txt > ... > foobar/feb/01.txt > foobar/feb/02.txt > foobar/feb/03.txt > ... > foobar/dec/01.txt > foobar/dec/02.txt > foobar/dec/03.txt > ... > > Regrettably, not all Linux utilities have a recursive option, and I do > not wish to take the time to re-write and debug functions which > already are available as a standard utilities. > > A very tedious approach would be to "cd" to "foo/jan/" and run > "dos2unix *.txt", then "cd" to "foo/feb/" and run "dos2unix *.txt", > etc. > > I know that a Perl script can automate the process. I just discovered > the Perl "File::Find" module and the Perl "system" function, and now I > am perusing the O'Reilly Perl books, trying to understand how to > combine the two into a script. > > Afterward, I need to do involved search-and-replace processing on > these files which cannot be handled with system utilities. I > previously have used Perl scripts for similar tasks, but never on a > multi-level directory. > > So, learning how to run system utilities with "File::Find" appears to > me to be the logical first step. > > RLH > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ Todd Rinaldo toddr at cpanel.net ---------------------------------------------------- cPanel Conference 2011- Automation Bootcamp Register at bootcamp.cpanel.net Discount Code: learn4free (FREE!) From erin at morderwerk.de Wed Sep 21 11:17:37 2011 From: erin at morderwerk.de (Erin Schoenhals) Date: Wed, 21 Sep 2011 13:17:37 -0500 Subject: [pm-h] File::Find and system In-Reply-To: References: <20110920214217.GA4052@broadcaster.org> Message-ID: find $dir -type f -name '*.txt' -print | while read file; do dos2unix < "$file" > "$file".tmp && mv "$file".tmp "$tmp" # and so on and so forth done There are many ways to prepare this holiday ham. (And yes, Bourne shell does not require a string concatenation operator within the context of a single positional parameter.) On Tue, Sep 20, 2011 at 10:02 PM, Todd Rinaldo wrote: > Perl can do this but if you're just talking dos2unix and equally simple > commands, you can go the shell route on this one... > > $> for file in (foo|bar|foobar)/*/*.txt; do dos2unix $file; done > > Add more commands if you like. > > > On Sep 20, 2011, at 4:42 PM, Russell L. Harris wrote: > > > Running Linux, I need to execute various system utilities (including > > "dos2unix") on multiple files in multiple directories. The file > > structure is similar to the following: > > > > foo/jan/01.txt > > foo/jan/02.txt > > foo/jan/03.txt > > ... > > foo/feb/01.txt > > foo/feb/02.txt > > foo/feb/03.txt > > ... > > foo/dec/01.txt > > foo/dec/02.txt > > foo/dec/03.txt > > ... > > bar/jan/01.txt > > bar/jan/02.txt > > bar/jan/03.txt > > ... > > bar/feb/01.txt > > bar/feb/02.txt > > bar/feb/03.txt > > ... > > bar/dec/01.txt > > bar/dec/02.txt > > bar/dec/03.txt > > ... > > foobar/jan/01.txt > > foobar/jan/02.txt > > foobar/jan/03.txt > > ... > > foobar/feb/01.txt > > foobar/feb/02.txt > > foobar/feb/03.txt > > ... > > foobar/dec/01.txt > > foobar/dec/02.txt > > foobar/dec/03.txt > > ... > > > > Regrettably, not all Linux utilities have a recursive option, and I do > > not wish to take the time to re-write and debug functions which > > already are available as a standard utilities. > > > > A very tedious approach would be to "cd" to "foo/jan/" and run > > "dos2unix *.txt", then "cd" to "foo/feb/" and run "dos2unix *.txt", > > etc. > > > > I know that a Perl script can automate the process. I just discovered > > the Perl "File::Find" module and the Perl "system" function, and now I > > am perusing the O'Reilly Perl books, trying to understand how to > > combine the two into a script. > > > > Afterward, I need to do involved search-and-replace processing on > > these files which cannot be handled with system utilities. I > > previously have used Perl scripts for similar tasks, but never on a > > multi-level directory. > > > > So, learning how to run system utilities with "File::Find" appears to > > me to be the logical first step. > > > > RLH > > _______________________________________________ > > Houston mailing list > > Houston at pm.org > > http://mail.pm.org/mailman/listinfo/houston > > Website: http://houston.pm.org/ > > > Todd Rinaldo > toddr at cpanel.net > > ---------------------------------------------------- > cPanel Conference 2011- > Automation Bootcamp > Register at bootcamp.cpanel.net > Discount Code: learn4free (FREE!) > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwadej at anomaly.org Mon Sep 26 05:04:21 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Mon, 26 Sep 2011 07:04:21 -0500 Subject: [pm-h] Fw: [pm_groups] Perl Poll: What would you like to read about? Message-ID: <20110926070421.05d73383@cygnus> Begin forwarded message: Date: Mon, 26 Sep 2011 09:21:00 +0300 From: Gabor Szabo To: PM Groups Subject: [pm_groups] Perl Poll: What would you like to read about? Hi, I have set up a new web site for running polls, to allow people in the Perl community figure out what others in the community think. I plan to run one very quick poll every month. This time I'd like to know what would you like to read about in the Perl blogs. For the full article visit: http://szabgab.com/blog/2011/09/perl-poll-what-would-you-like-to-read-about.html To go directly to the poll visit http://perlpolls.com/perl-news Perl Mongers =============== As I'd like to reach as many Perl user/programmers as possible and there are only 4 days to complete the poll I'd like to ask your help. Please forward this message (or an improved version of it) to your Perl Mongers groups. If you also forward it to your co-workers, that would be just a bonus. regards Gabor -- Request pm.org Technical Support via support at pm.org pm_groups mailing list pm_groups at pm.org http://mail.pm.org/mailman/listinfo/pm_groups -- The single most important rule of testing is to do it. -- Brian Kernighan and Rob Pike, "The Practice of Programming" From gwadej at anomaly.org Wed Sep 28 20:59:02 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 28 Sep 2011 22:59:02 -0500 Subject: [pm-h] October Houston.pm Meeting Message-ID: <20110928225902.223e7a31@cygnus> It's two weeks until our next Houston.pm meeting on Thursday, Oct. 13. Once again, there have not been any volunteers to present yet. Is there anyone out there who is interested in presenting? Are there any topics you would like to see someone present? The lightning talks last month seemed to go fairly well. If we could get 8-12 people willing to give lightning talks, that would make a reasonable meeting. All that's needed is up to 5 minutes of a presentation (if you wanted to use slides, that's 3 or fewer). Let me know if you are interested. If you are interested, but can't be ready in two weeks, remember November is also open. Volunteer early. G. Wade -- Virtual is when it's not but it looks like it is and transparent is when it is but it looks like it isn't. -- Rick Hoselton From gwadej at anomaly.org Thu Sep 29 20:04:25 2011 From: gwadej at anomaly.org (G. Wade Johnson) Date: Thu, 29 Sep 2011 22:04:25 -0500 Subject: [pm-h] October Houston.pm Technical meeting Message-ID: <20110929220425.1cfeb614@cygnus> Reini Urban has volunteered to present for the October meeting. The topic is a basic introduction to the Perl compiler. A number of you may not have been aware that Perl had a compiler. Most people are content to use Perl in its normal compile/execute mode. Because people had use cases that would benefit from building an executable from their Perl code, a Perl compiler was built years ago. Recently Reini has been taking the old compiler code and updating it to support more current Perls. In this talk, Reini will cover * basic usage of the compiler and its current status * the different "phases" of in the lifetime of Perl code * some understanding of Perl OPs and what the compiler does with them He will also answer questions like: * How big will my compiled code be? * What will the program include at compile-time, what is deferred to run-time? This meeting will be more technical than usual, but it's a rare opportunity to talk with someone who understands Perl's internals. You really don't want to miss it. As always, our meeting will begin around 7pm on the second Thursday of the month, October 13. We will meet at the normal location, 3131 W. Alabama. Please let me know if you plan to attend, so I can be certain of the food order. I look forward to seeing you there. G. Wade -- Trying to outsmart a compiler defeats much of the purpose of using one. -- Brian Kernighan and P.J. Plauger