Hi hippo,
thank you for your fast reply. I really hoped that there is a possibility to use this kind of "method installation infrastructure" Moo must have for e.g. to implement the 'has'-declaration. With this declaration you get later an appropriate sub which you can call as method.
For an example use case. Assume you have a simple class:
package Me;
use strict;
use warnings;
use Moo;
has 'typ' => (
is => 'ro',
required => 1,
);
has 'other' => (
is => 'ro',
required => 1,
);
sub info {
my $self = shift;
return $self->new(
'typ' => 'INFO',
'other' => "@_",
);
}
The method 'info' is just a convenience constructor for the Moo generated constructor 'new'. If I like to do this for several values of 'typ' I would repeat myself. So I hoped to "create" / "generate" these methods more elegant.
Regards
McA |