Skip to content

Instantly share code, notes, and snippets.

@rjbs
Created January 31, 2019 01:12
Show Gist options
  • Save rjbs/eb50fc40d59f4b253bae0d2ee0daf8a1 to your computer and use it in GitHub Desktop.
Save rjbs/eb50fc40d59f4b253bae0d2ee0daf8a1 to your computer and use it in GitHub Desktop.
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);
$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