in reply to OO design: abstract class or can()?

I like having a contract so I'd mix the method in through the magic of multiple inheritance.
package Base; sub new { bless \my($scalar), shift } package Optional; use Carp qw(croak); sub optional_method { croak q{You said you would implement optional_method and didn't!}; } package A; use base qw(Base); # No optional_method. package B; use base qw(Base Optional); # Must implement optional_method. sub optional_method { 'Woot!' }
You get ->can('optional_method') now but you also have your code croak if the contract isn't met. Or you can put shared code in the super Optional::optional_method. Your choice.