Don't use an abstract base class; use roles...
{ package IAmNotInYourIsa; use Moose::Role; requires 'dothis'; } { package My::CGI; use Moose; with 'IAmNotInYourIsa'; use CGI; sub dothis { ... my $q = CGI->new ... $q->param ... } } My::CGI->isa('IAmNotInYourIsa'); # false My::CGI->does('IAmNotInYourIsa'); # true!
A good example can be seen in the Ask distribution on CPAN, where there are different implementations for STDIN/STDOUT, Tk, etc, each of which include:
with 'Ask::API';
Ask uses Moo rather than Moose, but the principle is the same.
In reply to Re: Howto create a Moose baseclass/superclass/contract? Moose equivalent of Module::Pluggable? Favorite way to create base/super class?
by tobyink
in thread Howto create a Moose baseclass/superclass/contract? Moose equivalent of Module::Pluggable? Favorite way to create base/super class?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |