Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Moose Attribute

  • attribute
use strict;
use warnings;
use v5.10;

use Person;

my $teacher = Person->new;

$teacher->name('Foo');

say $teacher->name;

package Person;
use Moose;

has 'name' => (is => 'rw');

1;

use strict;
use warnings;
use v5.10;

use Person;

my $teacher = Person->new( name => 'Foo' );

say $teacher->name;