Last active
December 17, 2015 22:29
-
-
Save artifactsauce/5682711 to your computer and use it in GitHub Desktop.
An example of Moo.
This file contains hidden or 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
#!/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