New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update plugins from old plugin system to new plugin system #1078

Open
xsawyerx opened this Issue Dec 26, 2015 · 89 comments

Comments

Projects
None yet
@xsawyerx
Member

xsawyerx commented Dec 26, 2015

This is a ticket to track all the plugins that do not work on the new plugin system and also which ones have been converted to pure plugin2.

Release OK or fixed/PR in repo: 61/68 ~ 90%

馃憤 Latest release OK (59/68):
plugin Plugin2 only? Release Repo
Adapter no CPAN Github
Ajax 馃憤 CPAN Github
Articulate no CPAN Github
Auth::Extensible 馃憤 CPAN Github
Auth::Extensible::Provider::Database 馃憤 CPAN Github
Auth::Extensible::Provider::DBIC 馃憤 CPAN Github
Auth::Extensible::Provider::Usergroup 馃憤 CPAN Github
Auth::HTTP::Basic::DWIW no CPAN Github
Auth::OAuth no CPAN Github
Auth::Tiny PR CPAN Github
BrowserDetect PR CPAN Github
Cache::CHI no CPAN Github
Captcha no CPAN Github
Cart 馃憤 CPAN Github
Chain no CPAN Github
ConditionalCaching no CPAN Github
Database no CPAN Github
DataTransposeValidator no CPAN Github
DBIC no CPAN Github
Deferred 馃憤 CPAN Github
ElasticSearch no CPAN Github
Email 馃憤 CPAN Github
Emailesque no CPAN GitHub : visual verification (no tests)
EncryptID 馃憤 CPAN Github
Feed no CPAN Github
Flash 馃憤 CPAN Github
Growler no CPAN Github
HTTP::Auth::Extensible 馃憤 CPAN Github
Interchange6 馃憤 CPAN Github
JWT no CPAN Github
Locale 馃憤 CPAN Github
Locale::Wolowitz no CPAN Github
LogReport no CPAN no public repo
Minify no CPAN GitHub
Multilang no CPAN Github
Negotiate no CPAN Github
OAuth2::Server no CPAN Github
PageHistory 馃憤 CPAN Github
ParamKeywords no CPAN Github
ParamTypes 馃憤 CPAN GitHub
Passphrase 馃憤 CPAN Github
Path::Class no CPAN Github
Pg no CPAN Github
ProbabilityRoute no CPAN Github : manual testing using demo
ProgressStatus no CPAN Github
Queue no CPAN Github
Queue::MongoDB no CPAN Github
reCAPTCHA no CPAN Github
Redis 馃憤 CPAN Github
Res no CPAN Github
REST no CPAN Github
RootURIFor no CPAN Github
SendAs 馃憤 (in core) CPAN Github
Shutdown no CPAN Github
Shutdown::Redis no CPAN Github
Sixpack no CPAN Github
Swagger2 no CPAN GitHub
Syntax::GetPost no CPAN Github
TemplateFlute 馃憤 CPAN Github
馃憤 Release broken but fixed in GH upstream:
plugin Release Repo
RoutePodCoverage CPAN Github
UnicodeNormalize CPAN Github
馃憥 Release broken but PR submitted:
plugin Release Repo
Auth::YARBAC CPAN Github : PR
Unknown (no tests)
plugin Release Repo
GoogleAnalytics CPAN Github repo disappeared
HTTP::Caching Github
HTTP::ConditionalRequest Github
HTTP::ContentNegotiation Github
LogContextual CPAN Github
Model Github
@SysPete

This comment has been minimized.

Member

SysPete commented Dec 28, 2015

馃憥 Passphrase: Github

t/003_default_settings.t .. Use of uninitialized value $Dancer2::Plugin::CUR_PLUGIN in string at /home/apm/git/Dancer2/lib/Dancer2/Plugin.pm line 247.
Can't find originating plugin at t/003_default_settings.t line 5.
@SysPete

This comment has been minimized.

Member

SysPete commented Dec 28, 2015

馃憥 Deferred

This plugin does:
use Dancer2::Plugin qw(:no_dsl);
which is what breaks things. If :no_dsl is removed then tests all pass. It also passes against 0.165 with this change.

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 28, 2015

馃憥 Auth::Extensible: Github
Same issue as Passphrase:

t/01-basic.t ...... Use of uninitialized value $Dancer2::Plugin::CUR_PLUGIN in string at /home/apm/git/Dancer2/lib/Dancer2/Plugin.pm line 247.
Can't find originating plugin at t/lib/TestApp.pm line 10.
@SysPete

This comment has been minimized.

Member

SysPete commented Dec 28, 2015

馃憥 Auth::OAuth: Github
PR submitted to remove 'use Dancer2' b10m/p5-Dancer2-Plugin-Auth-OAuth#7
Once patch is applied breaks in the same way as Passphrase and Auth::Extensible.

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 28, 2015

馃憥 DBIC: Github

t/04-testapp.t ........... Specific subroutines cannot be exported from plugin at t/lib/TestApp.pm line 5.

Due to this in the test:
use Dancer2::Plugin::DBIC qw(schema resultset);
Simple fix is to remove import list.

PR submitted ironcamel/Dancer2-Plugin-DBIC#13

Update:
PR merged. Awaiting new release.

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 29, 2015

馃憥 Feed: Github
Just need to remove use Dancer2. PR submitted.hobbestigrou/Dancer2-Plugin-Feed#5

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 29, 2015

馃憥 JWT: Github

Two problems here. One was solved by using plugin_setting DSL:

--- a/lib/Dancer2/Plugin/JWT.pm
+++ b/lib/Dancer2/Plugin/JWT.pm
@@ -15,7 +15,7 @@ my $config;

 sub _get_secret {
        my $dsl = shift;
-       $config = $dsl->config->{plugins}{JWT};
+       $config = plugin_setting;
        die "JWT cannot be used without a secret!" unless exists $config->{secret};
        return $config->{secret};
 }

That change is in the master branch of my fork: https://github.com/SysPete/Dancer2-Plugin-JWT

Still leaves the Use of uninitialized value $Dancer2::Plugin::CUR_PLUGIN... as in other plugins^^

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 29, 2015

馃憥 Redis: Github

use strictures 1 along with plugin_args deprecation notice causes exceptions. Removing use of plugin_args fixes all problems.

PR with fix

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 29, 2015

馃憥 REST: Github

Diff is pretty simple:

remove use Dancer2

--- a/lib/Dancer2/Plugin/REST.pm
+++ b/lib/Dancer2/Plugin/REST.pm
@@ -6,14 +6,9 @@ use warnings;

 use Carp 'croak';

-use Dancer2 0.149000_01;
 use Dancer2::Plugin;

use Class::Load qw/ try_load_class /;

-use Moo::Role;
-
-with 'Dancer2::Plugin';
-
 # [todo] - add XML support
 my $content_types = {
     json => 'application/json',

PR: PerlDancer/Dancer2-Plugin-REST#12

@yanick

This comment has been minimized.

Contributor

yanick commented Dec 29, 2015

PerlDancer/Dancer2-Plugin-REST

Using the new plugin_keyword keyword triggers a warning that using the DSL is deprecated. (see t/04_helpers.t)

https://github.com/yanick/Dancer2-Plugin-REST/compare/master...PerlDancer:d2?expand=1

Using the 'sub foo :PluginKeyword` alternative does not trigger the warning.

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented Dec 29, 2015

So we're waiting for D2P2 to be released before Dancer2::Plugin::REST gets a new release?

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented Dec 29, 2015

What @SysPete was tracking was how to make the most minimal changes to get the next version running without changing it to D2P2. Then it can be released already before D2P2 is released.

@yanick

This comment has been minimized.

Contributor

yanick commented Dec 29, 2015

On 2015-12-29 12:08 PM, Sawyer X wrote:

What @SysPete https://github.com/SysPete was tracking was how to make
the most minimal changes to get the next version running without
changing it to D2P2. Then it can be released already before D2P2 is
released.

Sure. Will release the patch in a few minutes.

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented Dec 30, 2015

@SysPete I fixed the uninitialized error!

@SysPete

This comment has been minimized.

Member

SysPete commented Dec 30, 2015

On 30/12/15 01:41, Sawyer X wrote:

@SysPete https://github.com/SysPete I fixed the uninitialized warning!


Reply to this email directly or view it on GitHub
#1078 (comment).

Excellent! Will start going back through them.

@racke

This comment has been minimized.

Member

racke commented Dec 30, 2015

Dancer2::Plugin::DBIC has been released with @SysPete's patch.

@hvoers

This comment has been minimized.

hvoers commented Dec 30, 2015

On Wed, 30 Dec 2015, Stefan Hornburg (Racke) wrote:

Dancer2::Plugin::DBIC has been released with @SysPete's patch.

... and on its way to the FreeBSD ports-tree :)

@hvoers

This comment has been minimized.

hvoers commented Dec 30, 2015

Passphrase has been released on CPAN and is on its way to FreeBSD.
Next port: Auth::Extensible

@hvoers

This comment has been minimized.

hvoers commented Dec 30, 2015

Auth::Extensible @racke Is version 0.402 the one that is D2P2 ready?

@racke

This comment has been minimized.

Member

racke commented Dec 30, 2015

On 12/30/2015 01:49 PM, Henk van Oers wrote:

Auth::Extensible @racke https://github.com/racke Is version 0.402 the one that is D2P2 ready?

It doesn't have any special patches for D2P2, so it is uncertain. I'll check that.

Regards
Racke

Perl and Dancer Development

Visit our Perl::Dancer conference 2015.
More information on https://www.perl.dance.

@racke

This comment has been minimized.

Member

racke commented Dec 30, 2015

It throws a lot of warnings:

t/01-basic.t ...... 1/? Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Please use fully qualified hook name or the method execute_plugin_hook at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Plugin DSL method 'request' is deprecated. Use '$self->app->request' instead'.
 at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (uri_for). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
Using DSL in plugins is deprecated (redirect). at /home/racke/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/Dancer2/Core/Route.pm line 137.
@shumphrey

This comment has been minimized.

Contributor

shumphrey commented Dec 30, 2015

For ProgressStatus, I have a branch that uses new style. I hadn't merged it yet but I can do that now

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented Dec 30, 2015

Throwing warnings is on purpose. It's like that so you would have to upgrade. The warnings will only be thrown if someone uses an older version of the plugin (which uses the older D2::P plugin interface) while the new D2::P interface is available.

This means that you release this version now - no warnings yet. We release a new version of Dancer2 with the new D2::P and then you have warnings until you upload a new version that uses the new interface.

That's the deprecation cycle.

Also, I pushed a fix for the last uninitialized error.

@SysPete

This comment has been minimized.

Member

SysPete commented May 19, 2016

Can anyone in @PerlDancer/core help ping plugin authors for the following plugins to get PRs merged and new releases uploaded: DBIC, Email, HTTP::Auth::Extensible, Locale, Minify, Shutdown, Swagger2?

@veryrusty

This comment has been minimized.

Member

veryrusty commented May 25, 2016

I've sent a short email to:

  • @ironcamel regarding new releases for DBIC and Email plugins
  • @dboehmer regarding the Swagger2 plugin

[ github will hopefully ping them a notification reminder too ;) /subtle ]

@ironcamel

This comment has been minimized.

ironcamel commented May 25, 2016

@veryrusty I just published the updated DBIC and Email plugins to CPAN

@veryrusty

This comment has been minimized.

Member

veryrusty commented May 25, 2016

@ironcamel++ Thanks! 馃懐

@racke

This comment has been minimized.

Member

racke commented May 26, 2016

@ironcamel Thanks for moving forward!

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented May 26, 2016

Emailed authors of: HTTP::Auth::Extensible, Locale, Minify, Shutdown.

@vanHoesel

This comment has been minimized.

Contributor

vanHoesel commented May 26, 2016

I will make time tonight to fix this, and also look at the other D2::P::HTTP modules that I wrote.

On May 26, 2016, at 12:07 PM, Sawyer X notifications@github.com wrote:

Emailed authors of: HTTP::Auth::Extensible, Locale, Minify, Shutdown.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #1078 (comment)

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented May 26, 2016

@vanHoesel 鉂わ笍

@vanHoesel

This comment has been minimized.

Contributor

vanHoesel commented May 26, 2016

Peter, with your changes, I run into trouble...

running make test:
t/00-load.t ................ String found where operator expected at /Volumes/Repositories/THEMA-MEDIA/Dancer2-Plugin-HTTP-Auth-Extensible/blib/lib/Dancer2/Plugin/HTTP/Auth/Extensible.pm line 73, near "plugin_keywords
'http_authenticate_user'"
(Do you need to predeclare plugin_keywords?)

Failed test 'use Dancer2::Plugin::HTTP::Auth::Extensible;'

at t/00-load.t line 6.

Tried to use 'Dancer2::Plugin::HTTP::Auth::Extensible'.

Error: syntax error at /Volumes/Repositories/THEMA-MEDIA/Dancer2-Plugin-HTTP-Auth-Extensible/blib/lib/Dancer2/Plugin/HTTP/Auth/Extensible.pm line 20, near "has default_realm鈥

Or, doing prove -Ilib:

Error: Can't locate Dancer2/Core/Types.pm in @inc (you may need to install the Dancer2::Core::Types module) (@inc contains: /Volumes/Repositories/THEMA-MEDIA/Dancer2-Plugin-HTTP-Auth-Extensible/lib /Users/tvanhoesel/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4/darwin-2level /Users/tvanhoesel/perl5/perlbrew/perls/perl-5.18.4/lib/site_perl/5.18.4 /Users/tvanhoesel/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4/darwin-2level /Users/tvanhoesel/perl5/perlbrew/perls/perl-5.18.4/lib/5.18.4) at /Volumes/Repositories/THEMA-MEDIA/Dancer2-Plugin-HTTP-Auth-Extensible/lib/Dancer2/Plugin/HTTP/Auth/Extensible.pm line 7.

$Dancer2::Core::Types::VERSION 0.166001 (just did a clean install for Dancer2::Plugin , which installs everything)

Some advice is really welcome

Theo

On May 26, 2016, at 12:56 PM, Sawyer X notifications@github.com wrote:

@vanHoesel https://github.com/vanHoesel 鉂わ笍


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #1078 (comment)

@SysPete

This comment has been minimized.

Member

SysPete commented May 27, 2016

@vanHoesel apologies - I did not make it clear in PRs...

The latest updates to your plugin will work ONLY with plugin2 which will be released as part of Dancer2 v0.200000 this weekend (assuming all goes well). For a small number of plugins (those that themselves use other plugins) it is not possible to be compatible with both current Dancer2 and also the next release.

You can test against the latest DEV release: cpanm --dev Dancer2

@vanHoesel

This comment has been minimized.

Contributor

vanHoesel commented May 27, 2016

For all who it may concern鈥

doing a (clean) install for 鈥攄ev Dancer2:

! Installing the dependencies failed: Module 'Type::Tiny' is not installed
! Bailing out the installation for Dancer2-0.166001_03.

after installing that:

[App::Basic:5341] error @2016-05-27 12:39:26> Route exception: Can't locate object method "_parse_query" via package "Dancer2::Core::Request" at /Users/tvanhoesel/.cpanm/work/1464349136.4981/Dancer2-0.166001_03/blib/lib/Dancer2/Core/Request.pm line 349. in /Users/tvanhoesel/.cpanm/work/1464349136.4981/Dancer2-0.166001_03/blib/lib/Dancer2/Core/App.pm l. 837

#   Failed test 'Successful request'
#   at t/dsl/parameters.t line 50.
# Looks like you failed 1 test of 1.

Failed test 'Query parameters'

at t/dsl/parameters.t line 51.

Looks like you failed 1 test of 7.

I will force install it, it was the ONLY failing test:

Failed 1/149 test programs. 1/1476 subtests failed.

Cheers 鈥 will continue to work on my HTTP Modules

On May 27, 2016, at 9:46 AM, Peter Mottram notifications@github.com wrote:

@vanHoesel https://github.com/vanHoesel apologies - I did not make it clear in PRs...

The latest updates to your plugin will work ONLY with plugin2 which will be released as part of Dancer2 v0.200000 this weekend (assuming all goes well). For a small number of plugins (those that themselves use other plugins) it is not possible to be compatible with both current Dancer2 and also the next release.

You can test against the latest DEV release: cpanm --dev Dancer2


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1078 (comment), or mute the thread https://github.com/notifications/unsubscribe/ADkE_j8sV35djSFPxhpficeFNqS6dPGgks5qFq94gaJpZM4G7bjc.

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented May 27, 2016

@vanHoesel I just released a new development release. Can you please try that?

@SysPete

This comment has been minimized.

Member

SysPete commented May 27, 2016

@xsawyerx Theo's most recent attempt was with latest dev. I'm testing locally to see if I can reproduce.

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented May 27, 2016

Whoops.

@SysPete

This comment has been minimized.

Member

SysPete commented May 27, 2016

This looks like Plack 1.0040 DEV since Plack::Request->_parse_query goes away in that release. @vanHoesel please confirm which version of Plack you have installed.

@veryrusty

This comment has been minimized.

Member

veryrusty commented May 27, 2016

@SysPete D2 core resolved that with #1148.

@veryrusty

This comment has been minimized.

Member

veryrusty commented May 27, 2016

Whoops! 1148 fixed the body params.. missed the query params change. ( Same fix applies there too )

@SysPete

This comment has been minimized.

Member

SysPete commented May 27, 2016

@vanHoesel new Dancer2 dev release available which fixes that issue ( @xsawyerx ++ )

@zurborg

This comment has been minimized.

zurborg commented May 29, 2016

New versions released a few minutes ago:
Dancer2::Plugin::Minify
Dancer2::Plugin::Shutdown
Dancer2::Plugin::Shutdown::Redis
hope that helps... ;-)

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented May 29, 2016

@zurborg++ !

Thank you so much.

@rleir

This comment has been minimized.

rleir commented Jun 14, 2016

How many plugin1 plugins remain? Perhaps the remaining ones could each have a (low pri) issue?

@SysPete

This comment has been minimized.

Member

SysPete commented Jun 20, 2016

Main list has a new column denoting whether or not the plugin is pure plugin2. This column can also be used to note PRs to convert to plugin2. Just thought it would be an idea to see how many we need to convert.

@xsawyerx

This comment has been minimized.

Member

xsawyerx commented Nov 6, 2016

I think we can close this ticket now. Yes? :)

@hvoers

This comment has been minimized.

hvoers commented Nov 6, 2016

Yes.

@SysPete

This comment has been minimized.

Member

SysPete commented Nov 7, 2016

I'm still using this ticket to track updates to pure Plugin2 which so far has been done for 18 out of 67 plugins. Perhaps my checklist could be moved over to the wiki.

@ialarmedalien

This comment has been minimized.

ialarmedalien commented Nov 12, 2016

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, but am unsure of the best way to handle this with the new plugin system (I'm not the plugin author).

A bit o' sample 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->( @_ );
    };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment