From pjf at perltraining.com.au Tue Jan 1 03:32:25 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Tue, 01 Jan 2008 22:32:25 +1100 Subject: [Melbourne-pm] Namespace Guidelines? In-Reply-To: <28F99384-15BB-42A2-9EE8-96E794DE5E0A@gmail.com> References: <28F99384-15BB-42A2-9EE8-96E794DE5E0A@gmail.com> Message-ID: <477A24C9.4030306@perltraining.com.au> G'day Kat and Melb.pm, Kat Grant wrote: > Does anyone know of any nice articles outlining guidelines for OO > perl namespaces? You can find some advice under "Select a name for the module" in perlmodlib. There's also the perl modules list, which is filled with incredibly pedantic CPAN admins. While it's primarily useful in getting namespaces sorted for upload to CPAN, if anyone does have a good set of guidelines written down, they will. You can try dropping a mail to them at modules at perl.org, or you can do what I do and find Adam Kennedy as my local CPAN admin on IRC (he's usually found as 'alias' on #win32 on irc.perl.org). When uploading to CPAN, my general rules would be: * Go from most general to most specific * Follow existing conventions when possible * Talk to others for a sanity check The "Local::" namespace is reserved for modules that will never be distributed (and never appear on CPAN); however it appears there's also a guarantee[1] that there won't be any modules on CPAN which contain underscores. So a prefix in the style of My_Business:: can be used if you want to be absolutely sure there'll never be any sort of conflict. In my experience, the reserved namespaces look awful, so like many companies we've picked a short and obvious prefix for our internal modules (in our case, PTA:: ). As for OO guidelines, it's fairly natural for one to expect containership to mean inheritance. For example, Bird is a parent of Bird::Chicken is a parent of Bird::Chicken::Australorp. If you have nested packages that *don't* have inheritance (for internal modules) then I suggest you consider if there's a way to name about that. The same applies in the reverse; do you have inherited classes that end up in completely different packages? If you do, is there a good reason? Apologies for the not particularly in-depth response, however if you do find a good set of guidelines written down, I'd love to see them. All the best, Paul [1] According to perlmodlib -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From wigs at stirfried.org Tue Jan 1 14:35:25 2008 From: wigs at stirfried.org (wigs at stirfried.org) Date: Wed, 2 Jan 2008 09:35:25 +1100 Subject: [Melbourne-pm] Namespace Guidelines? In-Reply-To: <477A24C9.4030306@perltraining.com.au> References: <28F99384-15BB-42A2-9EE8-96E794DE5E0A@gmail.com> <477A24C9.4030306@perltraining.com.au> Message-ID: <20080101223525.GA19627@stirfried.org> On Tue, Jan 01, 2008 at 10:32:25PM +1100, Paul Fenwick wrote: > As for OO guidelines, it's fairly natural for one to expect containership to > mean inheritance. For example, Bird is a parent of Bird::Chicken is a > parent of Bird::Chicken::Australorp. I disagree with this - in the general case I have not found this expectation to be natural at all. The principle problem I have with containership implying inheritance is that it violates DRY. You have duplicated information in both the @ISA/use base statements, as well as in the module name, and thus adds more to the maintenance costs of your code. Consider this situation: what happens if you ever need to refactor one of your super classes? Say, for example, you decide one day that, besides dealing with Birds, your code also needs to deal with Reptiles, which at some abstractly primitive level bears some similarity to birds. So, inspecting your code you find some reusable elements within Bird.pm, and you pull that up into Animal.pm; so that Reptile.pm (and thus Reptile::Lizard and Reptile::Snake) can inherit it. At this stage you either have a dilemma with your code: - do you break your module naming convention, and have Bird::Chicken isa Bird isa Animal, Reptile::Snake isa Reptile isa Animal? - or do you try to stay consistent with the naming scheme and rename *everywhere* the classes involved? Animal::Bird::Chicken isa Animal::Bird isa Animal Animal::Reptile::Snake isa Animal::Reptile isa Animal? (And then what happens when you want to start involving Plants in your object taxonomy?) Secondarily, Perl permits multiple inheritance. How would this be best included into any module name that implied inheritance via containership? > Apologies for the not particularly in-depth response, however if you do find > a good set of guidelines written down, I'd love to see them. Agreed, I would also like to see them too. I do remember mention about the 'Local::' namespace, but could not find any suitable documentation in a timely manner for an earlier reply to this thread. Happy New Year. -- Aaron From crashkat at gmail.com Wed Jan 2 20:03:30 2008 From: crashkat at gmail.com (Kat Grant) Date: Thu, 3 Jan 2008 15:03:30 +1100 Subject: [Melbourne-pm] Namespace Guidelines? In-Reply-To: <477A24C9.4030306@perltraining.com.au> References: <28F99384-15BB-42A2-9EE8-96E794DE5E0A@gmail.com> <477A24C9.4030306@perltraining.com.au> Message-ID: <17F977FA-62B0-4728-A04A-F4464B40646E@gmail.com> Thanks Paul This pretty much covers what I was looking for. Still wish I could find that (perhaps imaginary) article that I think i read, but this will do. Cheers K On 01/01/2008, at 10:32 PM, Paul Fenwick wrote: > G'day Kat and Melb.pm, > > Kat Grant wrote: > >> Does anyone know of any nice articles outlining guidelines for OO >> perl namespaces? > > You can find some advice under "Select a name for the module" in > perlmodlib. > There's also the perl modules list, which is filled with incredibly > pedantic CPAN admins. While it's primarily useful in getting > namespaces > sorted for upload to CPAN, if anyone does have a good set of > guidelines > written down, they will. You can try dropping a mail to them at > modules at perl.org, or you can do what I do and find Adam Kennedy as > my local > CPAN admin on IRC (he's usually found as 'alias' on #win32 on > irc.perl.org). > > When uploading to CPAN, my general rules would be: > > * Go from most general to most specific > * Follow existing conventions when possible > * Talk to others for a sanity check > > The "Local::" namespace is reserved for modules that will never be > distributed (and never appear on CPAN); however it appears there's > also a > guarantee[1] that there won't be any modules on CPAN which contain > underscores. So a prefix in the style of My_Business:: can be used > if you > want to be absolutely sure there'll never be any sort of conflict. > > In my experience, the reserved namespaces look awful, so like many > companies > we've picked a short and obvious prefix for our internal modules > (in our > case, PTA:: ). > > As for OO guidelines, it's fairly natural for one to expect > containership to > mean inheritance. For example, Bird is a parent of Bird::Chicken is a > parent of Bird::Chicken::Australorp. If you have nested packages that > *don't* have inheritance (for internal modules) then I suggest you > consider > if there's a way to name about that. The same applies in the > reverse; do > you have inherited classes that end up in completely different > packages? If > you do, is there a good reason? > > Apologies for the not particularly in-depth response, however if > you do find > a good set of guidelines written down, I'd love to see them. > > All the best, > > Paul > > [1] According to perlmodlib > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 From jarich at perltraining.com.au Sun Jan 6 22:11:56 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 07 Jan 2008 17:11:56 +1100 Subject: [Melbourne-pm] Meeting this week? Message-ID: <4781C2AC.4000607@perltraining.com.au> It's the second Wednesday of the month in a couple of days, and at least for the last two years we've had lightning talks at such a meeting.... J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From melbourne.pm at joshheumann.com Sun Jan 6 22:16:39 2008 From: melbourne.pm at joshheumann.com (Josh Heumann) Date: Sun, 6 Jan 2008 22:16:39 -0800 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <4781C2AC.4000607@perltraining.com.au> References: <4781C2AC.4000607@perltraining.com.au> Message-ID: <20080107061639.GB27386@joshheumann.com> > It's the second Wednesday of the month in a couple of days, and at least for the > last two years we've had lightning talks at such a meeting.... May I suggest the oft-discussed game night, should things run short? J From jarich at perltraining.com.au Sun Jan 6 23:28:28 2008 From: jarich at perltraining.com.au (jarich at perltraining.com.au) Date: Mon, 7 Jan 2008 18:28:28 +1100 (EST) Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 Message-ID: <20080107072828.E084FA94B3@teddybear.perltraining.com.au> Dear Melbourne Perl Mongers members, I have yet to hear from someone in this group about hosting a free community table at this year's LCA Open Day. >From January 28th - February 2nd, Melbourne will host one of the world's best FOSS conferences: Linux.conf.au. On the last day, Saturday February 2nd we will be running an Open Day for the general public to showcase open source. The 2007 open day had a fantastic line-up of displays including: - Virtual Reality - Blender 3D - One Laptop Per Child - MythTV - Linux Gaming (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) To make this day more fabulous, I would like to invite your group to host a community table. There are only two requirements: - Open Source must be involved. - You need to supply your own computers, flyers and people. In return, we'll supply you with tables, chairs, power sources, wireless (hopefully), food, drink and visitors. With luck you can raise the profile of your user group (and get some more members) while increasing the attendees' awareness of Open Source. If your group would be interested in having a stand, please let me know by either responding to this email or contacting openday at mel8ourne.org If you'd like to attend or if you know anyone who might like to attend please register (it's free) at: http://linux.conf.au/programme/open-day Everyone is welcome and I encourage you to bring your friends and family. All the best, Jacinta From alecclews at gmail.com Mon Jan 7 00:30:40 2008 From: alecclews at gmail.com (Alec Clews) Date: Mon, 07 Jan 2008 19:30:40 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <4781C2AC.4000607@perltraining.com.au> Message-ID: I will be in Sydney I'm afraid so I can't join you. Have a great time. -- Alec Clews Personal Melbourne, Australia. Jabber: alecclews at jabber.org.au PGPKey ID: 0x9BBBFC7C Blog http://alecthegeek.wordpress.com/ > From: Jacinta Richardson > Organization: Perl Training Australia Pty Ltd > Date: Mon, 07 Jan 2008 17:11:56 +1100 > To: Melbourne Perl Mongers - Committee , > Melbourne Perlmongers > Subject: [Melbourne-pm] Meeting this week? > > It's the second Wednesday of the month in a couple of days, and at least for > the > last two years we've had lightning talks at such a meeting.... > > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From alecclews at gmail.com Mon Jan 7 15:17:53 2008 From: alecclews at gmail.com (Alec Clews) Date: Tue, 8 Jan 2008 10:17:53 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 In-Reply-To: <20080107072828.E084FA94B3@teddybear.perltraining.com.au> References: <20080107072828.E084FA94B3@teddybear.perltraining.com.au> Message-ID: I'd be happy to help staff this -- will anyone else be prepared to help please? On 07/01/2008, at 6:28 PM, jarich at perltraining.com.au wrote: > Dear Melbourne Perl Mongers members, > > I have yet to hear from someone in this group about hosting a free > community > table at this year's LCA Open Day. > >> From January 28th - February 2nd, Melbourne will host one of the > world's best FOSS conferences: Linux.conf.au. On the last day, > Saturday > February 2nd we will be running an Open Day for the general public to > showcase open source. The 2007 open day had a fantastic line-up of > displays including: > > - Virtual Reality > - Blender 3D > - One Laptop Per Child > - MythTV > - Linux Gaming > > (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) > > To make this day more fabulous, I would like to invite your group to > host a > community table. There are only two requirements: > > - Open Source must be involved. > - You need to supply your own computers, flyers and people. > > In return, we'll supply you with tables, chairs, power sources, > wireless > (hopefully), food, drink and visitors. With luck you can raise the > profile of > your user group (and get some more members) while increasing the > attendees' > awareness of Open Source. > > If your group would be interested in having a stand, please let me > know by > either responding to this email or contacting openday at mel8ourne.org > If > you'd like to attend or if you know anyone who might like to attend > please > register (it's free) at: > > http://linux.conf.au/programme/open-day > > Everyone is welcome and I encourage you to bring your friends and > family. > > All the best, > > Jacinta > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From skud at infotrope.net Mon Jan 7 15:29:19 2008 From: skud at infotrope.net (Kirrily Robert) Date: Tue, 8 Jan 2008 10:29:19 +1100 Subject: [Melbourne-pm] I'm (almost) off Message-ID: Well, I'm off to SF in less than a week, so I'm cleaning up my email subscriptions. I'll be dropping off Melbourne.pm for now, but I wish you all the best and please keep in touch if you feel the urge. Later, K. -- Kirrily Robert skud at infotrope.net http://infotrope.net From leif.eriksen at hpa.com.au Mon Jan 7 15:43:32 2008 From: leif.eriksen at hpa.com.au (leif.eriksen at hpa.com.au) Date: Tue, 8 Jan 2008 10:43:32 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 Message-ID: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> I too can help for a couple of hours. Morning or afternoon ? What kind of stuff do we want to do ? Flyers and stuff need to be organised, and we should see if we can pump someone for some prizes that people who come to our table can win. We could also run some kind of activity - mind runs wild at this point... We could do some talks, my fav would be something to dispel the 'Perl is write-only' perception - so a short 20 minutes showing some exceptionally clear Perl. We could do that every couple of hours. On that slant, what about a modified Mythbuster's-style theme where we take common Perl misconceptions and bust em!! I bags being Jamie - I may even have enough time to grow a moustache. I nominate Alfie to be Adam - just cause I think it would be really funny to see him get blown up ! We are going to blow stuff up, right ? We could run a hack-a-thon for ourselves, something to do between talking to attendees - if we could organise a projector to use this as a background , it would make a great "what are they doing over there, where the big emacs session is ? Dunno, lets have a look" I dunno if Scott is free and up to dragging the big board out again. What about hooking up some stepper motors to the transmitter for your R/C helicopter - we'll use your Device::Serial and some driver boards to write a flight control program !! Should take only a day ! L > -----Original Message----- > From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org > [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] > On Behalf Of jarich at perltraining.com.au > Sent: Monday, 7 January 2008 6:28 PM > To: melbourne-pm at pm.org > Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 > > Dear Melbourne Perl Mongers members, > > I have yet to hear from someone in this group about hosting a > free community table at this year's LCA Open Day. > > >From January 28th - February 2nd, Melbourne will host one of the > world's best FOSS conferences: Linux.conf.au. On the last > day, Saturday February 2nd we will be running an Open Day for > the general public to showcase open source. The 2007 open > day had a fantastic line-up of displays including: > > - Virtual Reality > - Blender 3D > - One Laptop Per Child > - MythTV > - Linux Gaming > > (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) > > To make this day more fabulous, I would like to invite your > group to host a community table. There are only two requirements: > > - Open Source must be involved. > - You need to supply your own computers, flyers and people. > > In return, we'll supply you with tables, chairs, power > sources, wireless (hopefully), food, drink and visitors. > With luck you can raise the profile of your user group (and > get some more members) while increasing the attendees' > awareness of Open Source. > > If your group would be interested in having a stand, please > let me know by either responding to this email or contacting > openday at mel8ourne.org If you'd like to attend or if you know > anyone who might like to attend please register (it's free) at: > > http://linux.conf.au/programme/open-day > > Everyone is welcome and I encourage you to bring your friends > and family. > > All the best, > > Jacinta > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > ********************************************************************** IMPORTANT The contents of this e-mail and its attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au, then delete the e-mail. This footnote also confirms that this e-mail message has been swept for the presence of computer viruses by Ironport. Before opening or using any attachments, check them for viruses and defects. Our liability is limited to resupplying any affected attachments. HPA collects personal information to provide and market our services. For more information about use, disclosure and access see our Privacy Policy at www.hpa.com.au ********************************************************************** From Stephen.Edmonds at its.monash.edu.au Mon Jan 7 16:12:41 2008 From: Stephen.Edmonds at its.monash.edu.au (Stephen Edmonds) Date: Tue, 08 Jan 2008 11:12:41 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <20080107061639.GB27386@joshheumann.com> References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> Message-ID: <4782BFF9.804@its.monash.edu.au> I'd be up for something, even if it is just going to the pub :) However, I'd need to know soon if we are having a meeting tomorrow as I do have to plan ahead. I suspect others would be in a similar situation. Thanks, Stephen Josh Heumann wrote: > >> It's the second Wednesday of the month in a couple of days, and at least for the >> last two years we've had lightning talks at such a meeting.... > > May I suggest the oft-discussed game night, should things run short? > > J > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm -- Stephen Edmonds Senior Portal Developer / Integrator Flexible Learning and Teaching Program Information Technology Services, Monash University From ddick at aapt.net.au Mon Jan 7 22:37:12 2008 From: ddick at aapt.net.au (David Dick) Date: Tue, 08 Jan 2008 17:37:12 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <4781C2AC.4000607@perltraining.com.au> References: <4781C2AC.4000607@perltraining.com.au> Message-ID: <47831A18.3050207@aapt.net.au> Jacinta Richardson wrote: > It's the second Wednesday of the month in a couple of days, and at least for the > last two years we've had lightning talks at such a meeting.... > > I'd be happy to chat for a couple of minutes on playing with perl and fastcgi ???? From crshort at gmail.com Tue Jan 8 16:44:51 2008 From: crshort at gmail.com (Christopher Short) Date: Wed, 9 Jan 2008 11:44:51 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <20080107061639.GB27386@joshheumann.com> References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> Message-ID: Well, on the off-chance that David's talk does only go for two minutes (!) ... and people are at a loose end, I've chucked into my bag a couple of packs of cards and a couple of my smaller games. (Bang! & Fluxx) cheers, Christopher On 07/01/2008, Josh Heumann wrote: > > > It's the second Wednesday of the month in a couple of days, and at least for the > > last two years we've had lightning talks at such a meeting.... > > May I suggest the oft-discussed game night, should things run short? > > J > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > From toby.corkindale at rea-group.com Tue Jan 8 19:51:20 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Wed, 09 Jan 2008 14:51:20 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> Message-ID: <478444B8.9000109@rea-group.com> I don't know why, but the last couple of emails I sent to the list from home (1 and 2 days ago respectively) don't seem to have come through. (Can someone check logs for tjc (at) wintrmute (dot) net?) Synopsis: * Even if there are no talks, there is still the pub! * I'll bring Carcasonne to play at the meeting Toby Christopher Short wrote: > Well, on the off-chance that David's talk does only go for two minutes (!) > ... and people are at a loose end, I've chucked into my bag a couple > of packs of cards and a couple of my smaller games. (Bang! & Fluxx) > cheers, > Christopher > > On 07/01/2008, Josh Heumann wrote: >> >>> It's the second Wednesday of the month in a couple of days, and at least for the >>> last two years we've had lightning talks at such a meeting.... >> May I suggest the oft-discussed game night, should things run short? From ddick at aapt.net.au Tue Jan 8 20:48:30 2008 From: ddick at aapt.net.au (David Dick) Date: Wed, 09 Jan 2008 15:48:30 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> Message-ID: <4784521E.6020609@aapt.net.au> Christopher Short wrote: > Well, on the off-chance that David's talk does only go for two minutes (!) > Fastcgi talk will have to wait unfortunately. Due a series of unfortunate events, it seems i won't be able to make tonight. Much apologies for the late notice. From toby.corkindale at rea-group.com Tue Jan 8 21:02:33 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Wed, 09 Jan 2008 16:02:33 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <4784521E.6020609@aapt.net.au> References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> <4784521E.6020609@aapt.net.au> Message-ID: <47845569.5070600@rea-group.com> David Dick wrote: > Christopher Short wrote: >> Well, on the off-chance that David's talk does only go for two minutes (!) >> > Fastcgi talk will have to wait unfortunately. Due a series of > unfortunate events, it seems i won't be able to make tonight. Much > apologies for the late notice. I'm feeling like I have a headcold, but I could try and give a 5 minute talk on the difference between running Apache+mod_perl w/forks, Apache+mod_perl w/threads, and lighttpd+fastcgi, and the pros and cons thereof? This would be a no-slides-and-no-preparation spectacular though.. so possibly spectacular failure ;) -- Toby Corkindale Software developer From Jennifer.Wade at mentaura.com.au Tue Jan 8 21:13:01 2008 From: Jennifer.Wade at mentaura.com.au (Jennifer Wade) Date: Wed, 9 Jan 2008 16:13:01 +1100 Subject: [Melbourne-pm] Web Developer - Perl & PHP Message-ID: <4C6B9F265085F647A5214A9586C9ED4FC7FE49@rsa.Mentaura.local> A well known brand in the travel industry offering a great package with benefits and an opportunity to work with a vibrant and dynamic environment. They are looking for a Web Developer to join their established team to be responsible for the design, development and maintenance of a range of web services. To be considered for this role you will have strong experience in development of large, complex web systems. Technical skills required include PERL, PHP, HTML and JavaScript. You would also demonstrate understanding of LAMP environments. To express your interest in this great opportunity, email a copy of your CV to resume at mentaura.com.au or contact us on 9863 9600 for a confidential discussion. Jennifer Wade | Senior Consultant Mentaura Recruitment Australia Level 2, 1 Queens Road Melbourne Victoria 3004 Australia t: + 61 3 9863 9600 m: 0422 451 204 i: www.mentaura.com.au The information in this e-mail is confidential and may be protected by legal professional privilege. The contents (including attachments) may also be subject to Copyright. It is intended solely for the addressee and access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you have received this message in error, please notify us immediately. Please also destroy and delete the message from your computer. ________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080109/fc17f49f/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 19556 bytes Desc: image001.jpg Url : http://mail.pm.org/pipermail/melbourne-pm/attachments/20080109/fc17f49f/attachment-0001.jpe From Stephen.Edmonds at its.monash.edu.au Tue Jan 8 21:16:21 2008 From: Stephen.Edmonds at its.monash.edu.au (Stephen Edmonds) Date: Wed, 09 Jan 2008 16:16:21 +1100 Subject: [Melbourne-pm] Meeting this week? In-Reply-To: <4784521E.6020609@aapt.net.au> References: <4781C2AC.4000607@perltraining.com.au> <20080107061639.GB27386@joshheumann.com> <4784521E.6020609@aapt.net.au> Message-ID: <478458A5.3080104@its.monash.edu.au> Despite my enthusiasm yesterday, I will also not be able to make it tonight. Stephen David Dick wrote: > Christopher Short wrote: >> Well, on the off-chance that David's talk does only go for two minutes (!) >> > Fastcgi talk will have to wait unfortunately. Due a series of > unfortunate events, it seems i won't be able to make tonight. Much > apologies for the late notice. > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm -- Stephen Edmonds Senior Portal Developer / Integrator Flexible Learning and Teaching Program Information Technology Services, Monash University From jarich at perltraining.com.au Tue Jan 8 23:23:59 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Wed, 09 Jan 2008 18:23:59 +1100 Subject: [Melbourne-pm] Secure programming conferences/training courses Message-ID: <4784768F.60908@perltraining.com.au> G'day folk, A potential client of ours has asked for advice in finding domestic secure programming conferences, or businesses offering secure C/C++ programming courses. I'll mention Melbourne University's SecureCon, but does anyone else have any suggestions I can mention? Thanks, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From ddick at aapt.net.au Wed Jan 9 02:37:13 2008 From: ddick at aapt.net.au (David Dick) Date: Wed, 09 Jan 2008 21:37:13 +1100 Subject: [Melbourne-pm] Secure programming conferences/training courses In-Reply-To: <4784768F.60908@perltraining.com.au> References: <4784768F.60908@perltraining.com.au> Message-ID: <4784A3D9.6010107@aapt.net.au> Jacinta Richardson wrote: > G'day folk, > A potential client of ours has asked for advice in finding domestic secure > programming conferences, or businesses offering secure C/C++ programming > courses. I'll mention Melbourne University's SecureCon, but does anyone else > have any suggestions I can mention? > is http://www.owasp.org/index.php/Melbourne of interest? From peter.freiberg at gmail.com Wed Jan 9 14:46:52 2008 From: peter.freiberg at gmail.com (Peter Freiberg) Date: Thu, 10 Jan 2008 09:46:52 +1100 Subject: [Melbourne-pm] Secure programming conferences/training courses In-Reply-To: <4784A3D9.6010107@aapt.net.au> References: <4784768F.60908@perltraining.com.au> <4784A3D9.6010107@aapt.net.au> Message-ID: <441f7b3b0801091446i5c4d716bq2cc742e48c70a864@mail.gmail.com> Hi All, There is an OWASP conference in Australia, February this year. http://www.owasp.org/index.php/OWASP_Australia_AppSec_2008_Conference There is a training day (27th Feb) which is: "to be offered at the Conference is a One Day course, on Application Security Testing, and coding security Techniques." Regards, Peter On Jan 9, 2008 9:37 PM, David Dick wrote: > Jacinta Richardson wrote: > > G'day folk, > > A potential client of ours has asked for advice in finding domestic secure > > programming conferences, or businesses offering secure C/C++ programming > > courses. I'll mention Melbourne University's SecureCon, but does anyone else > > have any suggestions I can mention? > > > is http://www.owasp.org/index.php/Melbourne of interest? > > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > From scottp at dd.com.au Wed Jan 9 20:59:41 2008 From: scottp at dd.com.au (Scott Penrose) Date: Thu, 10 Jan 2008 15:59:41 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 In-Reply-To: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> Message-ID: <80B9741C-4E6C-4B5D-805A-DCF7E07FE501@dd.com.au> Yeah sounds cool. The board is a good idea. I might not be able to bring in the actual board, but if not I will definitely bring in some basic hardware control. Jonathon Oxer does his talk regularly on hardware hacking with PHP, but he calls external C code for the hardware, the perl code is direct - maybe we could even be combined easy to read code controlling hardware. Scooter ----- "leif eriksen" wrote: > I too can help for a couple of hours. Morning or afternoon ? > > What kind of stuff do we want to do ? Flyers and stuff need to be > organised, and we should see if we can pump someone for some prizes > that people who come to our table can win. > > We could also run some kind of activity - mind runs wild at this > point... > > We could do some talks, my fav would be something to dispel the 'Perl > is > write-only' perception - so a short 20 minutes showing some > exceptionally clear Perl. We could do that every couple of hours. > > On that slant, what about a modified Mythbuster's-style theme where > we > take common Perl misconceptions and bust em!! I bags being Jamie - I > may > even have enough time to grow a moustache. I nominate Alfie to be Adam > - > just cause I think it would be really funny to see him get blown up ! > We > are going to blow stuff up, right ? > > We could run a hack-a-thon for ourselves, something to do between > talking to attendees - if we could organise a projector to use this as > a > background , it would make a great "what are they doing over there, > where the big emacs session is ? Dunno, lets have a look" > > I dunno if Scott is free and up to dragging the big board out again. > What about hooking up some stepper motors to the transmitter for your > R/C helicopter - we'll use your Device::Serial and some driver boards > to > write a flight control program !! Should take only a day ! > > L > > >> -----Original Message----- >> From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org >> [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] >> On Behalf Of jarich at perltraining.com.au >> Sent: Monday, 7 January 2008 6:28 PM >> To: melbourne-pm at pm.org >> Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 >> >> Dear Melbourne Perl Mongers members, >> >> I have yet to hear from someone in this group about hosting a >> free community table at this year's LCA Open Day. >> >>> From January 28th - February 2nd, Melbourne will host one of the >> world's best FOSS conferences: Linux.conf.au. On the last >> day, Saturday February 2nd we will be running an Open Day for >> the general public to showcase open source. The 2007 open >> day had a fantastic line-up of displays including: >> >> - Virtual Reality >> - Blender 3D >> - One Laptop Per Child >> - MythTV >> - Linux Gaming >> >> (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) >> >> To make this day more fabulous, I would like to invite your >> group to host a community table. There are only two requirements: >> >> - Open Source must be involved. >> - You need to supply your own computers, flyers and people. >> >> In return, we'll supply you with tables, chairs, power >> sources, wireless (hopefully), food, drink and visitors. >> With luck you can raise the profile of your user group (and >> get some more members) while increasing the attendees' >> awareness of Open Source. >> >> If your group would be interested in having a stand, please >> let me know by either responding to this email or contacting >> openday at mel8ourne.org If you'd like to attend or if you know >> anyone who might like to attend please register (it's free) at: >> >> http://linux.conf.au/programme/open-day >> >> Everyone is welcome and I encourage you to bring your friends >> and family. >> >> All the best, >> >> Jacinta >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm >> > ********************************************************************** > IMPORTANT > The contents of this e-mail and its attachments are confidential and > intended > solely for the use of the individual or entity to whom they are > addressed. If > you received this e-mail in error, please notify the HPA Postmaster, > postmaster at hpa.com.au, > then delete the e-mail. > This footnote also confirms that this e-mail message has been swept > for the > presence of computer viruses by Ironport. Before opening or using any > attachments, check them for viruses and defects. > Our liability is limited to resupplying any affected attachments. > HPA collects personal information to provide and market our services. > For more > information about use, disclosure and access see our Privacy Policy > at > www.hpa.com.au > ********************************************************************** > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From wjmoore at gmail.com Wed Jan 9 21:48:07 2008 From: wjmoore at gmail.com (Wesley Moore) Date: Thu, 10 Jan 2008 16:48:07 +1100 Subject: [Melbourne-pm] Namespace Guidelines? In-Reply-To: <17F977FA-62B0-4728-A04A-F4464B40646E@gmail.com> References: <28F99384-15BB-42A2-9EE8-96E794DE5E0A@gmail.com> <477A24C9.4030306@perltraining.com.au> <17F977FA-62B0-4728-A04A-F4464B40646E@gmail.com> Message-ID: <664f64be0801092148h120250c5t6690e22e42137337@mail.gmail.com> Kat, Looks like you've resolved this but the notes from the PBP course we did at Monash has the following to add: Use grammatical templates when forming identifiers: * For packages and classes: Abstract_noun Abstract_noun::Adjective Abstract_noun::Adjective1::Adjective2 eg. package Disk; package Disk::Audio; package Disk::DVD; package Disk::DVD::Rewitable Wes On Jan 3, 2008 3:03 PM, Kat Grant wrote: > Thanks Paul > This pretty much covers what I was looking for. Still wish I could > find that (perhaps imaginary) article that I think i read, but this > will do. > > Cheers > K > > > > On 01/01/2008, at 10:32 PM, Paul Fenwick wrote: > > > G'day Kat and Melb.pm, > > > > Kat Grant wrote: > > > >> Does anyone know of any nice articles outlining guidelines for OO > >> perl namespaces? > > > > You can find some advice under "Select a name for the module" in > > perlmodlib. > > There's also the perl modules list, which is filled with incredibly > > pedantic CPAN admins. While it's primarily useful in getting > > namespaces > > sorted for upload to CPAN, if anyone does have a good set of > > guidelines > > written down, they will. You can try dropping a mail to them at > > modules at perl.org, or you can do what I do and find Adam Kennedy as > > my local > > CPAN admin on IRC (he's usually found as 'alias' on #win32 on > > irc.perl.org). > > > > When uploading to CPAN, my general rules would be: > > > > * Go from most general to most specific > > * Follow existing conventions when possible > > * Talk to others for a sanity check > > > > The "Local::" namespace is reserved for modules that will never be > > distributed (and never appear on CPAN); however it appears there's > > also a > > guarantee[1] that there won't be any modules on CPAN which contain > > underscores. So a prefix in the style of My_Business:: can be used > > if you > > want to be absolutely sure there'll never be any sort of conflict. > > > > In my experience, the reserved namespaces look awful, so like many > > companies > > we've picked a short and obvious prefix for our internal modules > > (in our > > case, PTA:: ). > > > > As for OO guidelines, it's fairly natural for one to expect > > containership to > > mean inheritance. For example, Bird is a parent of Bird::Chicken is a > > parent of Bird::Chicken::Australorp. If you have nested packages that > > *don't* have inheritance (for internal modules) then I suggest you > > consider > > if there's a way to name about that. The same applies in the > > reverse; do > > you have inherited classes that end up in completely different > > packages? If > > you do, is there a good reason? > > > > Apologies for the not particularly in-depth response, however if > > you do find > > a good set of guidelines written down, I'd love to see them. > > > > All the best, > > > > Paul > > > > [1] According to perlmodlib > > > > -- > > Paul Fenwick | http://perltraining.com.au/ > > Director of Training | Ph: +61 3 9354 6001 > > Perl Training Australia | Fax: +61 3 9354 2681 > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > From jarich at perltraining.com.au Mon Jan 14 16:27:01 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Tue, 15 Jan 2008 11:27:01 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 In-Reply-To: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> References: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> Message-ID: <478BFDD5.8080504@perltraining.com.au> G'day all, Thankyou for expressing interest in running a table at LCA's open day. Open Day runs from 12pm - 4:30pm with morning setup and will be situated on the second floor of the Union House at University of Melbourne. If you are interested in joining us, I need the following from you. First add a table title under the others at: http://linux.conf.au/wiki/index.php?title=Open_Day Then add: 1. A 25-50 word description of your table, what you're showing, written with the general public in mind. Expand all acronyms where it increases understanding. 2. A list of what power and internet networking requirements you need (wireless or wired...). Number of power points, power boards, probable extension cords etc. For my benefit please add these neatly under your description in the above page. 3. A list of how much table space you need and how many chairs. X by Y metres would be handy. Again, add under your description. 4. A list of any equipment you'll be bringing that I need to know about. For example if you need a location to store it during any part of the conference. If you can just show up with it on Saturday morning, then I don't want to know. At this stage I'm unable to help anyone with projectors or large screens. Steve's looking into costings though, so I may be able to come back to you with something. I recommend in the mean time that you plan under the assumption that all I can provide you with is the tables, chairs, floor space, power and wireless networking. If there's anything else you need from me, please let me know. All the best, Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From greg.george at orica.com Thu Jan 17 16:07:41 2008 From: greg.george at orica.com (greg.george at orica.com) Date: Fri, 18 Jan 2008 11:07:41 +1100 Subject: [Melbourne-pm] Three month Perl contract in Melbourne Message-ID: Hi All, We are looking for someone from mid Feb for three months (possibly longer) to work on a new Identity Management implementation. Job description follows, if you or someone you know is interested, let me know. Perl/HTML/JavaScript Programmer/Analyst ======================================= Orica IT Shared Services who is responsible for the IT order management and identity management within the Orica environments are looking for an experienced Perl developer with skill in a Apache mod_perl environment. The work requires skills in Perl, HTML, JavaScript, Template Toolkit and involves the enhancement and integration of existing systems with a new identify management solution. The Remedy Action Request System (ARS) is used as the backend workflow engine and as such familiarity with ARS would be of benefit. This is a worldwide implementation, which would benefit from prior experience dealing with multiple languages. Key Applications ---------------- The key applications are the new identify management system IdM from BMC and internally developed Access Management (AMS) and Service Order Management (SOM2) Systems. SOM2 is the front-end system developed using Apache mod_perl and Template Toolkit running on a Linux environment with backend processing in ARS. The AMS system is an IT security access repository, which is being augmented by IdM. Job Purpose ----------- To work with other members of the project team to: - Enhance the SOM2 user interface, - Develop integration between AMS, SOM2 and IdM Note: This is a hands-on programming, analysis and design and not a management nor team leader role. Key Accountabilities -------------------- Reporting to the project team lead developer, key accountabilities are: - Conduct all activities in accordance with Orica?s SH&E policies and procedures - Development of new programs - Assisting other team members resolving support issues where programming knowledge is required - Creating and maintaining programming standards and procedures - Documentation of developed applications Required Skill -------------- Essential (in order of priority) - Excellent Perl programming and HTML/JavaScript skills having a strong focus on program structure, accuracy, efficiency and documentation - Ability to quickly learn, retain and understand business processes - Ability to manage workload which often has peaks and varying priorities - Good communication skills Desirable - Apache mod_perl skills - Template Toolkit skills - Ability to liase directly with other people to co-ordinate testing, go-live implementation tasks and resolve production related issues - Able to work with team members and business people at their level of knowledge and capability - Remedy Action Request System development skills Behavioural Competencies ------------------------ (in order of strength of competency) - Good analytical and problem solving skills - Good conceptual thinking - Initiative - Teamwork Work conditions --------------- Located at 100 Victoria Street, Melbourne (edge of the CBD) Education and Experience ------------------------ Essential (in order of priority) - Minimum 5 years experience programming in Perl. - Successful completion of post-secondary studies preferably at a tertiary level. Regards, Greg George Phone: +613-9091-2492 3/100 Victoria Prd, Melbourne Please consider the environment before printing this e-mail ********************************************************************** This message is intended solely for the individual(s) and entity(s) addressed. It is confidential and may contain legally privileged information. The use, copying or distribution of this message or any information it contains, by anyone other than the addressee, is prohibited. If you have received this message in error, please notify postmaster at orica.com. The mailbox address from which this message has been sent is for business mail only. Mail sent to it may be subject to security scanning and delivery on non-business messages sent to this address may not occur. Thank you. *********************************************************************** From greg.george at orica.com Thu Jan 17 16:47:22 2008 From: greg.george at orica.com (greg.george at orica.com) Date: Fri, 18 Jan 2008 11:47:22 +1100 Subject: [Melbourne-pm] Three month Perl contract in Melbourne - further information Message-ID: Hi All, WRT my initial post regarding 'Three month Perl contract in Melbourne' we are expecting a rate of $660-700 per day which is negotiable depending on skill set and experience around our areas of interest. Regards, Greg George Phone: +613-9091-2492 3/100 Victoria Prd, Melbourne Please consider the environment before printing this e-mail ********************************************************************** This message is intended solely for the individual(s) and entity(s) addressed. It is confidential and may contain legally privileged information. The use, copying or distribution of this message or any information it contains, by anyone other than the addressee, is prohibited. If you have received this message in error, please notify postmaster at orica.com. The mailbox address from which this message has been sent is for business mail only. Mail sent to it may be subject to security scanning and delivery on non-business messages sent to this address may not occur. Thank you. *********************************************************************** From scottp at dd.com.au Fri Jan 18 15:51:18 2008 From: scottp at dd.com.au (Scott Penrose) Date: Sat, 19 Jan 2008 10:51:18 +1100 Subject: [Melbourne-pm] An old one but an important one Message-ID: Hey Dudes, I was fixing a performance problem with our portal. It was taking 2 or 3 minutes to render an HTML form. I narrowed it down to the fact that this particular form had a 500K XML file to parse, and it did it 10 times. If the duplicate parsing and size wasn't bad enough, it was the hidden problem. Making command line code that did EXACTLY the same thing (so I thought) it ran in sub 1 second. So what was going on. After a full day of debugging I narrowed it down to one module Filter::Simple, only it wasn't, it was Text::Balanced And after even more work I found the real problem - "$&" after a regular expression. Yep - it is a known killer of regular expression performance, but here is the actual differences: (env53) vmwmi1:~/simple# time perl test_direct.pl Fake loop start - size 488604 Fake loop end - for 21581 real 0m26.586s user 0m9.305s sys 0m17.269s (env53) vmwmi1:~/simple# time perl test_direct.pl Fake loop start - size 488604 Fake loop end - for 21581 real 0m0.131s user 0m0.112s sys 0m0.012s Yep, even including compile time, and reading the file from disk - the time goes from 0.012s to 26.58 second - that is 2000 times slower ! So... take heed ! Don't use $&, $` or $' But more importantly - check the modules you use on CPAN. Scooter P.S. I have removed all uses in our code, and still it has a problem, so I suspect there is yet another CPAN module using one. From scottp at dd.com.au Fri Jan 18 15:57:02 2008 From: scottp at dd.com.au (Scott Penrose) Date: Sat, 19 Jan 2008 10:57:02 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: Message-ID: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> Also should have said - Text::Balanced has been fixed on CPAN. Scooter On 19/01/2008, at 10:51 AM, Scott Penrose wrote: > Hey Dudes, > > I was fixing a performance problem with our portal. It was taking 2 or > 3 minutes to render an HTML form. I narrowed it down to the fact that > this particular form had a 500K XML file to parse, and it did it 10 > times. If the duplicate parsing and size wasn't bad enough, it was the > hidden problem. > > Making command line code that did EXACTLY the same thing (so I > thought) it ran in sub 1 second. So what was going on. > > After a full day of debugging I narrowed it down to one module > Filter::Simple, only it wasn't, it was Text::Balanced > > And after even more work I found the real problem - "$&" after a > regular expression. > > Yep - it is a known killer of regular expression performance, but here > is the actual differences: > > (env53) vmwmi1:~/simple# time perl test_direct.pl > Fake loop start - size 488604 > Fake loop end - for 21581 > real 0m26.586s > user 0m9.305s > sys 0m17.269s > > (env53) vmwmi1:~/simple# time perl test_direct.pl > Fake loop start - size 488604 > Fake loop end - for 21581 > real 0m0.131s > user 0m0.112s > sys 0m0.012s > > Yep, even including compile time, and reading the file from disk - the > time goes from 0.012s to 26.58 second - that is 2000 times slower ! > > So... take heed ! > > Don't use $&, $` or $' > > But more importantly - check the modules you use on CPAN. > > Scooter > P.S. I have removed all uses in our code, and still it has a problem, > so I suspect there is yet another CPAN module using one. > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From scottp at dd.com.au Fri Jan 18 15:59:09 2008 From: scottp at dd.com.au (Scott Penrose) Date: Sat, 19 Jan 2008 10:59:09 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> Message-ID: And for those who don't know. $& $' or $` anywhere in the code found by the compiler makes all regular expressions slow, not just the ones where it is used. (sorry about the separate emails) Scooter From leif.eriksen at hpa.com.au Sun Jan 20 14:43:04 2008 From: leif.eriksen at hpa.com.au (leif.eriksen at hpa.com.au) Date: Mon, 21 Jan 2008 09:43:04 +1100 Subject: [Melbourne-pm] An old one but an important one Message-ID: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> I wonder if there's a way to hook into $& and family, to see stack traces where they are used ? Being global, can you tie them to something useful ? L > -----Original Message----- > From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org > [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] > On Behalf Of Scott Penrose > Sent: Saturday, 19 January 2008 10:51 AM > To: Melbourne Perlmongers > Subject: [Melbourne-pm] An old one but an important one > > Hey Dudes, > > I was fixing a performance problem with our portal. It was taking 2 or > 3 minutes to render an HTML form. I narrowed it down to the > fact that this particular form had a 500K XML file to parse, > and it did it 10 times. If the duplicate parsing and size > wasn't bad enough, it was the hidden problem. > > Making command line code that did EXACTLY the same thing (so I > thought) it ran in sub 1 second. So what was going on. > > After a full day of debugging I narrowed it down to one > module Filter::Simple, only it wasn't, it was Text::Balanced > > And after even more work I found the real problem - "$&" > after a regular expression. > > Yep - it is a known killer of regular expression performance, > but here is the actual differences: > > (env53) vmwmi1:~/simple# time perl test_direct.pl > Fake loop start - size 488604 > Fake loop end - for 21581 > real 0m26.586s > user 0m9.305s > sys 0m17.269s > > (env53) vmwmi1:~/simple# time perl test_direct.pl > Fake loop start - size 488604 > Fake loop end - for 21581 > real 0m0.131s > user 0m0.112s > sys 0m0.012s > > Yep, even including compile time, and reading the file from > disk - the time goes from 0.012s to 26.58 second - that is > 2000 times slower ! > > So... take heed ! > > Don't use $&, $` or $' > > But more importantly - check the modules you use on CPAN. > > Scooter > P.S. I have removed all uses in our code, and still it has a > problem, so I suspect there is yet another CPAN module using one. > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > ********************************************************************** IMPORTANT The contents of this e-mail and its attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au, then delete the e-mail. This footnote also confirms that this e-mail message has been swept for the presence of computer viruses by Ironport. Before opening or using any attachments, check them for viruses and defects. Our liability is limited to resupplying any affected attachments. HPA collects personal information to provide and market our services. For more information about use, disclosure and access see our Privacy Policy at www.hpa.com.au ********************************************************************** From scottp at dd.com.au Sun Jan 20 14:49:02 2008 From: scottp at dd.com.au (Scott Penrose) Date: Mon, 21 Jan 2008 09:49:02 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> Message-ID: <84BFB72D-426E-4E64-9CF8-2F210F355F18@dd.com.au> I am playing with B::Lint to find them - doesn't help heaps because of dynamic compiled code. Scott On 21/01/2008, at 9:43 AM, leif.eriksen at hpa.com.au wrote: > I wonder if there's a way to hook into $& and family, to see stack > traces where they are used ? Being global, can you tie them to > something > useful ? > > L > >> -----Original Message----- >> From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org >> [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] >> On Behalf Of Scott Penrose >> Sent: Saturday, 19 January 2008 10:51 AM >> To: Melbourne Perlmongers >> Subject: [Melbourne-pm] An old one but an important one >> >> Hey Dudes, >> >> I was fixing a performance problem with our portal. It was taking 2 >> or >> 3 minutes to render an HTML form. I narrowed it down to the >> fact that this particular form had a 500K XML file to parse, >> and it did it 10 times. If the duplicate parsing and size >> wasn't bad enough, it was the hidden problem. >> >> Making command line code that did EXACTLY the same thing (so I >> thought) it ran in sub 1 second. So what was going on. >> >> After a full day of debugging I narrowed it down to one >> module Filter::Simple, only it wasn't, it was Text::Balanced >> >> And after even more work I found the real problem - "$&" >> after a regular expression. >> >> Yep - it is a known killer of regular expression performance, >> but here is the actual differences: >> >> (env53) vmwmi1:~/simple# time perl test_direct.pl >> Fake loop start - size 488604 >> Fake loop end - for 21581 >> real 0m26.586s >> user 0m9.305s >> sys 0m17.269s >> >> (env53) vmwmi1:~/simple# time perl test_direct.pl >> Fake loop start - size 488604 >> Fake loop end - for 21581 >> real 0m0.131s >> user 0m0.112s >> sys 0m0.012s >> >> Yep, even including compile time, and reading the file from >> disk - the time goes from 0.012s to 26.58 second - that is >> 2000 times slower ! >> >> So... take heed ! >> >> Don't use $&, $` or $' >> >> But more importantly - check the modules you use on CPAN. >> >> Scooter >> P.S. I have removed all uses in our code, and still it has a >> problem, so I suspect there is yet another CPAN module using one. >> >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm >> > ********************************************************************** > IMPORTANT > The contents of this e-mail and its attachments are confidential and > intended > solely for the use of the individual or entity to whom they are > addressed. If > you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au > , > then delete the e-mail. > This footnote also confirms that this e-mail message has been swept > for the > presence of computer viruses by Ironport. Before opening or using any > attachments, check them for viruses and defects. > Our liability is limited to resupplying any affected attachments. > HPA collects personal information to provide and market our > services. For more > information about use, disclosure and access see our Privacy Policy at > www.hpa.com.au > ********************************************************************** > From pjf at perltraining.com.au Sun Jan 20 15:02:49 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Mon, 21 Jan 2008 10:02:49 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> Message-ID: <4793D319.8040601@perltraining.com.au> G'day Leif, Scott, and Melb.pm, leif.eriksen at hpa.com.au wrote: > I wonder if there's a way to hook into $& and family, to see stack > traces where they are used ? Being global, can you tie them to something > useful ? Scott wrote: > I am playing with B::Lint to find them - doesn't help heaps because of > dynamic compiled code. There are also: Devel::SawAmpersand Devel::FindAmpersand B::FindAmpersand I've not used them myself, and think they'd probably suffer the same problems with dynamic compiled code. Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From scottp at dd.com.au Sun Jan 20 16:00:42 2008 From: scottp at dd.com.au (Scott Penrose) Date: Mon, 21 Jan 2008 11:00:42 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <4793D319.8040601@perltraining.com.au> References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> <4793D319.8040601@perltraining.com.au> Message-ID: On 21/01/2008, at 10:02 AM, Paul Fenwick wrote: > G'day Leif, Scott, and Melb.pm, > > leif.eriksen at hpa.com.au wrote: >> I wonder if there's a way to hook into $& and family, to see stack >> traces where they are used ? Being global, can you tie them to >> something >> useful ? > > Scott wrote: > > > I am playing with B::Lint to find them - doesn't help heaps > because of > > dynamic compiled code. > > There are also: > > Devel::SawAmpersand > Devel::FindAmpersand > B::FindAmpersand B:: and Devel:: FindAmpersand do not work if Perl has been compiled with thread support (almost all of them). But SawAmpersand does - so you can just run it after your loads, and narrow it down. Scott From scottp at dd.com.au Sun Jan 20 16:06:43 2008 From: scottp at dd.com.au (Scott Penrose) Date: Mon, 21 Jan 2008 11:06:43 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> <4793D319.8040601@perltraining.com.au> Message-ID: The naughty module list: * XML::XPath - this is still not fixed on CPAN, fortunately you can use other modules such XML::LibXML. * XML::ESISParser - I did not research this one as we don't use it. * Text::Balanced - latest version (2+) has it fixed. * Parse::RecDescent - I did not research this one. * Spreadsheet::ParseExcel::Utility - I did not research this one Scott From leif.eriksen at hpa.com.au Sun Jan 20 16:26:15 2008 From: leif.eriksen at hpa.com.au (leif.eriksen at hpa.com.au) Date: Mon, 21 Jan 2008 11:26:15 +1100 Subject: [Melbourne-pm] An old one but an important one Message-ID: <6462CBB658614845A7702E379880769803087477@exhnat2.nsw.hpa> I wonder if this kind of thing should be added to the Kwalitee checks ? L > -----Original Message----- > From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org > [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] > On Behalf Of Scott Penrose > Sent: Monday, 21 January 2008 11:07 AM > To: Scott Penrose > Cc: melbourne-pm at pm.org > Subject: Re: [Melbourne-pm] An old one but an important one > > The naughty module list: > > * XML::XPath - this is still not fixed on CPAN, fortunately > you can use other modules such XML::LibXML. > * XML::ESISParser - I did not research this one as we don't use it. > * Text::Balanced - latest version (2+) has it fixed. > * Parse::RecDescent - I did not research this one. > * Spreadsheet::ParseExcel::Utility - I did not research this one > > Scott > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > ********************************************************************** IMPORTANT The contents of this e-mail and its attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au, then delete the e-mail. This footnote also confirms that this e-mail message has been swept for the presence of computer viruses by Ironport. Before opening or using any attachments, check them for viruses and defects. Our liability is limited to resupplying any affected attachments. HPA collects personal information to provide and market our services. For more information about use, disclosure and access see our Privacy Policy at www.hpa.com.au ********************************************************************** From tconnors at astro.swin.edu.au Sun Jan 20 16:54:29 2008 From: tconnors at astro.swin.edu.au (Tim Connors) Date: Mon, 21 Jan 2008 11:54:29 +1100 (EST) Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> Message-ID: On Sat, 19 Jan 2008, Scott Penrose wrote: > And for those who don't know. > > $& $' or $` anywhere in the code found by the compiler makes all > regular expressions slow, not just the ones where it is used. > > (sorry about the separate emails) Crap. I was always under the impression that $& $' and $` were esoteric things that are only used by perlre gurus. But perlre(1) tells me that parentheses and $1, $2,... use them internally with the huge performance hit, but (at least) don't come with the cost of slowing down all uses of REs. I wonder how much of my own code uses parentheses avoidably? -- Tim Connors From pjf at perltraining.com.au Sun Jan 20 18:10:49 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Mon, 21 Jan 2008 13:10:49 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <6462CBB658614845A7702E379880769803087477@exhnat2.nsw.hpa> References: <6462CBB658614845A7702E379880769803087477@exhnat2.nsw.hpa> Message-ID: <4793FF29.6030603@perltraining.com.au> G'day Leif / MPM, leif.eriksen at hpa.com.au wrote: > I wonder if this kind of thing should be added to the Kwalitee checks ? I was thinking the exact same thing myself this morning. I think making sure these variables are not used would be an excellent Kwalitee check. You don't happen to be on the perl-qa list by any chance? Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From leif.eriksen at hpa.com.au Sun Jan 20 18:46:56 2008 From: leif.eriksen at hpa.com.au (leif.eriksen at hpa.com.au) Date: Mon, 21 Jan 2008 13:46:56 +1100 Subject: [Melbourne-pm] An old one but an important one Message-ID: <6462CBB658614845A7702E379880769803087496@exhnat2.nsw.hpa> I use parens a lot, but mostly just grouping, not capturing ie (?:group) rather than (capture) See http://perldoc.perl.org/perlretut.html#Non-capturing-groupings - iirc this is more efficient, but there would also be a lot of caveats to that efficiency as well, I imagine. L > -----Original Message----- > From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org > [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] > On Behalf Of Tim Connors > Sent: Monday, 21 January 2008 11:54 AM > To: Scott Penrose > Cc: Melbourne Perlmongers > Subject: Re: [Melbourne-pm] An old one but an important one > > On Sat, 19 Jan 2008, Scott Penrose wrote: > > > And for those who don't know. > > > > $& $' or $` anywhere in the code found by the compiler makes all > > regular expressions slow, not just the ones where it is used. > > > > (sorry about the separate emails) > > Crap. I was always under the impression that $& $' and $` > were esoteric things that are only used by perlre gurus. > > But perlre(1) tells me that parentheses and $1, $2,... use > them internally with the huge performance hit, but (at least) > don't come with the cost of slowing down all uses of REs. > > I wonder how much of my own code uses parentheses avoidably? > > -- > Tim Connors > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > ********************************************************************** IMPORTANT The contents of this e-mail and its attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au, then delete the e-mail. This footnote also confirms that this e-mail message has been swept for the presence of computer viruses by Ironport. Before opening or using any attachments, check them for viruses and defects. Our liability is limited to resupplying any affected attachments. HPA collects personal information to provide and market our services. For more information about use, disclosure and access see our Privacy Policy at www.hpa.com.au ********************************************************************** From leif.eriksen at hpa.com.au Sun Jan 20 18:48:27 2008 From: leif.eriksen at hpa.com.au (leif.eriksen at hpa.com.au) Date: Mon, 21 Jan 2008 13:48:27 +1100 Subject: [Melbourne-pm] An old one but an important one Message-ID: <6462CBB658614845A7702E379880769803087497@exhnat2.nsw.hpa> I am actually but am b/w limited to reading it atm... L > -----Original Message----- > From: Paul Fenwick [mailto:pjf at perltraining.com.au] > Sent: Monday, 21 January 2008 1:11 PM > To: Leif Eriksen > Cc: melbourne-pm at pm.org > Subject: Re: [Melbourne-pm] An old one but an important one > > G'day Leif / MPM, > > leif.eriksen at hpa.com.au wrote: > > I wonder if this kind of thing should be added to the > Kwalitee checks ? > > I was thinking the exact same thing myself this morning. I > think making sure these variables are not used would be an > excellent Kwalitee check. > > You don't happen to be on the perl-qa list by any chance? > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 > ********************************************************************** IMPORTANT The contents of this e-mail and its attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au, then delete the e-mail. This footnote also confirms that this e-mail message has been swept for the presence of computer viruses by Ironport. Before opening or using any attachments, check them for viruses and defects. Our liability is limited to resupplying any affected attachments. HPA collects personal information to provide and market our services. For more information about use, disclosure and access see our Privacy Policy at www.hpa.com.au ********************************************************************** From scottp at dd.com.au Sun Jan 20 18:55:40 2008 From: scottp at dd.com.au (Scott Penrose) Date: Mon, 21 Jan 2008 13:55:40 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <4793FF29.6030603@perltraining.com.au> References: <6462CBB658614845A7702E379880769803087477@exhnat2.nsw.hpa> <4793FF29.6030603@perltraining.com.au> Message-ID: OK If it helps, here is a self contained test script. It has a 500K real XML file in the DATA section - so that the data and the Regexs are the real world example. Run it like so... time perl test.pl time perl test.pl evil Scott (PM blocks things over 40K, so here is a link) http://linux.dd.com.au/test.pl On 21/01/2008, at 1:10 PM, Paul Fenwick wrote: > G'day Leif / MPM, > > leif.eriksen at hpa.com.au wrote: >> I wonder if this kind of thing should be added to the Kwalitee >> checks ? > > I was thinking the exact same thing myself this morning. I think > making > sure these variables are not used would be an excellent Kwalitee > check. > > You don't happen to be on the perl-qa list by any chance? > > Cheerio, > > Paul > > -- > Paul Fenwick | http://perltraining.com.au/ > Director of Training | Ph: +61 3 9354 6001 > Perl Training Australia | Fax: +61 3 9354 2681 > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From jarich at perltraining.com.au Sun Jan 20 21:59:37 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 21 Jan 2008 16:59:37 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> Message-ID: <479434C9.60904@perltraining.com.au> Tim Connors wrote: > On Sat, 19 Jan 2008, Scott Penrose wrote: > >> And for those who don't know. >> >> $& $' or $` anywhere in the code found by the compiler makes all >> regular expressions slow, not just the ones where it is used. >> >> (sorry about the separate emails) > > Crap. I was always under the impression that $& $' and $` were esoteric > things that are only used by perlre gurus. > > But perlre(1) tells me that parentheses and $1, $2,... use them internally > with the huge performance hit, but (at least) don't come with the cost of > slowing down all uses of REs. > > I wonder how much of my own code uses parentheses avoidably? Probably a lot. The (?: construct is ugly and I sometimes I don't remember which order the : and ? go in. Still, although it's slower than it needs to be, it doesn't have the same performance impact on _every_ other regular expression in your program. Using $&, $' or $` does affect every regular expression, because Perl cannot tell in advance (at compile time) which regular expression will set $& etc before its use, and thus has to set them for each and every expression just in case. Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From tconnors at astro.swin.edu.au Sun Jan 20 22:26:11 2008 From: tconnors at astro.swin.edu.au (Tim Connors) Date: Mon, 21 Jan 2008 17:26:11 +1100 (EST) Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <479434C9.60904@perltraining.com.au> References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> <479434C9.60904@perltraining.com.au> Message-ID: On Mon, 21 Jan 2008, Jacinta Richardson wrote: > Tim Connors wrote: > > Crap. I was always under the impression that $& $' and $` were esoteric > > things that are only used by perlre gurus. > > > > But perlre(1) tells me that parentheses and $1, $2,... use them internally > > with the huge performance hit, but (at least) don't come with the cost of > > slowing down all uses of REs. > > > > I wonder how much of my own code uses parentheses avoidably? > > Probably a lot. The (?: construct is ugly and I sometimes I don't remember > which order the : and ? go in. Still, although it's slower than it needs to be, > it doesn't have the same performance impact on _every_ other regular expression > in your program. Using $&, $' or $` does affect every regular expression, > because Perl cannot tell in advance (at compile time) which regular expression > will set $& etc before its use, and thus has to set them for each and every > expression just in case. I was wondering what the justification for $& affecting every regexp was. And now I know :) But if you can't determine where $& is going to come from, why can you determine where $1 is going to come from (given that $& is essentially $0), such that you don't need to slow down all other regexps too? -- Tim Connors From jarich at perltraining.com.au Sun Jan 20 23:31:29 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 21 Jan 2008 18:31:29 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> <479434C9.60904@perltraining.com.au> Message-ID: <47944A51.1050303@perltraining.com.au> Tim Connors wrote: > But if you can't determine where $& is going to come from, why can you > determine where $1 is going to come from (given that $& is essentially > $0), such that you don't need to slow down all other regexps too? Perl can't determine where $1 and friends is coming from at any given point in your program (without running it). Thus any regular expression which uses capturing parentheses sets $1 and friends (and does so even if Perl can't find you using $1 etc anywhere) (and does so even if you capture into variables or not). Of course this happens when you're merely using the parentheses for grouping because Perl doesn't know any better. For example consider this code: $_ = "happy happy joy joy"; if(/(h.*y) joy/) { if(/(joy)/) { } print "Matched: $1\n"; # Which $1 is this? } what if we wrote: $_ = "happy happy joy joy"; if(/(h.*y) joy/) { if(/(pig)/) { } print "Matched: $1\n"; # Which $1 is this? } Perl knows that it has to record $1 for each expression that it successfully evaluated, because we're using capturing parentheses. It will try to clear $1 on an unsuccessful evaluation, but you shouldn't count on it (on my Perl 5.8.8 the second snippet of code prints "Matched: happy happy joy"). Perl doesn't care which expression actually set $1. If we'd used $& and/or it's friends it'd be the same story. Perl would set it for each expression evaluated because it cannot tell which expression you needed it from. Perl can easily tell whether your regular expression is matching and capturing, or just matching. Thus using non-capturing parentheses instead of capturing will speed up those expressions, while not using them will not slow down any others. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From tconnors at astro.swin.edu.au Mon Jan 21 00:29:14 2008 From: tconnors at astro.swin.edu.au (Tim Connors) Date: Mon, 21 Jan 2008 19:29:14 +1100 (EST) Subject: [Melbourne-pm] An old one but an important one In-Reply-To: <47944A51.1050303@perltraining.com.au> References: <894E97D0-7C88-4FD1-AE51-74E353A49D8A@dd.com.au> <479434C9.60904@perltraining.com.au> <47944A51.1050303@perltraining.com.au> Message-ID: On Mon, 21 Jan 2008, Jacinta Richardson wrote: > Tim Connors wrote: > > > But if you can't determine where $& is going to come from, why can you > > determine where $1 is going to come from (given that $& is essentially > > $0), such that you don't need to slow down all other regexps too? > > Perl can't determine where $1 and friends is coming from at any given point in > your program (without running it). Thus any regular expression which uses > capturing parentheses sets $1 and friends (and does so even if Perl can't find > you using $1 etc anywhere) (and does so even if you capture into variables or > not). Of course this happens when you're merely using the parentheses for > grouping because Perl doesn't know any better. > > For example consider this code: > > $_ = "happy happy joy joy"; > if(/(h.*y) joy/) { > if(/(joy)/) { > } > print "Matched: $1\n"; # Which $1 is this? > } > > what if we wrote: > > $_ = "happy happy joy joy"; > if(/(h.*y) joy/) { > if(/(pig)/) { > } > print "Matched: $1\n"; # Which $1 is this? > } > > > Perl knows that it has to record $1 for each expression that it successfully > evaluated, because we're using capturing parentheses. It will try to clear $1 > on an unsuccessful evaluation, but you shouldn't count on it (on my Perl 5.8.8 > the second snippet of code prints "Matched: happy happy joy"). > > Perl doesn't care which expression actually set $1. If we'd used $& and/or it's > friends it'd be the same story. Perl would set it for each expression evaluated > because it cannot tell which expression you needed it from. > > Perl can easily tell whether your regular expression is matching and capturing, > or just matching. Thus using non-capturing parentheses instead of capturing > will speed up those expressions, while not using them will not slow down any others. Sorry - I meant if $& slows down *all* regexps used in the program, whether they use parentheses or not, but $1 doesn't cause all regexps to slow down. The only slowed down regexps are those that use any parentheses. I guess it's because $& should be set always, because it doesn't need capturing parentheses to match. So if it is ever referred to, then it must always be created. -- Tim Connors From andrew.stuart at flatraterecruitment.com.au Mon Jan 21 19:14:05 2008 From: andrew.stuart at flatraterecruitment.com.au (Andrew Stuart) Date: Tue, 22 Jan 2008 14:14:05 +1100 Subject: [Melbourne-pm] Mike Culver, Amazon Web Services Evangelist, speaks in Melbourne February 25th References: Message-ID: Hi folks, Flat Rate Recruitment invites any Melbourne-based passionate technical people (and their friends) to come along and listen to Mike Culver, a Web Services Evangelist from Amazon U.S.A http:// evangelists.wetpaint.com/account/mculver Mike is visiting Australia to spread the word about Amazon Web Services. If you haven't yet heard about Amazon Web Services then this is your chance to find out what the buzz is all about. It's exciting stuff and enables true cloud based computing. Amazon Web Services (http:// aws.amazon.com) is a new paradigm, a completely new way to think about web applications, and requires a different mindset for developers. Amazon Web Services opens up new opportunities to build highly scalable web applications with ever more power and at ever lower development cost. This will mainly be a technical presentation aimed at an audience of software development professionals. Mike's talk will run for 60-90 minutes. Attendance is FREE and everyone is welcome, but you will need to email me to register, so that we know how many people are planning to come along - we'll need your email address in case we need to change the venue due to numbers. We'll also email you a reminder closer to the date. If you know anyone else you might like to come along then please forward this email to them. The presentation will be held 6:00PM - 7:30PM Monday 25th February 2008 Location will be either South Melbourne or the CBD - to register, please email andrew.stuart at flatraterecruitment.com.au and I'll send back the address of the venue. Enquiries welcome to Andrew Stuart (03) 9696 1616 See you then! Thanks Andrew Stuart Managing Director Flat Rate Recruitment Head Office: 68 -72 York St South Melbourne, Victoria 3205 Phone: 1300 55 91 92 Phone 03 9696 1616 Mobile: 0417 034 241 Email: andrew.stuart at FlatRateRecruitment.com.au Web: http://www.FlatRateRecruitment.com.au From ben at benbalbo.com Thu Jan 24 21:54:13 2008 From: ben at benbalbo.com (Ben Balbo) Date: Fri, 25 Jan 2008 16:54:13 +1100 Subject: [Melbourne-pm] BarCamp Melbourne 2008 is go! Message-ID: <47997985.7030304@benbalbo.com> Hi list! I hope you find this post of interest and that I don't offend anyone by posting this. Cheers! BB For general circulation BarCampMelbourne 2008 is go! http://barcampmelbourne.org/ 23rd February 2008 in Melbourne CBD *** YOU MUST REGISTER IF YOU INTEND TO COME ************************* * * If you do not register and turn up we could get a * little crowded and you might not get any food! * * http://barcampmelbourne.org/ * ********************************************************************* Described as "an intense event with discussions, demos and interaction from attendees", anyone is welcome to come along for free. Everyone is asked to participate by giving a presentation or leading or participating in a discussion, essentially forcing the sharing of ideas and knowledge. You might like to check out the BarCamp web site for more general information. Wikipedia's entry on BarCamp might also be of interest. What to expect? ~~~~~~~~~~~~~~ Turn up for 9am registration and put your name on the list. Talk to people, network. We'll have a welcome / intro type talk at about 9.30am and get into the demos, discussions, talks after that. What to bring? ~~~~~~~~~~~~~ Anything you might need for yourself. We'll have lunch for everyone, but you might want to bring your laptop, computers and other tech stuff that might be cool, interesting, useful in your demo. NOTE: The organisers are not responsible for your equipment or other items you bring. You bring them at your own risk. Where? ~~~~~ BarCamp Melbourne 2008 will be held on the 23rd of February at ThoughtWorks, Level 11, 155 Queen Street, Melbourne, VIC 3000, Australia Please spread this call for participation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ But if you're planning to send it to a list, check the lists this announcement has already been sent to at: http://www.barcamp.org/BarCampMelbourne2008Organisation Any questions? ~~~~~~~~~~~~~~ http://barcampmelbourne.org/contact/ Sponsors ~~~~~~~~ Events like this aren't usually possible without sponsorship. We'd like to thanks Firesyde (http://firesyde.com/), SitePoint (http://sitepoint.com/) and ThoughtWorks (http://thoughtworks.com/) for their kind support. On behalf of all the organisers, I look forward to seeing you there! Ben Balbo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 249 bytes Desc: OpenPGP digital signature Url : http://mail.pm.org/pipermail/melbourne-pm/attachments/20080125/7e2a01d0/attachment.bin From wayland at wayland.id.au Sun Jan 27 22:18:14 2008 From: wayland at wayland.id.au (Timothy S. Nelson) Date: Mon, 28 Jan 2008 17:18:14 +1100 (EST) Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> <4793D319.8040601@perltraining.com.au> Message-ID: On Mon, 21 Jan 2008, Scott Penrose wrote: > The naughty module list: > > * XML::XPath - this is still not fixed on CPAN, fortunately you can > use other modules such XML::LibXML. XML::LibXML crashes when I use it (Apache segfaults). Admittedly, only under heavy usage. :) --------------------------------------------------------------------- | Name: Tim Nelson | Because the Creator is, | | E-mail: wayland at wayland.id.au | I am | --------------------------------------------------------------------- ----BEGIN GEEK CODE BLOCK---- Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y- -----END GEEK CODE BLOCK----- From scottp at dd.com.au Tue Jan 29 02:04:13 2008 From: scottp at dd.com.au (Scott Penrose) Date: Tue, 29 Jan 2008 21:04:13 +1100 Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> <4793D319.8040601@perltraining.com.au> Message-ID: Bum ! I use XML::LibXML and LibXSLT on many VERY high loaded apache servers and have not had that problem. Scooter On 28/01/2008, at 5:18 PM, Timothy S. Nelson wrote: > On Mon, 21 Jan 2008, Scott Penrose wrote: > >> The naughty module list: >> >> * XML::XPath - this is still not fixed on CPAN, fortunately you can >> use other modules such XML::LibXML. > > XML::LibXML crashes when I use it (Apache segfaults). > > Admittedly, only under heavy usage. > > :) > > > --------------------------------------------------------------------- > | Name: Tim Nelson | Because the Creator is, | > | E-mail: wayland at wayland.id.au | I am | > --------------------------------------------------------------------- > > ----BEGIN GEEK CODE BLOCK---- > Version 3.12 > GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ > PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y- > -----END GEEK CODE BLOCK----- From wayland at wayland.id.au Tue Jan 29 12:27:48 2008 From: wayland at wayland.id.au (Timothy S. Nelson) Date: Wed, 30 Jan 2008 07:27:48 +1100 (EST) Subject: [Melbourne-pm] An old one but an important one In-Reply-To: References: <6462CBB658614845A7702E379880769803087463@exhnat2.nsw.hpa> <4793D319.8040601@perltraining.com.au> Message-ID: On Tue, 29 Jan 2008, Scott Penrose wrote: > Bum ! > > I use XML::LibXML and LibXSLT on many VERY high loaded apache servers and > have not had that problem. Well, I suppose in my case, that's what you get for trying to write an XML database :). Part of my problem was, any time I changed any part of the code, the segfault would move :). Someone on the perl-xml list came up with a way of reproducing a segfault that involved (IIRC) both the modules you mentioned (whereas I don't use libXSLT), but was unsure which module it was in. I'll quote the message (which I didn't write): > It's something to do with the implicit "aliasing" of the array elements > - the "nodes" are references to scalars containing a C pointer to a > libxml element structure and blessed into the package > XML::LibXML::Element - it seems that the aliasing alters the pointer > somehow so when it gets passed back to the libxml function to perform > the findvalue() it points to the wrong thing and consequently gives rise > to the segfault. > > That the "aliasing" is what is causing the problem can be demonstrated > by doing: > > foreach my $node ( @nodes ) > { > my $foo = $node->findvalue(XPATH); > } > > instead of the sort - the foreach also does the aliasing and this code > also gives rise to the segfault. > > I don't know who's bug it is if bug at all, and I don't really fancy > building a debugging perl to find out :-O HTH, --------------------------------------------------------------------- | Name: Tim Nelson | Because the Creator is, | | E-mail: wayland at wayland.id.au | I am | --------------------------------------------------------------------- ----BEGIN GEEK CODE BLOCK---- Version 3.12 GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y- -----END GEEK CODE BLOCK----- From jarich at perltraining.com.au Wed Jan 30 19:20:11 2008 From: jarich at perltraining.com.au (jarich at perltraining.com.au) Date: Thu, 31 Jan 2008 14:20:11 +1100 (EST) Subject: [Melbourne-pm] LCA Open Day: 2nd February 12pm - 4pm Message-ID: <20080131032011.546F2A8864@teddybear.perltraining.com.au> G'day folk! linux.conf.au has thus far been a fantastic success. If you've been unable to join us for the main conference, you would be especially welcome to come to our Open Day! http://linux.conf.au/programme/open-day Where: Union House, Melbourne University (Building 130) (see http://linux.conf.au/about/venue for maps) When: 12pm - 4pm, Saturday 2nd February (this Saturday) Who: Everyone! Especially those who don't live and breathe computers! What: Cool Open Source stuff! Bring along your friends, family, colleagues to find out about this great thing called Open Source Software. Play Frets on Fire (a game like Guitar Hero), Stepmania (similar to Dance Dance Revolution) and other open source games. Discover Inkscape and other Open Source design tools. Learn about Wikipedia, Project Gutenberg, Software Freedom Day. See MythTV in action, showing how you can build a cheap but extremely powerful personal video recorder (better than TiVo). Experience linking real world tools with online games like Second Life. And much more! If you register your attendance before the event you'll get a free present. Visit http://linux.conf.au/programme/open-day to register, and for a full list of stands and an idea of room layout visit: http://linux.conf.au/programme/open-day/floorplan We look forward to seeing you there! All the best, Jacinta linux.conf.au Open Day Coordinator From scottp at dd.com.au Thu Jan 31 12:33:53 2008 From: scottp at dd.com.au (Scott Penrose) Date: Fri, 1 Feb 2008 07:33:53 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 In-Reply-To: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> References: <6462CBB658614845A7702E3798807698030870BB@exhnat2.nsw.hpa> Message-ID: What I am bringing: * 22" LCD * Ubuntu, Keyboard, Mouse * Embedded PC, Hardware input/output (if I get it working Saturday morning). If someone could also bring a laptop, that way we have a backup. Also, if I can find it, we used to have some posters around - but if anyone was willing to make up a flyer or similar that too would be great. Scooter On 08/01/2008, at 10:43 AM, leif.eriksen at hpa.com.au wrote: > > I too can help for a couple of hours. Morning or afternoon ? > > What kind of stuff do we want to do ? Flyers and stuff need to be > organised, and we should see if we can pump someone for some prizes > that people who come to our table can win. > > We could also run some kind of activity - mind runs wild at this > point... > > We could do some talks, my fav would be something to dispel the > 'Perl is > write-only' perception - so a short 20 minutes showing some > exceptionally clear Perl. We could do that every couple of hours. > > On that slant, what about a modified Mythbuster's-style theme where we > take common Perl misconceptions and bust em!! I bags being Jamie - I > may > even have enough time to grow a moustache. I nominate Alfie to be > Adam - > just cause I think it would be really funny to see him get blown > up ! We > are going to blow stuff up, right ? > > We could run a hack-a-thon for ourselves, something to do between > talking to attendees - if we could organise a projector to use this > as a > background , it would make a great "what are they doing over there, > where the big emacs session is ? Dunno, lets have a look" > > I dunno if Scott is free and up to dragging the big board out again. > What about hooking up some stepper motors to the transmitter for your > R/C helicopter - we'll use your Device::Serial and some driver > boards to > write a flight control program !! Should take only a day ! > > L > > >> -----Original Message----- >> From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org >> [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] >> On Behalf Of jarich at perltraining.com.au >> Sent: Monday, 7 January 2008 6:28 PM >> To: melbourne-pm at pm.org >> Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 >> >> Dear Melbourne Perl Mongers members, >> >> I have yet to hear from someone in this group about hosting a >> free community table at this year's LCA Open Day. >> >>> From January 28th - February 2nd, Melbourne will host one of the >> world's best FOSS conferences: Linux.conf.au. On the last >> day, Saturday February 2nd we will be running an Open Day for >> the general public to showcase open source. The 2007 open >> day had a fantastic line-up of displays including: >> >> - Virtual Reality >> - Blender 3D >> - One Laptop Per Child >> - MythTV >> - Linux Gaming >> >> (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) >> >> To make this day more fabulous, I would like to invite your >> group to host a community table. There are only two requirements: >> >> - Open Source must be involved. >> - You need to supply your own computers, flyers and people. >> >> In return, we'll supply you with tables, chairs, power >> sources, wireless (hopefully), food, drink and visitors. >> With luck you can raise the profile of your user group (and >> get some more members) while increasing the attendees' >> awareness of Open Source. >> >> If your group would be interested in having a stand, please >> let me know by either responding to this email or contacting >> openday at mel8ourne.org If you'd like to attend or if you know >> anyone who might like to attend please register (it's free) at: >> >> http://linux.conf.au/programme/open-day >> >> Everyone is welcome and I encourage you to bring your friends >> and family. >> >> All the best, >> >> Jacinta >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm >> > ********************************************************************** > IMPORTANT > The contents of this e-mail and its attachments are confidential and > intended > solely for the use of the individual or entity to whom they are > addressed. If > you received this e-mail in error, please notify the HPA Postmaster, postmaster at hpa.com.au > , > then delete the e-mail. > This footnote also confirms that this e-mail message has been swept > for the > presence of computer viruses by Ironport. Before opening or using any > attachments, check them for viruses and defects. > Our liability is limited to resupplying any affected attachments. > HPA collects personal information to provide and market our > services. For more > information about use, disclosure and access see our Privacy Policy at > www.hpa.com.au > ********************************************************************** > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From alecclews at gmail.com Thu Jan 31 13:38:38 2008 From: alecclews at gmail.com (Alec Clews) Date: Fri, 01 Feb 2008 08:38:38 +1100 Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 In-Reply-To: Message-ID: I have to present my apologies. Due to a late family event I can't make it. :-( -- Alec Clews Personal Melbourne, Australia. Jabber: alecclews at jabber.org.au PGPKey ID: 0x9BBBFC7C Blog http://alecthegeek.wordpress.com/ > From: Scott Penrose > Date: Fri, 1 Feb 2008 07:33:53 +1100 > To: > Cc: > Subject: Re: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 > > What I am bringing: > > * 22" LCD > * Ubuntu, Keyboard, Mouse > * Embedded PC, Hardware input/output (if I get it working Saturday > morning). > > If someone could also bring a laptop, that way we have a backup. > > Also, if I can find it, we used to have some posters around - but if > anyone was willing to make up a flyer or similar that too would be > great. > > Scooter > > On 08/01/2008, at 10:43 AM, leif.eriksen at hpa.com.au wrote: > >> >> I too can help for a couple of hours. Morning or afternoon ? >> >> What kind of stuff do we want to do ? Flyers and stuff need to be >> organised, and we should see if we can pump someone for some prizes >> that people who come to our table can win. >> >> We could also run some kind of activity - mind runs wild at this >> point... >> >> We could do some talks, my fav would be something to dispel the >> 'Perl is >> write-only' perception - so a short 20 minutes showing some >> exceptionally clear Perl. We could do that every couple of hours. >> >> On that slant, what about a modified Mythbuster's-style theme where we >> take common Perl misconceptions and bust em!! I bags being Jamie - I >> may >> even have enough time to grow a moustache. I nominate Alfie to be >> Adam - >> just cause I think it would be really funny to see him get blown >> up ! We >> are going to blow stuff up, right ? >> >> We could run a hack-a-thon for ourselves, something to do between >> talking to attendees - if we could organise a projector to use this >> as a >> background , it would make a great "what are they doing over there, >> where the big emacs session is ? Dunno, lets have a look" >> >> I dunno if Scott is free and up to dragging the big board out again. >> What about hooking up some stepper motors to the transmitter for your >> R/C helicopter - we'll use your Device::Serial and some driver >> boards to >> write a flight control program !! Should take only a day ! >> >> L >> >> >>> -----Original Message----- >>> From: melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org >>> [mailto:melbourne-pm-bounces+leif.eriksen=hpa.com.au at pm.org] >>> On Behalf Of jarich at perltraining.com.au >>> Sent: Monday, 7 January 2008 6:28 PM >>> To: melbourne-pm at pm.org >>> Subject: [Melbourne-pm] Linux.conf.au Open Day - 2nd February 2008 >>> >>> Dear Melbourne Perl Mongers members, >>> >>> I have yet to hear from someone in this group about hosting a >>> free community table at this year's LCA Open Day. >>> >>>> From January 28th - February 2nd, Melbourne will host one of the >>> world's best FOSS conferences: Linux.conf.au. On the last >>> day, Saturday February 2nd we will be running an Open Day for >>> the general public to showcase open source. The 2007 open >>> day had a fantastic line-up of displays including: >>> >>> - Virtual Reality >>> - Blender 3D >>> - One Laptop Per Child >>> - MythTV >>> - Linux Gaming >>> >>> (for more see: http://www.linux.org.au/conf/2007/OpenDay.html) >>> >>> To make this day more fabulous, I would like to invite your >>> group to host a community table. There are only two requirements: >>> >>> - Open Source must be involved. >>> - You need to supply your own computers, flyers and people. >>> >>> In return, we'll supply you with tables, chairs, power >>> sources, wireless (hopefully), food, drink and visitors. >>> With luck you can raise the profile of your user group (and >>> get some more members) while increasing the attendees' >>> awareness of Open Source. >>> >>> If your group would be interested in having a stand, please >>> let me know by either responding to this email or contacting >>> openday at mel8ourne.org If you'd like to attend or if you know >>> anyone who might like to attend please register (it's free) at: >>> >>> http://linux.conf.au/programme/open-day >>> >>> Everyone is welcome and I encourage you to bring your friends >>> and family. >>> >>> All the best, >>> >>> Jacinta >>> _______________________________________________ >>> Melbourne-pm mailing list >>> Melbourne-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/melbourne-pm >>> >> ********************************************************************** >> IMPORTANT >> The contents of this e-mail and its attachments are confidential and >> intended >> solely for the use of the individual or entity to whom they are >> addressed. If >> you received this e-mail in error, please notify the HPA Postmaster, >> postmaster at hpa.com.au >> , >> then delete the e-mail. >> This footnote also confirms that this e-mail message has been swept >> for the >> presence of computer viruses by Ironport. Before opening or using any >> attachments, check them for viruses and defects. >> Our liability is limited to resupplying any affected attachments. >> HPA collects personal information to provide and market our >> services. For more >> information about use, disclosure and access see our Privacy Policy at >> www.hpa.com.au >> ********************************************************************** >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From andrew.stuart at flatraterecruitment.com.au Thu Jan 31 19:08:55 2008 From: andrew.stuart at flatraterecruitment.com.au (Andrew Stuart) Date: Fri, 1 Feb 2008 14:08:55 +1100 Subject: [Melbourne-pm] Etiquette question Message-ID: <06E0AD53-4934-45E0-B2A2-014ED3CAEE94@flatraterecruitment.com.au> Is it appropriate to post a PHP job ad to this list? If I think there might be interested parties? Thanks Andrew Stuart Managing Director Flat Rate Recruitment Head Office: 68 -72 York St South Melbourne, Victoria 3205 Phone: 1300 55 91 92 Phone 03 9696 1616 Mobile: 0417 034 241 Email: andrew.stuart at FlatRateRecruitment.com.au Web: http://www.FlatRateRecruitment.com.au -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080201/ea183fad/attachment.html From daniel at rimspace.net Thu Jan 31 21:41:48 2008 From: daniel at rimspace.net (Daniel Pittman) Date: Fri, 01 Feb 2008 16:41:48 +1100 Subject: [Melbourne-pm] Perl best practices: script actions based on a command line argument Message-ID: <87hcgtqllv.fsf@rimspace.net> G'day. I semi-regularly end up writing small scripts that do little jobs for myself, such as performing various DNS checks, interfacing to billing systems and the like. Generally these end up as a single script that handles half a dozen closely related but mostly independent functions, such as: dns mx ... # check MX details for a domain dns ns ... # check NS details for a domain I typically implement this as a bunch of supporting code and libraries, and a command wrapper that read the first command line argument and dispatches to a function based on it. This being Perl there are a lot of ways to do that, all of which are a bit ugly (in my opinion), such as a cascade of if ($blah eq 'foo') statements or a hash full of function refs... So, what is the general consensus on the best way to do this -- what is the nicest way to dispatch to the various command handlers based on a command line argument? Regards, Daniel -- Daniel Pittman Phone: 03 9428 6922 1/130-132 Stawell St, Richmond Web: http://www.cyber.com.au Cybersource: Australia's Leading Linux and Open Source Solutions Company From toby.corkindale at rea-group.com Thu Jan 31 22:04:48 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Fri, 01 Feb 2008 17:04:48 +1100 Subject: [Melbourne-pm] Perl best practices: script actions based on a command line argument In-Reply-To: <87hcgtqllv.fsf@rimspace.net> References: <87hcgtqllv.fsf@rimspace.net> Message-ID: <47A2B680.7090507@rea-group.com> Daniel Pittman wrote: > G'day. > > I semi-regularly end up writing small scripts that do little jobs for > myself, such as performing various DNS checks, interfacing to billing > systems and the like. > > Generally these end up as a single script that handles half a dozen > closely related but mostly independent functions, such as: > > dns mx ... # check MX details for a domain > dns ns ... # check NS details for a domain > > I typically implement this as a bunch of supporting code and libraries, > and a command wrapper that read the first command line argument and > dispatches to a function based on it. > > This being Perl there are a lot of ways to do that, all of which are > a bit ugly (in my opinion), such as a cascade of if ($blah eq 'foo') > statements or a hash full of function refs... > > > So, what is the general consensus on the best way to do this -- what is > the nicest way to dispatch to the various command handlers based on a > command line argument? How about: package My::Commands; use base 'My::Dispatcher'; sub pull : Dispatchable { # pull stuff } sub push : Dispatchable { # push stuff } and then in your main code you do: $pkg->dispatch($ARGV[0]); where My::Dispatcher needs to add an attribute handler for Dispatchable, so as to list those methods as valid things to be called. From lsharpe at pacificwireless.com.au Thu Jan 31 22:18:06 2008 From: lsharpe at pacificwireless.com.au (Leigh Sharpe) Date: Fri, 1 Feb 2008 17:18:06 +1100 Subject: [Melbourne-pm] Perl best practices: script actions based on acommand line argument Message-ID: <96CF49BD8B56384395D698BA99007FA32FA0D0@exchange.pacwire.local> What about: My $mode=shift; $mode eq 'dns' and dns_function(); $mode eq 'mx' and mx_function(); # etc. # etc. It's a little less ugly than the cascading if..else's. -----Original Message----- From: melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org [mailto:melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org] On Behalf Of Daniel Pittman Sent: Friday, 1 February 2008 4:42 PM To: melbourne-pm at pm.org Subject: [Melbourne-pm] Perl best practices: script actions based on acommand line argument G'day. I semi-regularly end up writing small scripts that do little jobs for myself, such as performing various DNS checks, interfacing to billing systems and the like. Generally these end up as a single script that handles half a dozen closely related but mostly independent functions, such as: dns mx ... # check MX details for a domain dns ns ... # check NS details for a domain I typically implement this as a bunch of supporting code and libraries, and a command wrapper that read the first command line argument and dispatches to a function based on it. This being Perl there are a lot of ways to do that, all of which are a bit ugly (in my opinion), such as a cascade of if ($blah eq 'foo') statements or a hash full of function refs... So, what is the general consensus on the best way to do this -- what is the nicest way to dispatch to the various command handlers based on a command line argument? Regards, Daniel -- Daniel Pittman Phone: 03 9428 6922 1/130-132 Stawell St, Richmond Web: http://www.cyber.com.au Cybersource: Australia's Leading Linux and Open Source Solutions Company _______________________________________________ Melbourne-pm mailing list Melbourne-pm at pm.org http://mail.pm.org/mailman/listinfo/melbourne-pm From list at bereft.net Thu Jan 31 22:19:31 2008 From: list at bereft.net (Brad Bowman) Date: Fri, 01 Feb 2008 17:19:31 +1100 Subject: [Melbourne-pm] Perl best practices: script actions based on a command line argument In-Reply-To: <87hcgtqllv.fsf@rimspace.net> References: <87hcgtqllv.fsf@rimspace.net> Message-ID: <47A2B9F3.2050607@bereft.net> > So, what is the general consensus on the best way to do this -- what is > the nicest way to dispatch to the various command handlers based on a > command line argument? I found the way svk dispatched to it's various sub-commands interesting, although the details have faded from my mind. Scanning through again, I think svk calls SVK::Command->invoke(..., $cmd, ... @ARGV); (SVK::Command->invoke loads the corresponding class SVK::Command::$name) SVK::Command is a base class and namespace for other commands, providing some option handling and utility methods. Commands are in their own modules like SVK::Command::Add. They provide a "run" method, options list and various other things. This might be a bit overblown for your situation. http://search.cpan.org/~clkao/SVK-v2.0.2/lib/SVK/Command.pm Brad PS. "XD" is Working Copy. This may help make the code clearer. -- In the judgement of the elders, a samurai's obstinacy should be excessive. A thing done with moderation may later be judged insufficient. I have heard that when one thinks he has gone too far, he will not have erred. This sort of rule should not be forgotten. -- Hagakure http://bereft.net/hagakure/ From wjmoore at gmail.com Thu Jan 31 22:22:31 2008 From: wjmoore at gmail.com (Wesley Moore) Date: Fri, 1 Feb 2008 17:22:31 +1100 Subject: [Melbourne-pm] Perl best practices: script actions based on acommand line argument In-Reply-To: <96CF49BD8B56384395D698BA99007FA32FA0D0@exchange.pacwire.local> References: <96CF49BD8B56384395D698BA99007FA32FA0D0@exchange.pacwire.local> Message-ID: <664f64be0801312222u763fea2bg197d64556fdc938e@mail.gmail.com> Pretty sure some might consider this ugly but it works and doesn't get bigger the more functions you add: #!/opt/local/bin/perl use strict; use warnings; my $cmd = shift; die 'Usage is....' unless($cmd); my $value; if(__PACKAGE__->can($cmd)) { $value = __PACKAGE__->$cmd(@ARGV); } else { die "$cmd is not a valid command"; } exit $value; sub func_one { print "one\n"; return 0; } sub func_two { print "two\n"; return 0; } sub func_three { print "three\n"; return 0; } Sample execution: % perl dispatch.pl Usage is.... at dispatch.pl line 7. % perl dispatch.pl fun_one fun_one is not a valid command at dispatch.pl line 14. % perl dispatch.pl func_one one % perl dispatch.pl func_three three Wes On Feb 1, 2008 5:18 PM, Leigh Sharpe wrote: > > > What about: > > My $mode=shift; > $mode eq 'dns' and dns_function(); > $mode eq 'mx' and mx_function(); > # etc. > # etc. > > It's a little less ugly than the cascading if..else's. > > > > > > > > -----Original Message----- > From: melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org > [mailto:melbourne-pm-bounces+lsharpe=pacificwireless.com.au at pm.org] On > Behalf Of Daniel Pittman > Sent: Friday, 1 February 2008 4:42 PM > To: melbourne-pm at pm.org > Subject: [Melbourne-pm] Perl best practices: script actions based on > acommand line argument > > G'day. > > I semi-regularly end up writing small scripts that do little jobs for > myself, such as performing various DNS checks, interfacing to billing > systems and the like. > > Generally these end up as a single script that handles half a dozen > closely related but mostly independent functions, such as: > > dns mx ... # check MX details for a domain > dns ns ... # check NS details for a domain > > I typically implement this as a bunch of supporting code and libraries, > and a command wrapper that read the first command line argument and > dispatches to a function based on it. > > This being Perl there are a lot of ways to do that, all of which are > a bit ugly (in my opinion), such as a cascade of if ($blah eq 'foo') > statements or a hash full of function refs... > > > So, what is the general consensus on the best way to do this -- what is > the nicest way to dispatch to the various command handlers based on a > command line argument? > > > Regards, > Daniel > -- > Daniel Pittman Phone: 03 9428 6922 > 1/130-132 Stawell St, Richmond Web: http://www.cyber.com.au > Cybersource: Australia's Leading Linux and Open Source Solutions Company > _______________________________________________ > > > > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm >