X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Singleton.git;a=blobdiff_plain;f=lib%2FMooseX%2FSingleton%2FMeta%2FMethod%2FConstructor.pm;h=c27085f517d2c8652e4a3c76d1d842efc6de03d9;hp=be99947061f8c78c615cedc639c1fb107161d0c0;hb=d871257e46e9a2871c530139b5c20a9e54c8875a;hpb=15bb6eb91097bf5a211688ccd1c47dcb59da7a0f 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($_)