Hello Dancers,
What's the recommended procedure for converting a plugin that may import an unspecified number of keywords into the app? I use Dancer2::Plugin::LogContextual, which imports a set of keywords via use Log::Contextual ':log' and redefines $SIG{__WARN__} for the application by adding an around method modifier to to_app. I'm unsure of the best way to handle this with the new plugin system (I am not the plugin author).
A sample of the plugin code:
around to_app => sub {
my ( $attr, $self, @args ) = @_;
my $app = $self->$attr( @args );
return sub {
local $SIG{__WARN__} = sub {
my @args = @_;
log_warn { @args };
};
return $app->( @_ );
};
};