Skip to content

Instantly share code, notes, and snippets.

@chrisa
Created January 14, 2014 12:23
Show Gist options
  • Save chrisa/8417484 to your computer and use it in GitHub Desktop.
Save chrisa/8417484 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
package Foo;
use Moose;
use MooseX::UndefTolerant;
use MooseX::Types::Moose qw/ Str /;
has 'bar' => (
isa => Str,
is => 'rw',
required => 0,
default => 'baz',
);
__PACKAGE__->meta->make_immutable;
1;
package main;
my $foo = Foo->new( bar => undef );
is ( $foo->bar, 'baz', 'does the default value get set when passing undef in the constructor and make_immutable is set' );
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment