Created
December 2, 2010 13:03
-
-
Save dvinciguerra/725246 to your computer and use it in GitHub Desktop.
Simples example that how to works with MooseX::Declare
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
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