On 01/12/2017 11:17 PM, Amelia Ireland wrote: > 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 > <https://github.com/wchristian/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->( @_ ); }; };| > > > > Any hints gratefully received. Thanks! >
Hello Amelia, you can take a look at the LogReport plugin (https://metacpan.org/pod/Dancer2::Plugin::LogReport) which also had to cope with the import taking over by Dancer2. Regards Racke -- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users