Mailing List Archive

New stable and development versions on CPAN
Today we released v5.90053, the latest stable Catalyst.  This release fixes a regression caused by the previous release that in some cases would cause trouble installing plugins that need access to the logger.

We also clarified how log configuration interacts with the general phases of Catalyst setup and added some documentation and workarounds in Catalyst::Delta for people that are trying to use the ConfigLoader plugin to configure a custom logger differently based on %ENV.

There's a lot of weirdness in how the ConfigLoader plugin works, and it causes a lot of hair pulling since it is a plugin and gets installed during the 'setup_plugins' phase.  There's a couple of options, ranging from 'doing something else' to hacking a special case where if this plugin is seen it gets installed ASAP.  Thoughts and discussion welcomed.

Since this fixes a regression I consider it a required update.  At some point we will remove 5.90052 from CPAN since its broken.

As a result, we've also released the next development version of Catalyst, 5.90059_002 which contains the regression fix (the 001 release has the regression).  This way people that want to test the development revisions of Catalyst can do so without having trouble with that regression.  This new development revision of Runner contains deeper changes to how the we connect Catalyst to PSGI, here's the full change log:

5.90059_002 - 2013-12-21
  - We now pass a scalar or filehandle directly to you Plack handler, rather
    than always use the streaming interface (we are still always using a
    delayed response callback).  This means that you can make use of Plack
    middleware like Plack::Middleware::XSendfile and we expect better use of
    server features (when they exist) like correct use of chunked encoding or
    properly non blocking streaming when running under a supporting server like
    Twiggy.  See Catalyst::Delta for more.  This change might cause issues if
    you are making heaving use of streaming (although in general we expect things
    to work much better.
  - In the case when we remove a content body from the response because you set
    an information status or a no content type status, warn that we are doing so
    when in debug mode.  You might see additional debugging information to help
    you find and remove unneeded response bodies.
  - Updated the code where Catalyst tries to guess a content length when you
    fail to provide one.  This should cause less issues when trying to guess the
    length of a funky filehandle.  This now uses Plack::Middleware::ContentLength
  - Removed custom code to remove body content when the request is HEAD and
    swapped it for Plack::Middleware::Head
  - Merged fix for regressions from stable..

So in addition to those deeper changes to better support streaming cases, we are starting to migrate custom Catalyst code to available Plack::Middleware.  Right now that middleware is basically hard coded into the application, but we expect later releases to offer more control (perhaps something similar to the Rails MiddlewareStack).  

On thing that has come up is ambiguity about the case when an application is calling $response->write to custom stream a response, but later sets a $response->body anyway.  Right now we allow this but it would greatly simplify the code if we didn't (and right now its somewhat incorrect, in that we are forced to let Catalyst stream any file handles sent to the body.)  If anyone is using $res->write and needs to set the ->body later please let me know.  I see some use cases for this but not many :)

Both new stable and new development should be on CPAN by the time you see this!

jnap

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: New stable and development versions on CPAN [ In reply to ]
On 23/12/2013 3:40 AM, John Napiorkowski wrote:
> There's a lot of weirdness in how the ConfigLoader plugin works, and it causes a lot of hair pulling since it is a plugin and gets installed during the 'setup_plugins' phase. There's a couple of options, ranging from 'doing something else' to hacking a special case where if this plugin is seen it gets installed ASAP. Thoughts and discussion welcomed.
The approach I've favored for a while is remove ConfigLoader and setup
config via a custom class. Also allows loading config external of
Catalyst. Like so:

__PACKAGE__->config(
name => 'MyApp::FunnyIO::Web',
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
enable_catalyst_header => 1, # Send X-Catalyst header
%{ MyApp::FunnyIO::Config->config || {} }
);

Also just as a matter of current taste, I tend to inject "log" into the
$app instance from new:

builder {

my $app = MyApp::FunnyIO::Web->new;

$app->log(
Log::Log4perl::Catalyst->new(
$app->config->{log}, autoflush => 1
)
);

$app->apply_default_middlewares( $app->psgi_app );

};



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: New stable and development versions on CPAN [ In reply to ]
On Sunday, December 22, 2013 10:58 PM, neil.lunn <neil@mylunn.id.au> wrote:
On 23/12/2013 3:40 AM, John Napiorkowski wrote:
> There's a lot of weirdness in how the ConfigLoader plugin works, and it causes a lot of hair pulling since it is a plugin and gets installed during the 'setup_plugins' phase.  There's a couple of options, ranging from 'doing something else' to hacking a special case where if this plugin is seen it gets installed ASAP.  Thoughts and discussion welcomed.
The approach I've favored for a while is remove ConfigLoader and setup
config via a custom class. Also allows loading config external of
Catalyst. Like so:

__PACKAGE__->config(
   name => 'MyApp::FunnyIO::Web',
   # Disable deprecated behavior needed by old applications
   disable_component_resolution_regex_fallback => 1,
   enable_catalyst_header => 1, # Send X-Catalyst header
   %{ MyApp::FunnyIO::Config->config || {} }
);

Also just as a matter of current taste, I tend to inject "log" into the
$app instance from new:

builder {

   my $app = MyApp::FunnyIO::Web->new;

   $app->log(
     Log::Log4perl::Catalyst->new(
       $app->config->{log}, autoflush => 1
     )
   );

   $app->apply_default_middlewares( $app->psgi_app );

};


---
Thanks Neil, I think a lot of people sometimes forget that the Catalyst object is really in the end just a class.  --jnap

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com



_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: New stable and development versions on CPAN [ In reply to ]
On 24/12/2013 1:20 AM, John Napiorkowski wrote:
> ---
> Thanks Neil, I think a lot of people sometimes forget that the Catalyst object is really in the end just a class. --jnap
>
I tend to generally agree that a lot of "Catalyst::Plugin::*" stuff is a
"giant bag of Blue meth" that we all need to ween ourselves off of.
Config structures and logging implementation are always best
"externalized" along with general Domain logic with any application. By
"externalized" I mean, outside the "framework" in a manner that they
just work when implemented by themselves, without the "framework's" help.

At the risk of entering into a rant, I prefer a class factory approach
to applying "Roles/mixins" to plain classes. Something that the Java
"POJO" crowd got right.

Keen to fix up a lot of this stuff. As simply moving "::Plugin*" guff to
applied roles, Probably code cahanges and new modules in preference to
'Plugin', and Ideally having good DI on top of Catalyst. That is
sensibly consumed. It would be nice to pull in config and service
locators from something external and that was itself configuration file
aware.

BTW. Good work on the native file handle and psgi.streaming support, +If
#miyagawa will patch up Plack::Util::content_length as suggested, then
Catalyst in new release should work just the same as before but with new
improvements and performance.

Neil

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
Re: New stable and development versions on CPAN [ In reply to ]
On Monday, December 23, 2013 9:19 AM, neil.lunn <neil@mylunn.id.au> wrote:

On 24/12/2013 1:20 AM, John Napiorkowski wrote:
> ---
> Thanks Neil, I think a lot of people sometimes forget that the Catalyst object is really in the end just a class.  --jnap
>
I tend to generally agree that a lot of "Catalyst::Plugin::*" stuff is a
"giant bag of Blue meth" that we all need to ween ourselves off of.
Config structures and logging implementation are always best
"externalized" along with general Domain logic with any application. By
"externalized" I mean, outside the "framework" in a manner that they
just work when implemented by themselves, without the "framework's" help.

At the risk of entering into a rant, I prefer a class factory approach
to applying "Roles/mixins" to plain classes. Something that the Java
"POJO" crowd got right.

--
I think ideally well have something like Catalyst::Application that just
has a new method, and maybe Catalyst::Builder or similar that does the
job of instantiating the application in a given context (configuration, etc.)
SO yeah, I think we need to think carefully about the approach of extending
stuff just by slapping a role over it.  Sometimes its correct but other times
it just causes confusion.  Moving more stuff into middleware is a goal for 
Runner and hopefully that will start to reduce the overall code bulk and let
use figure out the cleanest refactoring approach that doesn't kill backcompat

---


Keen to fix up a lot of this stuff. As simply moving "::Plugin*" guff to
applied roles, Probably code cahanges and new modules in preference to
'Plugin', and Ideally having good DI on top of Catalyst. That is
sensibly consumed. It would be nice to pull in config and service
locators from something external and that was itself configuration file
aware.

--
Regarding dependency injection, there's the long lost Bread::board branch
which I think has a lot of good stuff (and at least test cases).  I think
the approach I want to take here is to generalize what Catalyst wants from
A DI interface (probably start with just generalized what we do now, which
is like half a DI as it stands).  that way later on someone could just 
do an adaptor for the interface for BB.  I'm not currently sure that BB in
core is the correct long term approach since I am not 100% certain that Catalyst
will stay wedded to Moose (in core) over the term.  I was a big supporter of
the CataMoose project, but I also had an assumption that Perl would have core
MOP support by now to deal with some of the memory and speed issues.  Since that
looks like its now at least two years off give or take I think we should consider
alternatives if such ccan be done without breaking the bank.
--


BTW. Good work on the native file handle and psgi.streaming support, +If
#miyagawa will patch up Plack::Util::content_length as suggested, then
Catalyst in new release should work just the same as before but with new
improvements and performance.

---
We need to write a test case and a proposed patch to help him along I think :)
If someone can do that I will go and push to get it included.

--john


Neil

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com


_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/