MooseX::SingletonMethod now on CPAN
So has promised or was it threatened I’ve packaged and uploaded MooseX::SingletonMethod to CPAN.
Here is the synopsis from the pod:
package Baz;
use Moose;
with 'MooseX::SingletonMethod::Role';
no Moose;
package main;
my $baz = Baz->new;
my $foo = Baz->new;
# add singleton method called "baz" just to $baz and not to Baz class
$baz->add_singleton_method( baz => sub { 'baz!' } );
say $baz->baz; # => 'baz!'
say $foo->baz; # ERROR: Can't locate object method "baz"....
MooseX is the namespace for adding extensions around Moose. Its the playground of future Moose features where modules get torn, beaten and bruised in a development rite of passage.
It would one day be nice to see MooseX::SingletonMethod features grow up and become part of standard Moose family
MooseX::SingletonMethod can also be found in these exotic areas of the web:
/I3az/
PS. While sticking my flag into the MooseX::SingletonMethod namespace I noticed the following module by Simon Cozens:
I’m amazed this as passed me by especially has I first came to understand Singleton Methods from Simon’s excellent “Advanced Perl Programming” book. Just shows you how deep and diverse the CPAN universe is!
Update: Code now uses MX::SM::Role



Trackbacks