You know how Moose automatically turns on strict
and warnings
during import? I want to extend that behavior by turning on autodie
and
You have to define a sub called import in your package, and import all the other stuff there.
An example from Modern::Perl (another policy module you might look at):
use 5.010_000;
use strict;
use warnings;
use mro ();
use feature ();
sub import {
warnings->import();
strict->import();
feature->import( ':5.10' );
mro::set_mro( scalar caller(), 'c3' );
}
Update: Sorry, didn't read the question carefully enough.
A good way to extend an existing import method is to write your own in a new package, and call Moose's import method from there. You can do that by subclassing, maybe you can even use Moose yourself for that ;-)