From melbourne.pm at joshheumann.com Thu Jan 6 18:55:53 2011 From: melbourne.pm at joshheumann.com (Josh Heumann) Date: Thu, 6 Jan 2011 18:55:53 -0800 Subject: [Melbourne-pm] New module: Number::Phone::AU Message-ID: <20110107025553.GA10108@joshheumann.com> Howdy, Australian Perlmongers. After poking around on CPAN, I realised that there were no modules to validate Australian phone numbers. So now there is! Introducing Number::Phone::AU: http://search.cpan.org/~heumann/Number-Phone-AU-0.02/lib/Number/Phone/AU.pm Keep in mind that this doesn't validate all Australian phone numbers; that would be insanity[1]. What it /does/ do is check to see if the number looks generally like a valid Australian phone number. This is to sanitise user-entered contact numbers, which I'm guessing is the largest use-case. It's probably rife with bugs. Patches are, of course, welcome :) J PS. I'm not on the mailing list for any other Australian Perlmonger groups, so feel free to forward this around if you are. [1] for a little taste of that insanity, see http://en.wikipedia.org/wiki/Telephone_numbers_in_Australia From tjc at wintrmute.net Thu Jan 6 19:45:17 2011 From: tjc at wintrmute.net (Toby Wintermute) Date: Fri, 7 Jan 2011 14:45:17 +1100 Subject: [Melbourne-pm] New module: Number::Phone::AU In-Reply-To: <20110107025553.GA10108@joshheumann.com> References: <20110107025553.GA10108@joshheumann.com> Message-ID: On 7 January 2011 13:55, Josh Heumann wrote: > Howdy, Australian Perlmongers. ?After poking around on CPAN, I realised > that there were no modules to validate Australian phone numbers. ?So now > there is! > > Introducing Number::Phone::AU: > http://search.cpan.org/~heumann/Number-Phone-AU-0.02/lib/Number/Phone/AU.pm Line 4: use Mouse; :( I use Moose everywhere, but don't want some random modules using Mouse instead. How about using Any::Moose, which will use Mouse unless Moose is loaded? Toby From schwern at pobox.com Thu Jan 6 21:01:47 2011 From: schwern at pobox.com (Michael G Schwern) Date: Fri, 07 Jan 2011 16:01:47 +1100 Subject: [Melbourne-pm] New module: Number::Phone::AU In-Reply-To: References: <20110107025553.GA10108@joshheumann.com> Message-ID: <4D269E3B.3060601@pobox.com> On 2011.1.7 2:45 PM, Toby Wintermute wrote: > On 7 January 2011 13:55, Josh Heumann wrote: >> Howdy, Australian Perlmongers. After poking around on CPAN, I realised >> that there were no modules to validate Australian phone numbers. So now >> there is! >> >> Introducing Number::Phone::AU: >> http://search.cpan.org/~heumann/Number-Phone-AU-0.02/lib/Number/Phone/AU.pm > > Line 4: use Mouse; > > :( > > I use Moose everywhere, but don't want some random modules using Mouse instead. I want to answer that in detail, because Mouse gets a lot of crap based on outdated information. I've been relying on Mouse extensively for Test::Builder2 and it continues to amaze me how complete and fast it is. (After walking over and talking with Toby in person) Toby's rationale here is that (apologizes for puppeting you, Toby):: 1) Mouse might be less feature complete. You'd be hard pressed to find a feature which is missing from Mouse at this point. And obviously Mouse has all the features needed for Number::Phone::AU. 2) Moose + Mouse consumes more memory then just Moose. I measure it at about 1.5 megs more memory or just 10% of Moose. Insignificant. There's no really compelling reason why some random module, which is a black box, can't use Mouse. > How about using Any::Moose, which will use Mouse unless Moose is loaded? Short version: sure, there's probably no harm. Long version: The problem with Any::Moose is now you may get different bugs depending on if Moose or Mouse is loaded. Used to be a bigger problem than it is now. The second problem with Any::Moose is that Mouse is now significantly *faster* at runtime than Moose. This is likely the result of Mouse::XS. Here's my benchmarks adapting Ovid's from http://blogs.perl.org/users/ovid/2010/01/roles-without-moose.html Testing Perl 5.012002, Moose 1.21, Mouse 0.88 Benchmark: timing 6000000 iterations of hash, manual, moose, mouse... hash: 1 wallclock secs ( 2.03 usr + 0.01 sys = 2.04 CPU) @ 2941176.47/s (n=6000000) manual: 8 wallclock secs ( 8.87 usr + 0.02 sys = 8.89 CPU) @ 674915.64/s (n=6000000) moose: 8 wallclock secs ( 9.04 usr + 0.01 sys = 9.05 CPU) @ 662983.43/s (n=6000000) mouse: 2 wallclock secs ( 3.22 usr + 0.01 sys = 3.23 CPU) @ 1857585.14/s (n=6000000) Add an "isa => 'Int'" type check to the Moose/Mouse attributes and the difference between Moose and Mouse becomes even more clear. $ perl ~/devel/benches/mouse_vs_moose Testing Perl 5.012002, Moose 1.21, Mouse 0.88 Benchmark: timing 6000000 iterations of hash, manual, moose, mouse... hash: 3 wallclock secs ( 2.15 usr + 0.01 sys = 2.16 CPU) @ 2777777.78/s (n=6000000) manual: 10 wallclock secs ( 8.83 usr + 0.01 sys = 8.84 CPU) @ 678733.03/s (n=6000000) moose: 22 wallclock secs (20.87 usr + 0.02 sys = 20.89 CPU) @ 287218.76/s (n=6000000) mouse: 4 wallclock secs ( 3.13 usr + 0.01 sys = 3.14 CPU) @ 1910828.03/s (n=6000000) Using Mouse is *faster* than a simple Perl accessor. It's approaching raw hash access. Moose with a type check is 10x slower than raw hash access. So if you want performance, use Mouse use Moose. This runs directly counter to Any::Moose. Mind you, I'm sure you can kill Mouse performance pretty easily, but as it's a module tailor built to produce the Moose interface (rather than a sugar wrapper around a generic Meta Object Protocol) I expect it to continue to get faster. Moose is about the MOP, and flexibility for MooseX and design purity. Mouse is just implementing Moose and can optimize like mad. Both are valid goals. Both can happily live together in the same project. Pick which one you need for your code. -- On error resume stupid From tjc at wintrmute.net Thu Jan 6 21:52:17 2011 From: tjc at wintrmute.net (Toby Wintermute) Date: Fri, 7 Jan 2011 16:52:17 +1100 Subject: [Melbourne-pm] New module: Number::Phone::AU In-Reply-To: <4D269E3B.3060601@pobox.com> References: <20110107025553.GA10108@joshheumann.com> <4D269E3B.3060601@pobox.com> Message-ID: On 7 January 2011 16:01, Michael G Schwern wrote: > On 2011.1.7 2:45 PM, Toby Wintermute wrote: >> I use Moose everywhere, but don't want some random modules using Mouse instead. > > I want to answer that in detail, because Mouse gets a lot of crap based on > outdated information. ?I've been relying on Mouse extensively for > Test::Builder2 and it continues to amaze me how complete and fast it is. Really? I tried search-and-replacing all "use Moose" to "use Mouse" in one of my apps to try a comparison of total memory use in a large project, however with Mouse the project fails to fire up at all -- and I don't think I'm using Moose's features extensively. > 1) Mouse might be less feature complete. > > You'd be hard pressed to find a feature which is missing from Mouse at this > point. ?And obviously Mouse has all the features needed for Number::Phone::AU. As above, it failed immediately; it looks like I need to mess around with some extra modules before Mouse supports attribute traits. > 2) Moose + Mouse consumes more memory then just Moose. > > I measure it at about 1.5 megs more memory or just 10% of Moose. ?Insignificant. But equally, does it matter if you just used Moose on its own? You would use less memory than both, and Moose's memory use, in a large project, is unlikely to be significant. > There's no really compelling reason why some random module, which is a black > box, can't use Mouse. I just dislike having multiple implementations of the same protocol loaded; it seems messy to me. >> How about using Any::Moose, which will use Mouse unless Moose is loaded? > > Short version: sure, there's probably no harm. > > Long version: > > The problem with Any::Moose is now you may get different bugs depending on if > Moose or Mouse is loaded. ?Used to be a bigger problem than it is now. > > The second problem with Any::Moose is that Mouse is now significantly *faster* > at runtime than Moose. ?This is likely the result of Mouse::XS. ?Here's my > benchmarks adapting Ovid's from > http://blogs.perl.org/users/ovid/2010/01/roles-without-moose.html Mmm... so why couldn't the effort to speed up Mouse be put into Moose too? >From Ovid's blog, he notes: "Mouse seemed promising, but initial benchmarks with the above code showed it's getters/setters running slightly slower than Moose getter/setters! We can take a performance hit on load, but on runtime, we have to be careful." (That was a year ago, and I guess Mouse sped up since then.) But - sooner or later Moose will get the same treatment. (Aside: I am a little wary of the high-performance XS stuff that comes along; sure, they are fast, but things like Template::Stash::XS, Template::Alloy::XS and Class::XSAccessor have left a bad taste in my mouth with their bugs.) > Using Mouse is *faster* than a simple Perl accessor. ?It's approaching raw > hash access. ?Moose with a type check is 10x slower than raw hash access. > > So if you want performance, use Mouse use Moose. ?This runs directly counter > to Any::Moose. Aren't we prematurely optimising here though? You're taking a module that has less features and less of a track record and is probably less stable, and choosing it because it's currently faster for stuff.. when that stuff might not actually be significant to your programs' performance at all. (Although OK, if its your accessors, it's quite likely it would help) > Mind you, I'm sure you can kill Mouse performance pretty easily, but as it's a > module tailor built to produce the Moose interface (rather than a sugar > wrapper around a generic Meta Object Protocol) I expect it to continue to get > faster. > > Moose is about the MOP, and flexibility for MooseX and design purity. ?Mouse > is just implementing Moose and can optimize like mad. ?Both are valid goals. > Both can happily live together in the same project. ?Pick which one you need > for your code. Well, it does sound like Mouse is in a better state than I thought; I thought it had died off a bit once Moose had sped up a bit. Perhaps I can look into it and see if it makes a difference to projects I care about. Cheers, Toby -- Turning and turning in the widening gyre The falcon cannot hear the falconer Things fall apart; the center cannot hold Mere anarchy is loosed upon the world From schwern at pobox.com Thu Jan 6 23:26:34 2011 From: schwern at pobox.com (Michael G Schwern) Date: Fri, 07 Jan 2011 18:26:34 +1100 Subject: [Melbourne-pm] New module: Number::Phone::AU In-Reply-To: References: <20110107025553.GA10108@joshheumann.com> <4D269E3B.3060601@pobox.com> Message-ID: <4D26C02A.2030600@pobox.com> On 2011.1.7 4:52 PM, Toby Wintermute wrote: > On 7 January 2011 16:01, Michael G Schwern wrote: >> On 2011.1.7 2:45 PM, Toby Wintermute wrote: >>> I use Moose everywhere, but don't want some random modules using Mouse instead. >> >> I want to answer that in detail, because Mouse gets a lot of crap based on >> outdated information. I've been relying on Mouse extensively for >> Test::Builder2 and it continues to amaze me how complete and fast it is. > > Really? > I tried search-and-replacing all "use Moose" to "use Mouse" in one of > my apps to try a comparison of total memory use in a large project, > however with Mouse the project fails to fire up at all -- and I don't > think I'm using Moose's features extensively. > >> 1) Mouse might be less feature complete. >> >> You'd be hard pressed to find a feature which is missing from Mouse at this >> point. And obviously Mouse has all the features needed for Number::Phone::AU. > > As above, it failed immediately; it looks like I need to mess around > with some extra modules before Mouse supports attribute traits. Mouse should support attribute traits. I don't use them much myself, but the Moose tests for them pass. *shrug* >> 2) Moose + Mouse consumes more memory then just Moose. >> >> I measure it at about 1.5 megs more memory or just 10% of Moose. Insignificant. > > But equally, does it matter if you just used Moose on its own? You > would use less memory than both, and Moose's memory use, in a large > project, is unlikely to be significant. Hey, extra memory use was your argument. :) It does matter. Not everyone writes large, persistent projects where startup time does not matter. Yes, people write command line tools. CPAN modules are supposed to be flexible, and an object system should not restrain the environments in which a module is useful. >> There's no really compelling reason why some random module, which is a black >> box, can't use Mouse. > > I just dislike having multiple implementations of the same protocol > loaded; it seems messy to me. Well, that's something you're going to have to work out with your therapist. ;) The wonderful thing about modules is well written ones are black boxes. If you don't like messy details, don't look inside. >> The second problem with Any::Moose is that Mouse is now significantly *faster* >> at runtime than Moose. This is likely the result of Mouse::XS. Here's my >> benchmarks adapting Ovid's from >> http://blogs.perl.org/users/ovid/2010/01/roles-without-moose.html > > Mmm... so why couldn't the effort to speed up Mouse be put into Moose too? Because of the extensible nature of Moose, I'd imagine it's harder to optimize. A higher barrier is likely the philosophical difference between the two development teams. The Moose folks are developing a meta object system more than they're developing an OO system for Perl. Their focus is on the MOP. They consider Moose to be just sugar. For the Mouse team, Mouse is it. There is no goal but to produce a light, fast version of Moose. And as they're two radically different code bases under the hood you can't just port an optimization from one to the other. That said, having Mouse is blow the doors of Moose might light a fire under the Moose devs. Either way, I have code I need to run now. > (Aside: I am a little wary of the high-performance XS stuff that comes > along; sure, they are fast, but things like Template::Stash::XS, > Template::Alloy::XS and Class::XSAccessor have left a bad taste in my > mouth with their bugs.) This is what testing is for. The Mouse::XS stuff goes through the same extensive test suites as pure Perl Mouse. They actually copy and modify the Moose test suite. >> Using Mouse is *faster* than a simple Perl accessor. It's approaching raw >> hash access. Moose with a type check is 10x slower than raw hash access. >> >> So if you want performance, use Mouse use Moose. This runs directly counter >> to Any::Moose. > > Aren't we prematurely optimising here though? > You're taking a module that has less features and less of a track > record and is probably less stable, and choosing it because it's > currently faster for stuff.. when that stuff might not actually be > significant to your programs' performance at all. > (Although OK, if its your accessors, it's quite likely it would help) Since Mouse is a general purpose module that can be used in every environment, yes optimizing getters in by an order of magnitude will definitely help performance. They're accessors, they don't do much and they get called a lot. I have more than once found getters to be a real performance hog. Look at it another way: there is no longer an excuse to write objects by hand or violate encapsulation by grabbing at the guts of an object "because it's faster". > Well, it does sound like Mouse is in a better state than I thought; I > thought it had died off a bit once Moose had sped up a bit. > Perhaps I can look into it and see if it makes a difference to > projects I care about. Yeah, when I talk about Mouse most folks say "wasn't that killed?" There was a point when they were going to, but then development picked up again. Partially because I told Sartak I needed Mouse for Test::Builder2. There's been a bunch of new maintainers and the current guy has a lot of vigor. There's also Matt Trout's "Moo" but I don't know what state that's in. -- Defender of Lexical Encapsulation From toby.corkindale at strategicdata.com.au Sun Jan 9 20:57:31 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 15:57:31 +1100 Subject: [Melbourne-pm] January meet Message-ID: <4D2A91BB.1020903@strategicdata.com.au> Hi all, The Melbourne Perlmongers usually meet on the second wednesday of each month. This month, that will be Wednesday 12th. I wondered if anyone had a talk they would like to present, or if we should just catch up for a meal and beers and the usual war stories? Cheers, Toby From ddick at iinet.net.au Sun Jan 9 21:36:19 2011 From: ddick at iinet.net.au (David Dick) Date: Mon, 10 Jan 2011 16:36:19 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2A91BB.1020903@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> Message-ID: <4D2A9AD3.1060604@iinet.net.au> On 10/01/11 15:57, Toby Corkindale wrote: > Hi all, > The Melbourne Perlmongers usually meet on the second wednesday of each > month. > This month, that will be Wednesday 12th. > > I wondered if anyone had a talk they would like to present, or if we > should just catch up for a meal and beers and the usual war stories? I don't have a talk available, but a meal/beer sounds good. From schwern at pobox.com Sun Jan 9 21:43:33 2011 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 10 Jan 2011 16:43:33 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2A91BB.1020903@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> Message-ID: <4D2A9C85.1090509@pobox.com> On 2011.1.10 3:57 PM, Toby Corkindale wrote: > The Melbourne Perlmongers usually meet on the second wednesday of each month. > This month, that will be Wednesday 12th. > > I wondered if anyone had a talk they would like to present, or if we should > just catch up for a meal and beers and the usual war stories? I'd be happy to celebrate the release and subsequent bleeding death [1] of Test::Builder2 alpha 2 with a talk on the subject. What it is. Why it is. Its design. What you can do with it. Hopefully get people helping out. I've talked about it before, but with hunks of the design missing. This will be the first time the whole design has been implemented. Here's the design overview. http://search.cpan.org/perldoc?Test::Builder2::Design And previous version of the talk. The information about events and method overrides is now out of date. http://schwern.net/talks/Test-Builder2-PPW-2010-with-notes.pdf [1] http://www.cpantesters.org/distro/T/Test-Simple.html#Test-Simple-2.00_03 -- Whip me, beat me, make my code compatible with VMS! From jarich at perltraining.com.au Sun Jan 9 21:44:54 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 10 Jan 2011 16:44:54 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 Message-ID: <4D2A9CD6.9000206@perltraining.com.au> G'day folk, My talk for LCA this year is on Perl's current best practices. It's only 35 minutes or so long, so I can either cover some topics in depth, or many at a high level, or (more likely) a mix of both. I'm compiling a list of such things, and I'm wondering what you'd include? Obvious things to include: use strict; use warnings; use autodie; use v5.12.0 (or 5.10.1); say state Taint Perl::Critic For OO: use Moose (or Mouse or Any::Moose) if Moose * maybe MooseX::MultiMethods * MooseX::Declare Roles Type constraints c3 mro For experimentation with: perlbrew (different perl versions in your home directory) Local::Lib (local installs of modules) Module versioning ie: use Module 1.2.1; Testing Test::More Regular Expressions \A. \Z /msi named captures escape sequences Given/when foreach/when smart matching Try::Tiny Clearly even mentioning all of this in 35 minutes is going to be tough. Can any of you think of anything else that I absolutely *must* mention? 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 toby.corkindale at strategicdata.com.au Sun Jan 9 21:47:56 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 16:47:56 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2A9CD6.9000206@perltraining.com.au> References: <4D2A9CD6.9000206@perltraining.com.au> Message-ID: <4D2A9D8C.7050008@strategicdata.com.au> On 10/01/11 16:44, Jacinta Richardson wrote: > G'day folk, > > My talk for LCA this year is on Perl's current best practices. It's only 35 > minutes or so long, so I can either cover some topics in depth, or many at a > high level, or (more likely) a mix of both. I'm compiling a list of such > things, and I'm wondering what you'd include? > > Obvious things to include: > > use strict; > use warnings; > use autodie; > use v5.12.0 (or 5.10.1); > say > state Should smartmatch and switch get a look-in too? From toby.corkindale at strategicdata.com.au Sun Jan 9 21:49:22 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 16:49:22 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2A9C85.1090509@pobox.com> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> Message-ID: <4D2A9DE2.1020505@strategicdata.com.au> On 10/01/11 16:43, Michael G Schwern wrote: > On 2011.1.10 3:57 PM, Toby Corkindale wrote: >> The Melbourne Perlmongers usually meet on the second wednesday of each month. >> This month, that will be Wednesday 12th. >> >> I wondered if anyone had a talk they would like to present, or if we should >> just catch up for a meal and beers and the usual war stories? > > I'd be happy to celebrate the release and subsequent bleeding death [1] of > Test::Builder2 alpha 2 with a talk on the subject. What it is. Why it is. > Its design. What you can do with it. Hopefully get people helping out. > > I've talked about it before, but with hunks of the design missing. This will > be the first time the whole design has been implemented. That will be great if you can give the talk. I'll see I can arrange a room and beer+pizza for Wednesday. Thanks Michael! -Toby From jarich at perltraining.com.au Sun Jan 9 22:00:11 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 10 Jan 2011 17:00:11 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2A9D8C.7050008@strategicdata.com.au> References: <4D2A9CD6.9000206@perltraining.com.au> <4D2A9D8C.7050008@strategicdata.com.au> Message-ID: <4D2AA06B.70906@perltraining.com.au> Toby Corkindale wrote: > On 10/01/11 16:44, Jacinta Richardson wrote: >> G'day folk, >> >> My talk for LCA this year is on Perl's current best practices. It's >> only 35 >> minutes or so long, so I can either cover some topics in depth, or >> many at a >> high level, or (more likely) a mix of both. I'm compiling a list of such >> things, and I'm wondering what you'd include? >> >> Obvious things to include: >> >> use strict; >> use warnings; >> use autodie; >> use v5.12.0 (or 5.10.1); >> say >> state > > Should smartmatch and switch get a look-in too? They do, they're just further down my list. This was mostly a mental dump with some rather rough grouping rather than any specific plan. 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 schwern at pobox.com Sun Jan 9 22:37:52 2011 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 10 Jan 2011 17:37:52 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2A9CD6.9000206@perltraining.com.au> References: <4D2A9CD6.9000206@perltraining.com.au> Message-ID: <4D2AA940.7050005@pobox.com> On 2011.1.10 4:44 PM, Jacinta Richardson wrote: > My talk for LCA this year is on Perl's current best practices. It's only 35 > minutes or so long, so I can either cover some topics in depth, or many at a > high level, or (more likely) a mix of both. I'm compiling a list of such > things, and I'm wondering what you'd include? Assume I like unless otherwise mentioned. > Obvious things to include: > > use strict; > use warnings; > use autodie; > use v5.12.0 (or 5.10.1); > say > state > Taint FWIW I've largely given up on taint. > Perl::Critic perltidy > For OO: > use Moose (or Mouse or Any::Moose) > if Moose > * maybe MooseX::MultiMethods > * MooseX::Declare Interesting, but runtime performance is crippled by MooseX::Method::Signatures. It does a type check on the invocant every method call causing a 40x slow down in every method call defined using "method". It can barely crank out 10,000 simple method calls on my laptop vs 400,000. https://gist.github.com/772455 I would instead recommend Method::Signatures, works on functions too, though I'm biased. > Roles > Type constraints > c3 mro I don't know how important C3 is once you think in roles. Multiple inheritance just goes away. Method modifiers are worth mentioning for cross cutting concerns and "aspects" but you can easily write yourself invisible spaghetti code with them. > For experimentation with: > perlbrew (different perl versions in your home directory) > Local::Lib (local installs of modules) Good choices. > Module versioning > ie: use Module 1.2.1; I would recommend reviewing http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/ and synthesizing the conclusion. > Testing > Test::More I'd recommend Test::Most, the most popular test libraries in one module. Also Test::NoWarnings. > Regular Expressions > \A. \Z > /msi > named captures > escape sequences Regexp::Common Alternative delimiters. m{//} instead of m/\/\// qr{} to compose regular expressions from pieces. These are old things, but folks still don't use them. > Given/when foreach/when smart matching > > Try::Tiny > > Clearly even mentioning all of this in 35 minutes is going to be tough. Can any > of you think of anything else that I absolutely *must* mention? Module::Build and/or Module::Install Path::Class perl5i? :) -- Hating the web since 1994. From schwern at pobox.com Sun Jan 9 22:38:26 2011 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 10 Jan 2011 17:38:26 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2A9DE2.1020505@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> <4D2A9DE2.1020505@strategicdata.com.au> Message-ID: <4D2AA962.6030904@pobox.com> On 2011.1.10 4:49 PM, Toby Corkindale wrote: > On 10/01/11 16:43, Michael G Schwern wrote: >> On 2011.1.10 3:57 PM, Toby Corkindale wrote: >>> The Melbourne Perlmongers usually meet on the second wednesday of each month. >>> This month, that will be Wednesday 12th. >>> >>> I wondered if anyone had a talk they would like to present, or if we should >>> just catch up for a meal and beers and the usual war stories? >> >> I'd be happy to celebrate the release and subsequent bleeding death [1] of >> Test::Builder2 alpha 2 with a talk on the subject. What it is. Why it is. >> Its design. What you can do with it. Hopefully get people helping out. >> >> I've talked about it before, but with hunks of the design missing. This will >> be the first time the whole design has been implemented. > > That will be great if you can give the talk. > > I'll see I can arrange a room and beer+pizza for Wednesday. How much time is a typical Mel.pm talk? -- Whip me, beat me, make my code compatible with VMS! From toby.corkindale at strategicdata.com.au Sun Jan 9 22:49:09 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 17:49:09 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2AA962.6030904@pobox.com> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> <4D2A9DE2.1020505@strategicdata.com.au> <4D2AA962.6030904@pobox.com> Message-ID: <4D2AABE5.7070500@strategicdata.com.au> On 10/01/11 17:38, Michael G Schwern wrote: > On 2011.1.10 4:49 PM, Toby Corkindale wrote: >> On 10/01/11 16:43, Michael G Schwern wrote: >>> On 2011.1.10 3:57 PM, Toby Corkindale wrote: >>>> The Melbourne Perlmongers usually meet on the second wednesday of each month. >>>> This month, that will be Wednesday 12th. >>>> >>>> I wondered if anyone had a talk they would like to present, or if we should >>>> just catch up for a meal and beers and the usual war stories? >>> >>> I'd be happy to celebrate the release and subsequent bleeding death [1] of >>> Test::Builder2 alpha 2 with a talk on the subject. What it is. Why it is. >>> Its design. What you can do with it. Hopefully get people helping out. >>> >>> I've talked about it before, but with hunks of the design missing. This will >>> be the first time the whole design has been implemented. >> >> That will be great if you can give the talk. >> >> I'll see I can arrange a room and beer+pizza for Wednesday. > > How much time is a typical Mel.pm talk? Varies a lot, but usually 15-30 minutes plus a while for questions and discussion that inevitably happens. Toby From hamish at hamishcarpenter.com Sun Jan 9 22:59:03 2011 From: hamish at hamishcarpenter.com (Hamish Carpenter) Date: Mon, 10 Jan 2011 17:59:03 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2AA940.7050005@pobox.com> References: <4D2A9CD6.9000206@perltraining.com.au> <4D2AA940.7050005@pobox.com> Message-ID: On Mon, Jan 10, 2011 at 5:37 PM, Michael G Schwern wrote: > On 2011.1.10 4:44 PM, Jacinta Richardson wrote: > > Perl::Critic > perltidy > +1 > > Testing > > Test::More > I'd recommend Test::Most, the most popular test libraries in one module. > +1 I'd just like to second Michael's suggestions. Test::Most is a great module to request sysadmins to install as it covers so many in go ;) Hamish -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarich at perltraining.com.au Sun Jan 9 23:21:09 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 10 Jan 2011 18:21:09 +1100 Subject: [Melbourne-pm] \N in regular expressions and unicode Message-ID: <4D2AB365.50109@perltraining.com.au> G'day folk, In 5.12.0(ish) a new meta-character was added for Perl's regular expressions. \N matches anything that isn't a newline, and it was added so that when you use the /s switch (so that . also matches newlines), you still have something other than [^\n] to give you the previous . behaviour. This follows the existing mnemonics: \s - any whitespace \S - any non-whitespace \w - any word character \W - any non-word character and thus: \n - a newline \N - not a newline. However \N{some unicode name} *also* allows you to specify a unicode character by name. This leaves us with a problem. The following two snippets are equivalent: my ($five_letters) = /(\w{5})/; my $five = 5; my ($five_letters) = /(\w{$five})/; Although this is contrived, I can imagine situations where you might not know in advance how many characters you wished to match. Likewise, the following two snippets are equivalent: my ($five_any) = /(.{5})/s; my $five = 5; my ($five_any) = /(.{$five})/s; as you would expect. We can match non-newlines in 5.12.2 with: use v5.12.2; my ($five_non_newlines) = /(\N{5})/; We can match unicode characters with: use utf8; use charnames ':full'; my ($symbol) = /(\N{AC CURRENT})/; What would you expect for the following though? use strict; use warnings; use utf8; use charnames ':full'; use v5.12.2; my $var1 = 5; my $var2 = "AC CURRENT"; say $1 if /(\N{$var1})/; say $1 if /(\N{$var2})/; All the best, Jacinta PS: I know what we do get: Unknown charname '$var1' at utf8.pl line 10 Deprecated character(s) in \N{...} starting at '$var1' at utf8.pl line 10 ... -- ("`-''-/").___..--''"`-._ | 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 iinet.net.au Sun Jan 9 23:38:00 2011 From: ddick at iinet.net.au (David Dick) Date: Mon, 10 Jan 2011 18:38:00 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2AA940.7050005@pobox.com> References: <4D2A9CD6.9000206@perltraining.com.au> <4D2AA940.7050005@pobox.com> Message-ID: <4D2AB758.1080106@iinet.net.au> On 10/01/11 17:37, Michael G Schwern wrote: > FWIW I've largely given up on taint. I'd be interested to read the reasons. I've got a fairly large code base and test suite running under taint. Anything i should be aware of? :) From schwern at pobox.com Sun Jan 9 23:51:58 2011 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 10 Jan 2011 18:51:58 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2AABE5.7070500@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> <4D2A9DE2.1020505@strategicdata.com.au> <4D2AA962.6030904@pobox.com> <4D2AABE5.7070500@strategicdata.com.au> Message-ID: <4D2ABA9E.8030602@pobox.com> On 2011.1.10 5:49 PM, Toby Corkindale wrote: > On 10/01/11 17:38, Michael G Schwern wrote: >> How much time is a typical Mel.pm talk? > > Varies a lot, but usually 15-30 minutes plus a while for questions and > discussion that inevitably happens. That's barely enough time for me to clear my throat! -- I am somewhat preoccupied telling the laws of physics to shut up and sit down. -- Vaarsuvius, "Order of the Stick" http://www.giantitp.com/comics/oots0107.html From schwern at pobox.com Sun Jan 9 23:54:56 2011 From: schwern at pobox.com (Michael G Schwern) Date: Mon, 10 Jan 2011 18:54:56 +1100 Subject: [Melbourne-pm] Perl programming best practices 2011 In-Reply-To: <4D2AB758.1080106@iinet.net.au> References: <4D2A9CD6.9000206@perltraining.com.au> <4D2AA940.7050005@pobox.com> <4D2AB758.1080106@iinet.net.au> Message-ID: <4D2ABB50.70504@pobox.com> On 2011.1.10 6:38 PM, David Dick wrote: > On 10/01/11 17:37, Michael G Schwern wrote: >> FWIW I've largely given up on taint. > > I'd be interested to read the reasons. I've got a fairly large code base and > test suite running under taint. Anything i should be aware of? :) No, just too frustrating. Especially when a CPAN module is internally non-taint safe. If it works for you, continue. I haven't been writing much Internet facing code for a while so I don't know how taint has evolved. -- Whip me, beat me, make my code compatible with VMS! From toby.corkindale at strategicdata.com.au Mon Jan 10 00:50:26 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 19:50:26 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2ABA9E.8030602@pobox.com> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> <4D2A9DE2.1020505@strategicdata.com.au> <4D2AA962.6030904@pobox.com> <4D2AABE5.7070500@strategicdata.com.au> <4D2ABA9E.8030602@pobox.com> Message-ID: <4D2AC852.8020702@strategicdata.com.au> On 10/01/11 18:51, Michael G Schwern wrote: > On 2011.1.10 5:49 PM, Toby Corkindale wrote: >> On 10/01/11 17:38, Michael G Schwern wrote: >>> How much time is a typical Mel.pm talk? >> >> Varies a lot, but usually 15-30 minutes plus a while for questions and >> discussion that inevitably happens. > > That's barely enough time for me to clear my throat! Hey, I said that's the typical time! Feel free to take more :) From toby.corkindale at strategicdata.com.au Mon Jan 10 00:53:00 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 10 Jan 2011 19:53:00 +1100 Subject: [Melbourne-pm] January meet - 12th Wednesday In-Reply-To: <4D2A91BB.1020903@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> Message-ID: <4D2AC8EC.1050404@strategicdata.com.au> Perlmongers! We shall be meeting on the 12th of Wednesday, January. Strategic Data are happy to help out at short notice. Time: 6:30pm Location: Strategic Data, Level 2, 51-55 Johnston Street, Fitzroy Schedule: * Michael Schwern will be talking about Test::Builder2 * Followed by any lightning talks We will then retire to the Standard Pub on Fitzroy Street, nearby. Cheers, Toby From alec.clews at gmail.com Tue Jan 11 23:04:03 2011 From: alec.clews at gmail.com (Alec Clews) Date: Wed, 12 Jan 2011 18:04:03 +1100 Subject: [Melbourne-pm] January meet In-Reply-To: <4D2AC852.8020702@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2A9C85.1090509@pobox.com> <4D2A9DE2.1020505@strategicdata.com.au> <4D2AA962.6030904@pobox.com> <4D2AABE5.7070500@strategicdata.com.au> <4D2ABA9E.8030602@pobox.com> <4D2AC852.8020702@strategicdata.com.au> Message-ID: I've lost the details of the meeting -- can anyone flick them through ASAP please? On 10 January 2011 19:50, Toby Corkindale wrote: > On 10/01/11 18:51, Michael G Schwern wrote: >> >> On 2011.1.10 5:49 PM, Toby Corkindale wrote: >>> >>> On 10/01/11 17:38, Michael G Schwern wrote: >>>> >>>> How much time is a typical Mel.pm talk? >>> >>> Varies a lot, but usually 15-30 minutes plus a while for questions and >>> discussion that inevitably happens. >> >> That's barely enough time for me to clear my throat! > > Hey, I said that's the typical time! Feel free to take more :) > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -- Alec Clews Personal ? ? ? ? ? ?? Melbourne, Australia. Jabber:? alecclews at jabber.org.au? ? ? ? ? ?? PGPKey ID: 0x9BBBFC7C blog:http://alecthegeek.wordpress.com/ From Martin.G.Ryan at team.telstra.com Tue Jan 11 23:05:38 2011 From: Martin.G.Ryan at team.telstra.com (Ryan, Martin G) Date: Wed, 12 Jan 2011 18:05:38 +1100 Subject: [Melbourne-pm] January meet - 12th Wednesday In-Reply-To: <4D2AC8EC.1050404@strategicdata.com.au> References: <4D2A91BB.1020903@strategicdata.com.au> <4D2AC8EC.1050404@strategicdata.com.au> Message-ID: <589EE331794E0B4DA62A9ADE89BCB4057DAD69BC8B@WSMSG3103V.srv.dir.telstra.com> > I've lost the details of the meeting -- can anyone flick them through ASAP please? Regards, Martin -----Original Message----- From: melbourne-pm-bounces+martin.g.ryan=team.telstra.com at pm.org [mailto:melbourne-pm-bounces+martin.g.ryan=team.telstra.com at pm.org] On Behalf Of Toby Corkindale Sent: Monday, 10 January 2011 7:53 PM To: melbourne-pm at pm.org Subject: Re: [Melbourne-pm] January meet - 12th Wednesday Perlmongers! We shall be meeting on the 12th of Wednesday, January. Strategic Data are happy to help out at short notice. Time: 6:30pm Location: Strategic Data, Level 2, 51-55 Johnston Street, Fitzroy Schedule: * Michael Schwern will be talking about Test::Builder2 * Followed by any lightning talks We will then retire to the Standard Pub on Fitzroy Street, nearby. Cheers, Toby _______________________________________________ Melbourne-pm mailing list Melbourne-pm at pm.org http://mail.pm.org/mailman/listinfo/melbourne-pm From toby.corkindale at strategicdata.com.au Wed Jan 12 19:23:47 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Thu, 13 Jan 2011 14:23:47 +1100 Subject: [Melbourne-pm] SpaceChem Message-ID: <4D2E7043.1070008@strategicdata.com.au> The game I demoed at the meeting was SpaceChem. http://www.spacechemthegame.com/ Toby From schwern at pobox.com Thu Jan 13 06:53:57 2011 From: schwern at pobox.com (Michael G Schwern) Date: Fri, 14 Jan 2011 01:53:57 +1100 Subject: [Melbourne-pm] SpaceChem In-Reply-To: <4D2E7043.1070008@strategicdata.com.au> References: <4D2E7043.1070008@strategicdata.com.au> Message-ID: <4D2F1205.2060003@pobox.com> On 2011.1.13 2:23 PM, Toby Corkindale wrote: > The game I demoed at the meeting was SpaceChem. > http://www.spacechemthegame.com/ Played through the first dozen missions or so. Lots of fun! Especially optimizing. http://www.youtube.com/watch?v=fB7bVIXAqag http://www.youtube.com/watch?v=ipoC5WqwpOI http://www.youtube.com/watch?v=Cvf0dlNwcio -- emacs -- THAT'S NO EDITOR... IT'S AN OPERATING SYSTEM! From toby.corkindale at strategicdata.com.au Thu Jan 13 15:58:25 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Fri, 14 Jan 2011 10:58:25 +1100 Subject: [Melbourne-pm] eteRNA Message-ID: <4D2F91A1.3040008@strategicdata.com.au> Here's another cute game, not *quite* programming, but.. It's a game about protein folding. http://eterna.cmu.edu/ Toby From schwern at pobox.com Thu Jan 13 20:58:29 2011 From: schwern at pobox.com (Michael G Schwern) Date: Fri, 14 Jan 2011 15:58:29 +1100 Subject: [Melbourne-pm] Test::Builder2 slides Message-ID: <4D2FD7F5.2020808@pobox.com> Slides for the Test::Builder2 talk are here. http://schwern.net/talks/Test-Builder2%20with%20notes.pdf It has my notes which are pretty complete. -- Hating the web since 1994. From melbourne-pm at mjch.net Mon Jan 17 01:45:15 2011 From: melbourne-pm at mjch.net (Malcolm Herbert) Date: Mon, 17 Jan 2011 20:45:15 +1100 Subject: [Melbourne-pm] issues with Catalyst::Controller::REST example Message-ID: <1295257515.13547.1415676843@webmail.messagingengine.com> I'm trying to bootstrap myself up to speed with using Catalyst::Controller::REST but having issues - the perldoc synopsis shows a basic set of methods to allow HTTP GET and PUT of 'thing'. In the case of the PUT method, this appears to be incomplete: # Answer PUT requests to "thing" sub thing_PUT { $radiohead = $req->data->{radiohead}; $self->status_created( $c, location => $c->req->uri->as_string, entity => { radiohead => $radiohead, } ); } Going by the beginning of thing_GET, I'm assuming I need my ( $self, $c ) = @_; and an appropriate 'my' declaration for $radiohead, but I'm not sure what $req might be (unless this is intended to be passed as a parameter) ... can anyone give me some pointers (or a better example) to get me started? Thanks Regards, Malcolm -- Malcolm Herbert This brain intentionally mjch at mjch.net left blank From jarich at perltraining.com.au Mon Jan 17 03:45:36 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 17 Jan 2011 22:45:36 +1100 Subject: [Melbourne-pm] issues with Catalyst::Controller::REST example In-Reply-To: <1295257515.13547.1415676843@webmail.messagingengine.com> References: <1295257515.13547.1415676843@webmail.messagingengine.com> Message-ID: <4D342BE0.2080602@perltraining.com.au> > ... can anyone give me some pointers (or a better example) to get me > started? Thanks I *think* (but I"m guessing) that the example should say: sub thing_PUT { my ( $self, $c ) = @_; my $radiohead = $c->req->data->{radiohead}; $self->status_created( $c, location => $c->req->uri->as_string, entity => { radiohead => $radiohead, } ); } 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 melbourne-pm at mjch.net Mon Jan 17 03:56:29 2011 From: melbourne-pm at mjch.net (Malcolm Herbert) Date: Mon, 17 Jan 2011 22:56:29 +1100 Subject: [Melbourne-pm] issues with Catalyst::Controller::REST example In-Reply-To: References: <1295257515.13547.1415676843@webmail.messagingengine.com> Message-ID: <1295265389.11499.1415692829@webmail.messagingengine.com> thanks for the replies - that was it ... annoying that the example was b0rk3d ... -- Malcolm Herbert This brain intentionally mjch at mjch.net left blank From jarich at perltraining.com.au Mon Jan 17 04:07:55 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 17 Jan 2011 23:07:55 +1100 Subject: [Melbourne-pm] issues with Catalyst::Controller::REST example In-Reply-To: <1295265389.11499.1415692829@webmail.messagingengine.com> References: <1295257515.13547.1415676843@webmail.messagingengine.com> <1295265389.11499.1415692829@webmail.messagingengine.com> Message-ID: <4D34311B.6080001@perltraining.com.au> Malcolm Herbert wrote: > thanks for the replies - that was it ... annoying that the example was > b0rk3d ... I've corrected this on annocpan. http://www.annocpan.org/~BOBTFISH/Catalyst-Action-REST-0.88/lib/Catalyst/Controller/REST.pm There are other annotations in this document which may or may not be helpful for other issues you hit. 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 mjch.net Mon Jan 17 13:41:43 2011 From: melbourne-pm at mjch.net (Malcolm Herbert) Date: Tue, 18 Jan 2011 08:41:43 +1100 Subject: [Melbourne-pm] issues with Catalyst::Controller::REST example In-Reply-To: <4D34311B.6080001@perltraining.com.au> References: <1295257515.13547.1415676843@webmail.messagingengine.com> <1295265389.11499.1415692829@webmail.messagingengine.com> <4D34311B.6080001@perltraining.com.au> Message-ID: <1295300503.32745.1415788797@webmail.messagingengine.com> On Mon, 17 Jan 2011 23:07 +1100, "Jacinta Richardson" wrote: > I've corrected this on annocpan. > http://www.annocpan.org/~BOBTFISH/Catalyst-Action-REST-0.88/lib/Catalyst/Controller/REST.pm > > There are other annotations in this document which may or may not be > helpful for other issues you hit. that's an excellent site, thanks for the reference! -- Malcolm Herbert This brain intentionally mjch at mjch.net left blank From cosimo.streppone at gmail.com Sun Jan 23 16:00:42 2011 From: cosimo.streppone at gmail.com (Cosimo Streppone) Date: Mon, 24 Jan 2011 11:00:42 +1100 Subject: [Melbourne-pm] February meeting Message-ID: Hi, you might remember a guy from Norway sending his first mail to the list 2-3 weeks ago. I realize it's a bit early for that, but I settled in now. Loving Melbourne so far. I'd definitely like to attend the Feb meeting. Looking forward to meet some (more) Australian Perl hackers. -- Cosimo From jarich at perltraining.com.au Tue Jan 25 21:02:24 2011 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Wed, 26 Jan 2011 15:02:24 +1000 Subject: [Melbourne-pm] Programming Perl course in Melbourne, March 2011 Message-ID: <4D3FAAE0.6040502@perltraining.com.au> All Melbourne Perl Mongers will receive a 10% discount on this training course. Mention this email to receive your discount. This discount adds with both the early bird special and group bookings as appropriate. Programming Perl course ======================= Early Bird: Tuesday 15th February 2011 Course Dates: Monday 7th - Friday 11th March 2011 This course covers Perl's fundamentals to give an existing programmer sufficient knowledge of Perl to work on most projects. Specifically it covers: * Perl's variable types: scalars, arrays, hashes * Operators and functions * Conditional and looping structures * Subroutines * Regular expressions * References and complex data structures * Writing and using modules (libraries) * Documentation * Testing your code * Perl objects * File interaction, including writing and reading files * System interaction and security issues * Directory interaction and file information If you book before the early bird date then you will be entitled to one free book (of your choice) per attendee. http://perltraining.com.au/bookings/Melbourne.html Group discount ============== Make a single booking for three or more people on the same course and receive a 5% discount per person. Referral bonuses ================ Refer your friends and colleagues to us, and get a free book for each booking mentioning you, made before the early bird date. Books can be selected from our list at: http://perltraining.com.au/books.html From schwern at pobox.com Wed Jan 26 20:56:16 2011 From: schwern at pobox.com (Michael G Schwern) Date: Thu, 27 Jan 2011 14:56:16 +1000 Subject: [Melbourne-pm] New perl5i feature, $obj->mo->methods Message-ID: <4D40FAF0.3050909@pobox.com> At the pub after the last meeting, per5li came up. I think Myf wanted to kill smart quotes with a regex, which got into the scary \N{...} syntax. perl5i came up because it turns on utf8 by default, so you can write: use perl5i::2; my $string = q[?I know better than you?, said the word processor.]; $string =~ s{[??]}{"}g; say $string; I was showing off the introspection features in perl5i (what's an object's class, its parents, a complete inheritance walk...) and Myf asked about getting the methods of an object. You can do that in Perl, but normally this involves scary symbol table and glob stuff. No more! Myf, Jacinta and I hacked out a quick implementation at the pub, and I cleaned it up later and now it's released in v2.5.0. So, thank you Melbourne.pm for two new perl5i features! The first gets the symbol table for a class, which is necessary to do method introspection. my $table = $obj->mo->symbol_table; Amazingly, it's four lines. sub symbol_table { my $self = shift; my $class = $self->class; no strict 'refs'; return \%{$class.'::'}; } It's really easy, but it's something that I always forget and it's very poorly documented in the Perl docs. The symbol table is what holds all global variables and functions for each class. And then a method to ask any object what its methods are. my @methods = $obj->mo->methods; By default, that excludes stuff from UNIVERSAL, but you can turn that back on. There's also an option to show just the methods defined in that class. Here's the version without the options. for my $class ($self->linear_isa) { next if $class eq "UNIVERSAL"; my $sym_table = $class->mc->symbol_table; for my $name (keys %$sym_table) { next unless *{$sym_table->{$name}}{CODE}; $all_methods{$name} = $class; } } return wantarray ? keys %all_methods : [keys %all_methods]; The only scary thing in there is *{$sym_table->{$name}}{CODE}. That's looking in the symbol table for the typeglob associated with a thing. A typeglob can be thought of as a hash with a really bad interface. It has slots to hold code refs, scalar refs, array refs and hash refs. CODE, SCALAR, ARRAY and HASH. You get at them with *glob{THING}. So *{$sym_table->{$name}}{CODE} gets the glob for whatever is in $name and checks if there's a code ref there. That's how you check if a method is defined in a class. And the best part is this: you don't need to know any of that! You can just use it. It's in v2.5.0 which I shoved out here at LCA. My talk from OSDC on perl5i is up if you want to know more. http://blip.tv/file/4447749 -- 'All anyone gets in a mirror is themselves,' she said. 'But what you gets in a good gumbo is everything.' -- "Witches Abroad" by Terry Prachett From sisyphus1 at optusnet.com.au Thu Jan 27 00:47:51 2011 From: sisyphus1 at optusnet.com.au (Sisyphus) Date: Thu, 27 Jan 2011 19:47:51 +1100 Subject: [Melbourne-pm] February meeting In-Reply-To: References: Message-ID: <0FFAD6D8AD6F43D9958A3017D351EECC@desktop2> ----- Original Message ----- From: "Cosimo Streppone" > you might remember a guy from Norway sending his > first mail to the list 2-3 weeks ago. > > I realize it's a bit early for that, but I settled in now. > Loving Melbourne so far. Cosimo, just be sure to support the Collingwood Football Club while you're here, and you can't go wrong :-) > I'd definitely like to attend the Feb > meeting. Speaking of which, when *is* the Feb meeting being held ? I've got the week 13-19 Feb off, and if that coincides with the timing of the meeting, I might also be able to attend my first ever Melbourne PM get-together ... partly to catch up with Cosimo, with whom I've had some communication in the past (regarding Win32::API, mainly) .... and partly because it's something I've been intending to do for quite some time, anyway. Cheers, Rob From toby.corkindale at strategicdata.com.au Thu Jan 27 15:03:22 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Fri, 28 Jan 2011 10:03:22 +1100 Subject: [Melbourne-pm] February meeting In-Reply-To: <0FFAD6D8AD6F43D9958A3017D351EECC@desktop2> References: <0FFAD6D8AD6F43D9958A3017D351EECC@desktop2> Message-ID: <4D41F9BA.90705@strategicdata.com.au> On 27/01/11 19:47, Sisyphus wrote: >> I'd definitely like to attend the Feb >> meeting. > > Speaking of which, when *is* the Feb meeting being held? The meetings are always the second Wednesday of each month. The February meeting will be held on the 9th of February. I should put out a call for talks and venues.. From sisyphus1 at optusnet.com.au Fri Jan 28 02:30:02 2011 From: sisyphus1 at optusnet.com.au (Sisyphus) Date: Fri, 28 Jan 2011 21:30:02 +1100 Subject: [Melbourne-pm] February meeting In-Reply-To: <4D41F9BA.90705@strategicdata.com.au> References: <0FFAD6D8AD6F43D9958A3017D351EECC@desktop2> <4D41F9BA.90705@strategicdata.com.au> Message-ID: <495D8DDCDA294BCC887C1C924A0EC61F@desktop2> ----- Original Message ----- From: "Toby Corkindale" > The meetings are always the second Wednesday of each month. > The February meeting will be held on the 9th of February. Darn ... looks like February has started 2 days too early. Not to worry ... some other time. Cheers, Rob From toby.corkindale at strategicdata.com.au Sun Jan 30 22:47:29 2011 From: toby.corkindale at strategicdata.com.au (Toby Corkindale) Date: Mon, 31 Jan 2011 17:47:29 +1100 Subject: [Melbourne-pm] February meeting - 9/2/2011 Message-ID: <4D465B01.5030702@strategicdata.com.au> Hello Perlmongers, The next Melbourne Perlmongers meeting is due to be held on February the 9th, 2011, at 6:30pm. Jacinta Richardson will be giving a talk, described at LCA as: As with many programming languages, it's very easy to find Perl code that can best be described as "write only". Cute tricks, short variable names, inconsistent spacing, dubious reliance on default arguments... Even without the added challenge of a whole extra embedded language (regular expressions), some Perl programs deserve to be referred to as line-noise. Yet Perl is a beautiful, expressive language that can be used successfully by novices through to experts to achieve powerful results; and, with a little extra preparation can be easy to read, fun to work with, and a joy to maintain. This talk will provide a lightning tour of the current status of Perl's best practices. Lightning talks will follow, and no doubt some of us will retire to a nearby pub. Now for the venue.. I'm sure it would be fine with my employers to host the meeting at Strategic Data in Fitzroy, but I want to check that the community is happy with us doing so. How do you feel? Are there any members who would like to host the meeting at their company? Cheers, Toby