{"action":"created","issue":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1010","repository_url":"https://api.github.com/repos/PerlDancer/Dancer2","labels_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1010/labels{/name}","comments_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1010/comments","events_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1010/events","html_url":"https://github.com/PerlDancer/Dancer2/pull/1010","id":108541503,"number":1010,"title":"Dancer2::Plugin2","user":{"login":"yanick","id":19954,"avatar_url":"https://avatars.githubusercontent.com/u/19954?v=3","gravatar_id":"","url":"https://api.github.com/users/yanick","html_url":"https://github.com/yanick","followers_url":"https://api.github.com/users/yanick/followers","following_url":"https://api.github.com/users/yanick/following{/other_user}","gists_url":"https://api.github.com/users/yanick/gists{/gist_id}","starred_url":"https://api.github.com/users/yanick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yanick/subscriptions","organizations_url":"https://api.github.com/users/yanick/orgs","repos_url":"https://api.github.com/users/yanick/repos","events_url":"https://api.github.com/users/yanick/events{/privacy}","received_events_url":"https://api.github.com/users/yanick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PerlDancer/Dancer2/labels/D2P2","name":"D2P2","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":114,"created_at":"2015-09-27T15:07:10Z","updated_at":"2016-03-29T14:20:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/pulls/1010","html_url":"https://github.com/PerlDancer/Dancer2/pull/1010","diff_url":"https://github.com/PerlDancer/Dancer2/pull/1010.diff","patch_url":"https://github.com/PerlDancer/Dancer2/pull/1010.patch"},"body":"yanick's prototype."},"comment":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/comments/202915231","html_url":"https://github.com/PerlDancer/Dancer2/pull/1010#issuecomment-202915231","issue_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1010","id":202915231,"user":{"login":"SysPete","id":6115812,"avatar_url":"https://avatars.githubusercontent.com/u/6115812?v=3","gravatar_id":"","url":"https://api.github.com/users/SysPete","html_url":"https://github.com/SysPete","followers_url":"https://api.github.com/users/SysPete/followers","following_url":"https://api.github.com/users/SysPete/following{/other_user}","gists_url":"https://api.github.com/users/SysPete/gists{/gist_id}","starred_url":"https://api.github.com/users/SysPete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SysPete/subscriptions","organizations_url":"https://api.github.com/users/SysPete/orgs","repos_url":"https://api.github.com/users/SysPete/repos","events_url":"https://api.github.com/users/SysPete/events{/privacy}","received_events_url":"https://api.github.com/users/SysPete/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T14:20:49Z","updated_at":"2016-03-29T14:20:49Z","body":"On 29/03/16 15:21, Yanick Champoux wrote:\n> On 2016-03-29 06:49 AM, Peter Mottram wrote:\n> > I can't work out how to get access to Dancer2::Plugin::Database DSL from\n> > Provider::Database.\n> >\n> > Suggestions?\n>\n> I was going for the obvious \"Don't, use\n> `$app->plugin('Foo')->whatever_method` instead\", but you probably are\n> trying to make it work in the transitory P1/P2 context. In which case,\n> uh, I don't know. I really don't know.\n>\n> `/.\n\nI've given up trying to make it work for p1/p2 compat and am trying to\nmake it work just for p2. Part of the problem is that the Provider\nclasses are not actually part of the plugin itself so I tried passing\nthe Dancer2::Plugin::Auth::Extensible plugin object as an attribute to\nthe Database provider's constructor then in the provider I have:\n\n```\nhas dancer2_plugin_database => (\n    is => 'ro',\n    lazy => 1,\n    default => sub {\n        $_[0]->plugin->app->with_plugin('Dancer2::Plugin::Database');\n    },\n    handles => { database => 'database' },\n);\n```\nand then in provider methods we have this:\n```\nmy $database = $self->database($settings->{db_connection_name});\n```\nand all should be cool except that we end up with these errors (which I\nremember seeing somewhere a long time ago):\n```\nRoute exception: Can't find originating plugin at (eval 296) line 17.\nUse of uninitialized value $Dancer2::Plugin::CUR_PLUGIN in string at\n/home/apm/git/Dancer2/lib/Dancer2/Plugin.pm line 247.\n```\n\nI've tried all sorts of things but I'm still stuck at this point.\n\n"}}