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 lua | |
-------------------------------------------------------------------------------- | |
-- _ _ | |
-- __ _ ___| |__ ___ ___| | __ | |
-- / _` |/ __| '_ \ / _ \/ __| |/ / | |
-- | (_| | (__| | | | __/ (__| < | |
-- \__, |\___|_| |_|\___|\___|_|\_\ | |
-- |___/ | |
-- | |
-- Check what's being exported into the global table by a given module. |
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
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
#!/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 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
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
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[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 Object; | |
use Player; | |
my $lamp = Object->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
package Player; | |
use Moose; | |
has 'inventory' => ( | |
default => sub { [] }, | |
is => 'ro', | |
); | |
sub list_inventory { | |
my $self = shift; |