The first error means that these are redundant:
has 'name' => ( is => 'rw', writer => 'set_name', reader => 'get_name', ); has 'email', is => 'rw'; sub set_name { my ($self, $name) = @_; $self->name = $name; } sub get_name { my $self = shift; return $self->name; }
Moose happily generates those methods for you. Let it.
That leaves:
Cannot delegate set_name to set_name because the value of author is not defined...
... which means that when you create your Post object and call $post->set_name( ... ), if $post contains no author, you get an error message to that effect. Pass in an author or create one (with a builder perhaps).
Improve your skills with Modern Perl: the free book.
In reply to Re: Moose delegate methods, value not defined
by chromatic
in thread Moose delegate methods, value not defined
by monktopher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |