* To improve Moose compat, the third argument to trigger
(the attribute metaobject) has been removed (Sartak)
+ * To improve Moose compat, a single undef passed to new
+ is now disallowed (Sartak)
+
0.19 Sun Mar 8 04:38:01 2009
* Parameterized type constraints for ArrayRef and HashRef (lestrrat)
return <<'...';
do {
if ( scalar @_ == 1 ) {
- if ( defined $_[0] ) {
- ( ref( $_[0] ) eq 'HASH' )
+ ( ref( $_[0] ) eq 'HASH' )
|| Carp::confess "Single parameters to new() must be a HASH ref";
- +{ %{ $_[0] } };
- }
- else {
- +{};
- }
+ +{ %{ $_[0] } };
}
else {
+{@_};
my $class = shift;
if (scalar @_ == 1) {
- if (defined $_[0]) {
- (ref($_[0]) eq 'HASH')
- || confess "Single parameters to new() must be a HASH ref";
- return {%{$_[0]}};
- } else {
- return {};
- }
+ (ref($_[0]) eq 'HASH')
+ || confess "Single parameters to new() must be a HASH ref";
+ return {%{$_[0]}};
}
else {
return {@_};
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 7;
use Test::Exception;
do {
Class->new('non-hashref scalar');
} qr/Single parameters to new\(\) must be a HASH ref/;
-lives_ok {
+throws_ok {
Class->new(undef);
-} "Class->new(undef) specifically doesn't throw an error. weird"
+} qr/Single parameters to new\(\) must be a HASH ref/;
+
+Class->meta->make_immutable;
+
+throws_ok {
+ Class->new('non-hashref scalar');
+} qr/Single parameters to new\(\) must be a HASH ref/;
+throws_ok {
+ Class->new(undef);
+} qr/Single parameters to new\(\) must be a HASH ref/;