use Scalar::Util 'blessed', 'weaken', 'looks_like_number';
-our $VERSION = '0.70';
+our $VERSION = '0.71_01';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
# this was changed in 0.41, but broke MooseX::Singleton, so try to catch
# any other code using the original broken spelling
-sub intialize_body { Moose->throw_error("Please correct the spelling of 'intialize_body' to 'initialize_body'") }
+sub intialize_body { $_[0]->throw_error("Please correct the spelling of 'intialize_body' to 'initialize_body'") }
sub initialize_body {
my $self = shift;
'@type_constraint_bodies' => \@type_constraint_bodies,
},
) or $self->throw_error("Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source );
-
+
$self->{'body'} = $code;
}
return join("\n",
'do {',
$self->_inline_throw_error('"Single parameters to new() must be a HASH ref"', 'data => $_[0]'),
- ' if scalar @_ == 1 && defined $_[0] && ref($_[0]) ne q{HASH};',
+ ' if scalar @_ == 1 && !( defined $_[0] && ref $_[0] eq q{HASH} );',
'(scalar @_ == 1) ? {%{$_[0]}} : {@_};',
'}',
);
. '$instance, '
. $self->meta_instance->inline_get_slot_value(
'$instance',
- ("'" . $attr->name . "'")
+ $attr->name,
)
. ', '
. '$attrs->[' . $i . ']'
$source = (
$self->meta_instance->inline_set_slot_value(
'$instance',
- ("'" . $attr->name . "'"),
+ $attr->name,
$value
) . ';'
);
"\n" .
$self->meta_instance->inline_weaken_slot_value(
'$instance',
- ("'" . $attr->name . "'")
+ $attr->name
) .
' if ref ' . $value . ';'
);