From nik at ngo.org.uk Thu Apr 13 02:03:32 2006 From: nik at ngo.org.uk (Nik Clayton) Date: Thu, 13 Apr 2006 02:03:32 -0700 (PDT) Subject: Overriding qx// Message-ID: <8320.192.193.245.16.1144919012.squirrel@jc.ngo.org.uk> I've just discovered that I've reimplemented something very similar to Richard Clamp's Devel::System module (see slides 21-25 of http://miltonkeynes.pm.org/talks/2006/03/nik_clayton_testing_legacy_code.pdf). But it looks like both our efforts have the same problem. Namely, they don't deal with code run through qx// or backticks. system('echo foo'); is caught, print `echo foo`; isn't. I thought I might be able to use overload::constant to do this, so I whipped up this test code: package System; use overload; my %handler = (q => sub { print STDERR join(':', @_), "\n"; return $_[1]; } ); sub import { overload::constant %handler; } 1; Unfortunately, for the aforementioned print `echo foo`; it gives this on STDERR: echo foo:echo foo:qq So, no indication that the quoted string is being used in an execution context. This matches what the docs say. Anyone got any insights as to how this might be achieved (short of grubbing around with XS)? N From mkpm-20051014 at djce.org.uk Thu Apr 13 12:13:04 2006 From: mkpm-20051014 at djce.org.uk (Dave Evans) Date: Thu, 13 Apr 2006 20:13:04 +0100 Subject: Overriding qx// In-Reply-To: <8320.192.193.245.16.1144919012.squirrel@jc.ngo.org.uk> References: <8320.192.193.245.16.1144919012.squirrel@jc.ngo.org.uk> Message-ID: <20060413191304.GA6586@ratty> On Thu, Apr 13, 2006 at 02:03:32AM -0700, Nik Clayton wrote: > Anyone got any insights as to how this might be achieved (short of > grubbing around with XS)? The answer that immediately came to mind was to modify the syntax tree after compilation: i.e. turn the code "qx('stuff')": LISTOP (0x81703a0) leave [1] OP (0x81702b0) enter COP (0x8170340) nextstate LISTOP (0x81704a8) print OP (0x8170300) pushmark UNOP (0x8170620) backtick [1] OP (0x81705c8) null [3] SVOP (0x81704e0) const [2] PV (0x81526b4) "stuff" into "do_qx('stuff')": LISTOP (0x81703a0) leave [1] OP (0x8170320) enter COP (0x8170340) nextstate LISTOP (0x81704a8) print OP (0x81702d0) pushmark UNOP (0x815a138) entersub [2] UNOP (0x8170620) null [141] OP (0x815a0e0) pushmark SVOP (0x81702b0) const [3] PV (0x8152630) "stuff" UNOP (0x81705c8) null [17] PADOP (0x81704e0) gv GV (0x81526b4) *do_qx (and then implement the "do_qx" sub, of course). Furthermore, the obvious point of reference for this was an article I read a while back, by Damien Conway I suspect, about how to modify Acme::Don't so that "don't { ... } unless ..." does The Right Thing. However, I can't find the article :-( I suspect it used B::Utils and/or B::Generate, and I can't get B::Generate to compile. So this post may or may not be any help to you. Regards, -- Dave Evans PGP key: http://rudolf.org.uk/pgpkey -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 191 bytes Desc: Digital signature Url : http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20060413/0498c9e5/attachment.bin From tom at eborcom.com Wed Apr 19 10:58:52 2006 From: tom at eborcom.com (Tom Hukins) Date: Wed, 19 Apr 2006 18:58:52 +0100 Subject: Meeting: Tuesday 25th April 2006 Message-ID: <20060419175852.GB93210@eborcom.com> It's been a while, but next Tuesday is the last of this month. As usual, we'll meet in Wetherspoon's near the railway station (not the one in the snow dome). I'll show up some time between 7 and 7.30, but feel free to arrive whenever suits you. We've checked the MK Dons fixture list, so the pub should be less crowded than last time.. I look forward to seeing lots of you, regulars and newcomers alike. Let's see if we can beat last month's pub attendance record of 7. We're not too hard to find, but if you'd like my mobile number please ask off list. See the Web site for more details: http://miltonkeynes.pm.org/ See you all soon, Tom From tom at eborcom.com Mon Apr 24 14:29:08 2006 From: tom at eborcom.com (Tom Hukins) Date: Mon, 24 Apr 2006 22:29:08 +0100 Subject: Forthcoming Meetings Message-ID: <20060424212908.GA27502@eborcom.com> A quick reminder and a couple of announcements: Our April pub meeting takes place tomorrow (Tuesday): http://mail.pm.org/pipermail/miltonkeynes-pm/2006-April/000086.html Our May pub meeting sees Birmingham.pm join us as part of their "World Tour" of UK Perl Mongers groups: http://birmingham.pm.org/cgi-bin/brum.pl?act=evnt-main (note, May 23rd, not 25th) Finally, our next technical meeting takes place on Tuesday 13th June. We haven't confirmed the location yet, but that looks like happening soon. We're looking for more speakers, so let me know if you can think of anything you would like to tell us about. We have another well-known guest speaker this time: I'll tell you who in the pub tomorrow if you ask nicely. See you all soon, Tom From tom at eborcom.com Sun Apr 30 11:02:58 2006 From: tom at eborcom.com (Tom Hukins) Date: Sun, 30 Apr 2006 19:02:58 +0100 Subject: Forthcoming Meetings In-Reply-To: <20060424212908.GA27502@eborcom.com> References: <20060424212908.GA27502@eborcom.com> Message-ID: <20060430180258.GA7600@eborcom.com> On Mon, Apr 24, 2006 at 10:29:08PM +0100, Tom Hukins wrote: > Our May pub meeting sees Birmingham.pm join us as part of their "World > Tour" of UK Perl Mongers groups: > http://birmingham.pm.org/cgi-bin/brum.pl?act=evnt-main > (note, May 23rd, not 25th) Alert readers will notice that the last Tuesday in May falls on the 30th. I just noticed this while updating the Web page. Whoops! Let's stick to the 23rd for our May meeting as I've already announced this date and note that we _usually_ meet on the last Tuesday of the month. But sometimes we meet at other times instead. I hope you're all enjoying the long weekend. Tom From andrew-li at black1.org.uk Sun Apr 30 11:09:41 2006 From: andrew-li at black1.org.uk (andrew Black) Date: Sun, 30 Apr 2006 19:09:41 +0100 Subject: Forthcoming Meetings In-Reply-To: <20060430180258.GA7600@eborcom.com> References: <20060424212908.GA27502@eborcom.com> <20060430180258.GA7600@eborcom.com> Message-ID: <4454FD65.1060700@black1.org.uk> Tom Hukins wrote: > On Mon, Apr 24, 2006 at 10:29:08PM +0100, Tom Hukins wrote: > >>Our May pub meeting sees Birmingham.pm join us as part of their "World >>Tour" of UK Perl Mongers groups: >>http://birmingham.pm.org/cgi-bin/brum.pl?act=evnt-main >>(note, May 23rd, not 25th) > > > Alert readers will notice that the last Tuesday in May falls on the > 30th. I just noticed this while updating the Web page. Whoops! Maybe the MK heritics could meet on the 30th :-) From I.A.Cameron at open.ac.uk Sun Apr 30 15:06:50 2006 From: I.A.Cameron at open.ac.uk (Ian Cameron) Date: Sun, 30 Apr 2006 23:06:50 +0100 Subject: Forthcoming Meetings In-Reply-To: <4454FD65.1060700@black1.org.uk> References: <20060424212908.GA27502@eborcom.com> <20060430180258.GA7600@eborcom.com> <4454FD65.1060700@black1.org.uk> Message-ID: <200604302207.XAA12472@damson.open.ac.uk> andrew Black said: > Maybe the MK heritics could meet on the 30th :-) So, what are you up to on the 30th then Rod? ;) -- Cheers, Ian.