Skip to content

Instantly share code, notes, and snippets.

@artifactsauce
Last active December 17, 2015 22:29
Show Gist options
  • Save artifactsauce/5682711 to your computer and use it in GitHub Desktop.
Save artifactsauce/5682711 to your computer and use it in GitHub Desktop.
An example of Moo.
#!/usr/bin/env perl
package MooSample;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
has 'val_int' => (
is => 'ro',
isa => Int,
);
has 'val_bol' => (
is => 'ro',
isa => Bool,
);
has 'val_str' => (
is => 'ro',
isa => Str,
);
1;
package main;
use Devel::Dwarn;
my $obj = MooSample->new(
val_int => 1,
val_bol => 1,
val_str => "testtest",
);
$obj->$::Dwarn; # The dump method is not provided by default.
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment