Dancer2 0.150000 - Codename LoonyPandora
Hi everyone, yesterday we released the long-awaited version 0.150000 of Dancer2. *Codename LoonyPandora:* This release is dedicated to our colleague and friend James Aitken (otherwise known as LoonyPandora) who had recently passed away, having been struck by a vehicle. James was a contributor to Dancer (both 1 and 2) since the early age of these projects. He provided insight, fixes, plugins, and was a crucial part of the community. His many contributions have made Dancer better, but his personality, charm, and warmth are at the heart of our community. We are eternally grateful for the light we received with his presence, and we will remember him kindly. Thank you, James, from all us. *Changes in this release:* It took us a while to release this version because it carries a few massive changes. These introduce some incompatibility (which we're trying to help with, and reduce using shims), but also solidifies the structure of the architecture. ** Context is removed:* The biggest change in this release is the untangling and removal of the context object of Dancer2: Dancer2::Core::Context. Contexts are useful (providing all the... well, context of a request), but the way it was implemented in Dancer2 was tricky. It was complicated, global, had state that wasn't easily removed, existed in multiple places across the code, and not just a source of pain, but also a memory leak we had only fixed when removing it. We might introduce it back again, but this time we will be able to do it much better, if need be. This change introduces a possible problem for other plugins. We will try to follow all the plugins available and help release new versions of these plugins in order to accommodate this change. Please bear with us. We will also appreciate any help to get this done as soon as possible. ** App-specific PSGI application:* Another big change is the ability to create full-fledged PSGI apps from specific Dancer Apps, instead of all the available Dancer Apps. This is an important difference to understand. When you call "start", "dance", or "Dancer2->psgi_app()", it will generate a PSGI app from all the available Dancer Apps. This means every App loaded ("use MyApp") will be part of the PSGI app we generate. However, you can now create both PSGI apps from a single Dancer App, but also from multiple Dancer Apps - which can be defined by name or regular expression: # load three Dancer Apps in memory use App1; use App2; use App3; # create a PSGI app from all of them my $psgi = dance; # or start # create a PSGI app from App3 alone: my $psgi = App3->psgi_app; # create a PSGI app from both App2 and App3: my $psgi = Dancer2->psgi_app( [ 'App2', 'App3' ] ); # create a PSGI app from both App1 and App2 using regular expressions: my $psgi = Dancer2->psgi_app( [ qr/^App(1|2)$/ ] ); This feature allows you to preload every Dancer App, without forcing a PSGI app of all of them. This is exceptionally useful in a large environment with multiple apps loaded into memory providing separate PSGI apps used by the user. ** Major memory leaks fixed:* Thanks to the context untangling and additional work by Russell Jenkins, we have removed multiple memory leaks that have been annoying us for quite some time. ** App-specific configuration:* We can now define specific configurations using a separate configuration file for each Dancer App. This involved a lot of work of untangling the configuration role. Take a look at t/config_multiapp.t test and the associated sample Dancer Apps as an example of how this works. ** Various fixes and improvements* We have also made some changes, closing additional 14 issues, and multiple fixes and enhancements which weren't covered in tickets. The following people are responsible for this release (in alphabetical order): Andrew Solomon, Andy Jack, Bas Bloemsaat, Chunzi, DavsX, Ivan Kocienski, Javier Rojas, Jean Stebens, Michał Wojciechowski, Mickey Nasriachi, Pedro Bruno, Russell Jenkins, Sawyer X, Stefan Hornburg, Steven Humphrey. Way to go, everyone! :)
On Sun, 2014-08-17 at 21:30 +0200, sawyer x wrote:
yesterday we released the long-awaited version 0.150000 of Dancer2.
Great news, thank you.
The biggest change in this release is the untangling and removal of the context object of Dancer2: Dancer2::Core::Context. ... This change introduces a possible problem for other plugins.
Given the removal, is there now a way to get params from within a plugin? Previously I was doing this: my $params = $dsl->app->context->request->params; I've tried changing to this: my $params = $dsl->app->params; But I get the error: Can't locate object method "params" via package "Dancer2::Core::App" Is there another way to retrieve params from directly within a module? For info, I'm writing (yet another) authentication plugin. I'll send details to this list once it's ready(ish). Thanks, Andy
On 08/18/2014 12:59 PM, Andrew Beverley wrote:
On Sun, 2014-08-17 at 21:30 +0200, sawyer x wrote:
yesterday we released the long-awaited version 0.150000 of Dancer2.
Great news, thank you.
The biggest change in this release is the untangling and removal of the context object of Dancer2: Dancer2::Core::Context. ... This change introduces a possible problem for other plugins.
Given the removal, is there now a way to get params from within a plugin?
Previously I was doing this:
my $params = $dsl->app->context->request->params;
I've tried changing to this:
my $params = $dsl->app->params;
But I get the error: Can't locate object method "params" via package "Dancer2::Core::App"
Is there another way to retrieve params from directly within a module?
$dsl->app->request->params ?
For info, I'm writing (yet another) authentication plugin. I'll send details to this list once it's ready(ish).
Uh why (yet another) ?? Regards Racke -- Perl and Dancer Development Visit our Perl::Dancer conference 2014: http://act.perl.dance/
On Mon, 2014-08-18 at 13:10 +0200, Stefan Hornburg (Racke) wrote:
Is there another way to retrieve params from directly within a module?
$dsl->app->request->params ?
Great, thanks, that works. Now, what about writing a session value from within a plugin? $dsl->app->session('user_id', 5); gives "session is a read-only accessor"
For info, I'm writing (yet another) authentication plugin. I'll send details to this list once it's ready(ish).
Uh why (yet another) ??
Just because I want one that "does everything" (including password resets, storing user details etc), and can interface with DBIC. I find that I keep writing the same code over and over in different applications. I'm happy to keep it private, but I may as well release it in case anyone else has a use for it. Andy
On 08/18/2014 01:45 PM, Andrew Beverley wrote:
On Mon, 2014-08-18 at 13:10 +0200, Stefan Hornburg (Racke) wrote:
Is there another way to retrieve params from directly within a module?
$dsl->app->request->params ?
Great, thanks, that works.
Now, what about writing a session value from within a plugin?
$dsl->app->session('user_id', 5);
gives "session is a read-only accessor"
->session->write(user_id => 5);
For info, I'm writing (yet another) authentication plugin. I'll send details to this list once it's ready(ish).
Uh why (yet another) ??
Just because I want one that "does everything" (including password resets, storing user details etc), and can interface with DBIC. I find that I keep writing the same code over and over in different applications. I'm happy to keep it private, but I may as well release it in case anyone else has a use for it.
Why don't you extend Dancer2::Plugin::Auth::Extensible [1] with this very reasonable features? Less code to write and more people happy about your work. [1] https://github.com/racke/Dancer2-Plugin-Auth-Extensible (migration in progress) Regards Racke -- Perl and Dancer Development Visit our Perl::Dancer conference 2014: http://act.perl.dance/
On Mon, 2014-08-18 at 13:53 +0200, Stefan Hornburg (Racke) wrote:
Now, what about writing a session value from within a plugin?
$dsl->app->session('user_id', 5);
gives "session is a read-only accessor"
->session->write(user_id => 5);
Great, thanks, that works. Thanks for the quick replies.
Why don't you extend Dancer2::Plugin::Auth::Extensible [1] with this very reasonable features? Less code to write and more people happy about your work.
I did think about extending an existing one, but there didn't seem to be much out there to extend (for Dancer2). I looked at Auth::Tiny, and in the end I decided it would be easier to write a new one based on that. I didn't really look at the old Dancer modules as I'm using Dancer2 (although I probably should have done). But yes, that makes does sense. I've almost finished mine, which I need to use now, but I'd be keen to integrate it into Extensible in due course. Maybe I can post the details anyway, and you can advise on how easy it will be to integrate/extend. Thanks, Andy
On 08/18/2014 02:12 PM, Andrew Beverley wrote:
On Mon, 2014-08-18 at 13:53 +0200, Stefan Hornburg (Racke) wrote:
Now, what about writing a session value from within a plugin?
$dsl->app->session('user_id', 5);
gives "session is a read-only accessor"
->session->write(user_id => 5);
Great, thanks, that works. Thanks for the quick replies.
Why don't you extend Dancer2::Plugin::Auth::Extensible [1] with this very reasonable features? Less code to write and more people happy about your work.
I did think about extending an existing one, but there didn't seem to be much out there to extend (for Dancer2). I looked at Auth::Tiny, and in the end I decided it would be easier to write a new one based on that.
I didn't really look at the old Dancer modules as I'm using Dancer2 (although I probably should have done).
But yes, that makes does sense.
I've almost finished mine, which I need to use now, but I'd be keen to integrate it into Extensible in due course. Maybe I can post the details anyway, and you can advise on how easy it will be to integrate/extend.
Yeah that would be good. Please put it into Github. There are lot of ways to implement reset password / storing user details (especially to make it secure), so we can discuss it here. Thanks Racke -- Perl and Dancer Development Visit our Perl::Dancer conference 2014: http://act.perl.dance/
On Tue, 2014-08-19 at 09:26 +0200, Stefan Hornburg (Racke) wrote:
I've almost finished mine, which I need to use now, but I'd be keen to integrate it into Extensible in due course. Maybe I can post the details anyway, and you can advise on how easy it will be to integrate/extend.
Yeah that would be good. Please put it into Github. There are lot of ways to implement reset password / storing user details (especially to make it secure), so we can discuss it here.
Okay, here it is on Github. As you can see, the aim is to make things as easy as possible, and to do everything "out of the box". But that does mean in its current form that it is fairly inflexible: it will only work with a database through the DBIC plugin. I'd like to integrate this better as you suggest, and hopefully my code will give you an idea as to what I am trying to achieve. At this stage it would be useful to have some initial thoughts as to what you think is the best way ahead, or indeed to have any initial feedback (as this is my first Dancer2 module). Warning: it is all very much untested at the moment! https://github.com/abeverley/libdancer2-plugin-auth-complete-perl/ Many thanks, Andy
participants (3)
-
Andrew Beverley -
sawyer x -
Stefan Hornburg (Racke)