Commits

Toby Inkster committed 38a5ae0

fix for non-ref defaults

Comments (0)

Files changed (1)

lib/Method/Generate/ClassAccessor.pm

 			no strict 'refs';
 			\%{"$spec->{_classy}\::__ClassAttributeValues"};
 		};
-		if (my $default = $spec->{default})
+		
+		my $default;
+		if (ref($default = $spec->{default}))
 		{
 			$storage->{$name} = $default->($into);
 		}
-		elsif (my $builder = $spec->{builder})
+		elsif ($default = $spec->{default})
 		{
-			$storage->{$name} = $into->$builder;
+			$storage->{$name} = $default;
+		}
+		elsif ($default = $spec->{builder})
+		{
+			$storage->{$name} = $into->$default;
 		}
 	}