and a little later i have the following role :package GSM::Cell; use Moose; use MooseX::AttributeHelpers; with qw(GSM::Cell::Role::BcchChecks); has 'BCCH' => (is => 'rw', required => 1); has 'LAC' => (is => 'ro', required => 1); has 'CI' => (is => 'ro', required => 1); has 'ADJACENCIES' => ( metaclass => 'Collection::Hash', is => 'rw', isa => 'HashRef', default => sub {+{}}, provides => { exists => 'exists_adjacency', keys => 'adjacency_IDs', get => 'get_adjacency', set => 'add_adjacency', }, ); 1;
If i uncomment the requires qw(get_adjacency) in GSM::Cell::Role::BcchChecks i get the error GSM::Cell::Role::BcchChecks requires the method 'get_adjacency' to be implemented by 'GSM::Cell' even though the method "get_adjacency" is a valid method that is auto-provided when using MooseX::AttributeHelpers. How can i nevertheless enable such a check? I would ideally like to avoid a croak "Not a GSM::Cell" unless $self->isa('GSM::Cell') type of solution.package GSM::Cell::Role::BcchChecks; use Moose::Role; #requires qw(get_adjacency); # - error sub list_bcchs { my $self = shift; my %list = map {$_->BCCH => 1} $self , map($self->get_adjacency($_ +)->CELL , $self->adjacency_IDs); my @list = sort keys %list; @list; } 1;
In reply to Checking for required methods that were auto-generated by MooseX::AttributeHelpers by ZAmonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |