Embracing the Ungulate
September 16th, 2009 Posted in CPAN, Metaprogramming, Perl
It’s long past time I started learning Moose. I have a CPAN module (WebService::ISBNDB) that currently uses Class::Std to do the inside-out object thing, so converting it to Moose would be the perfect candidate for a “learning experience”.
Can anyone recommend some online resources (tutorials, blog posts, etc.) that resemble what I’ll be trying to do… i.e., go from a less-favorable inside-out solution to Moose? All pointers greatly appreciated.
No TweetBacks yet. (Be the first to Tweet this post)
September 16th, 2009 at 2:21 PM
I’d start by reading the CPAN tutorial and then reviewing the general docs. Come onto the #moose IRC channel if you get stuck after going through that. In fact, come to the channel and just hang out, you will be surprised what you will learn.
I personally find reviewing examples in the test suite to be helpful.
September 16th, 2009 at 2:31 PM
Actually the best place is probably the Moose::Manual. You might want to read Moose::Manual::Unsweetened to help show the difference between old school Perl OO and Moose. And of course come on over to #moose on irc.perl.org or the mailing list and we will be happy to give you some virtual penicillin to help clear up that (Class::)STD infected module.
On thing to note though is when porting an existing CPAN module, make sure you don’t upset your downstream users, see the recent Moose-or-No-Moose controversy (http://perlhacks.com/2009/09/moose-or-no-moose.php).
September 16th, 2009 at 5:12 PM
As much as I like Moose, much rumbling has been heard about memory usage and startup time for it, so you should probably not replace your Class::Std version with a Moose version, but rather create a WebService::ISBNDB::Moose module instead.
As for creating inside-out objects in Moose, by default Moose uses blessed hashrefs, so I believe what you need to look at is MooseX::InsideOut and MooseX::NonMoose in combination.
September 28th, 2009 at 11:16 PM
We just published the Moose manual which you can buy from Lulu. It’s the official manual, written by Dave Rolsky and Stevan Little. You can get a copy here:
http://www.lulu.com/content/7406976/