Skip to content

Instantly share code, notes, and snippets.

@dvinciguerra
Created December 2, 2010 13:03
Show Gist options
  • Save dvinciguerra/725246 to your computer and use it in GitHub Desktop.
Save dvinciguerra/725246 to your computer and use it in GitHub Desktop.
Simples example that how to works with MooseX::Declare
use MooseX::Declare;
class People{
# class attributes
has 'name' => ( is => 'rw', isa => 'Str' );
has 'age' => ( is => 'rw', isa => 'Num' );
# Method that speak with us
sub show {
my $self = shift;
print "Ola, me chamo ". $self->name ." e tenho ". $self->age ." anos de idade!";
}
}
package main;
my $p = People->new( name => 'Daniel Vinciguerra', age => 23 );
$p->show;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment