Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created July 2, 2012 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ynonp/3032056 to your computer and use it in GitHub Desktop.
Save ynonp/3032056 to your computer and use it in GitHub Desktop.
use v5.14;
package Zombie;
use Moose;
has 'victims', is => 'ro', isa => 'ArrayRef[Human]';
has 'home', is => 'ro', isa => 'Str';
sub eat_brain {
my $self = shift;
my @new_victims = @_;
push $self->victims, @new_victims;
}
package main;
my $z = Zombie->new;
for my $attr ( $z->meta->get_all_attributes ) {
say $attr->name;
}
for my $method ( $z->meta->get_all_methods ) {
say $method->fully_qualified_name;
}
if ( $z->meta->has_method( 'eat_brain' ) ) {
$z->eat_brain;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment