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
### Keybase proof | |
I hereby claim: | |
* I am 0branch on github. | |
* I am marcs (https://keybase.io/marcs) on keybase. | |
* I have a public key whose fingerprint is 0839 E1C9 FF90 1E41 FB1A 0EF7 7F47 6083 7774 14BC | |
To claim this, I am signing this object: |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
say "Hello from Gist"; |
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
package Player; | |
use Moose; | |
has 'inventory' => ( | |
default => sub { [] }, | |
is => 'ro', | |
); | |
sub list_inventory { | |
my $self = shift; |
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
package Entity; | |
use Moose; | |
has 'name' => ( | |
isa => 'Str', | |
is => 'rw', | |
required => 1, | |
); | |
has 'description' => ( |
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
package Player; | |
use Moose; | |
has 'inventory' => ( | |
handles => { obtain => 'push' }, | |
isa => 'ArrayRef[Entity]', | |
default => sub { [] }, | |
traits => ['Array'], | |
is => 'ro', | |
); |
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
subtype 'Object' => as 'Ref' => | |
where { blessed($_) && blessed($_) ne 'Regexp' } => | |
optimize_as \&Moose::Util::TypeConstraints::OptimizedConstraints::Object; |
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
package Player; | |
use Moose; | |
has 'inventory' => ( | |
handles => { obtain => 'push' }, | |
isa => 'ArrayRef[Object]', | |
default => sub { [] }, | |
traits => ['Array'], | |
is => 'ro', | |
); |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use Entity; | |
use Player; | |
my $lamp = Entity->new(name => "lamp"); |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Object; | |
my $foo = Object->new(name => "lamp"); | |
my $bar = Object->new(name => {}); |
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
package Object; | |
use Moose; | |
has 'name' => ( | |
isa => 'Str', | |
is => 'rw', | |
required => 1, | |
); | |
has 'description' => ( |
OlderNewer