Created
January 31, 2019 01:12
-
-
Save rjbs/eb50fc40d59f4b253bae0d2ee0daf8a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.20.0; | |
use warnings; | |
package Demo { | |
use Moo; | |
has raw_x => ( | |
is => 'ro', | |
required => 1, | |
init_arg => 'x', | |
); | |
has x => ( | |
is => 'ro', | |
lazy => 1, | |
default => sub { die "!?" }, | |
); | |
} | |
my $obj = Demo->new({ x => 1 }); | |
use Data::Dumper; | |
warn Dumper($obj); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VAR1 = bless( { | |
'raw_x' => 1, | |
'x' => 1 | |
}, 'Demo' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment