From: Dave Rolsky Date: Fri, 27 Jun 2008 04:00:12 +0000 (+0000) Subject: Fix immutability work with latest Moose (0.51), and require said Moose X-Git-Tag: 0.09_02~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d871257e46e9a2871c530139b5c20a9e54c8875a;p=gitmo%2FMooseX-Singleton.git Fix immutability work with latest Moose (0.51), and require said Moose --- diff --git a/ChangeLog b/ChangeLog index 17167a1..2504855 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Revision history for Perl extension MooseX-Singleton +0.09 2008-06-27 + - fix immutability to work with Moose 0.51 (Dave Rolsky) + 0.08 2008-05-24 - fix make_immutable keyword in test (Sartak) - immutable singleton objects did not call triggers in the constructor (Dave Rolsky) diff --git a/Makefile.PL b/Makefile.PL index 500ba0d..1780c74 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -5,7 +5,7 @@ use inc::Module::Install; name 'MooseX-Singleton'; all_from 'lib/MooseX/Singleton.pm'; -requires 'Moose' => '0.41'; +requires 'Moose' => '0.51'; build_requires 'Test::More'; build_requires 'Test::Exception'; diff --git a/lib/MooseX/Singleton.pm b/lib/MooseX/Singleton.pm index bf7168d..179e40d 100644 --- a/lib/MooseX/Singleton.pm +++ b/lib/MooseX/Singleton.pm @@ -3,7 +3,7 @@ use Moose; use MooseX::Singleton::Object; use MooseX::Singleton::Meta::Class; -our $VERSION = 0.08; +our $VERSION = 0.09; sub import { my $caller = caller; diff --git a/lib/MooseX/Singleton/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Meta/Method/Constructor.pm index be99947..c27085f 100644 --- a/lib/MooseX/Singleton/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Meta/Method/Constructor.pm @@ -22,9 +22,9 @@ sub initialize_body { $source .= "\n" . 'return $class->Moose::Object::new(@_)'; $source .= "\n" . ' if $class ne \'' . $self->associated_metaclass->name . '\';'; - $source .= "\n" . 'my %params = (scalar @_ == 1) ? %{$_[0]} : @_;'; + $source .= "\n" . 'my $params = ' . $self->_generate_BUILDARGS('$class', '@_'); - $source .= "\n" . 'my $instance = ' . $self->meta_instance->inline_create_instance('$class'); + $source .= ";\n" . 'my $instance = ' . $self->meta_instance->inline_create_instance('$class'); $source .= ";\n" . (join ";\n" => map { $self->_generate_slot_initializer($_)