[Catalyst] Plack::Middleware::ContentLength problem
John Napiorkowski
jjn1056 at yahoo.com
Sat Dec 21 20:47:32 GMT 2013
The current HEAD of the runner branch actually has beta code that replaces =
the existing logic for calculating content length when its not set with thi=
s Plack middleware =A0(we also replace some custom logic to remove the cont=
ent body when the request is HEAD with similar Plack middleware). =A0So thi=
s work is useful to help us shake out and improve the common middleware bit=
s.
Over the coming time I plan to move more and more custom code into middlewa=
re when it makes sense. =A0The goal is to reduce the amount of custom code =
in Catalyst and move some of the burden of maintenance onto the broader Pla=
ck community.
However I am unclear what the failing cases is this example are... =A0Is is=
possible to contrive a failing case for the content length middleware we c=
an bring to #plack / miyagawa?
I recommend anyone interested to start pulling from the HEAD of the runner =
branch if they want to play with it. =A0I want to ponder the best approach =
to using middleware for core app functionality (pondering how Rails middlew=
are stack works, and looking at PlackX::MiddlewareStack for examples.) =A0R=
ight now in HEAD the core middleware is just tacked onto the top of registe=
red_middleware. =A0Thoughts on the best way to architect this are very welc=
ome. =A0I see in the nearish future a good chuck of stuff that is in Cataly=
st.pm and related files moving into Middleware, possibly including the debu=
gging screens, errors screens, etc. =A0In Rails and Django for example all =
that stuff is in middleware to make it easier for people to pull out and ha=
ck on it.
John
On Saturday, December 21, 2013 9:38 AM, Bill Moseley <moseley at hank.org> wro=
te:
=
On Fri, Dec 20, 2013 at 8:34 PM, neil.lunn <neil at mylunn.id.au> wrote:
....
>=A0
My article today actually (http://www.catalystframework.org/calendar/2013/2=
1), even though I'm actually talking here about the above case.
>
Just a note on the Advent article.
Thanks for writing that up. =A0 It's a well-written article and clearly exp=
lains the issue I was facing and the fix you provided to me. =A0One thing I=
really like about the Advent articles is that I learn new ways to do thing=
s. =A0 For example, I wasn't aware of namespace::sweep and never thought ab=
out overriding the -X filetests. =A0 I just set the content length manually=
now in the Controller along with the body.
I'm was also very happy to see you building this into a model at the end.=
=A0 I sometimes wonder if that is not stressed enough when learning Catalys=
t. =A0 I see a lot of code written into controllers at work that should rea=
lly be models. =A0I will pass the link to the Advent article around.
In my specific situation for this problem I already had a model. =A0 The gz=
ipped files are stored on a distributed file system and I already had a mod=
el class for fetching files. =A0I just extended that to handle these gzippe=
d files. =A0 =A0But, I think your solution is a bit more elegant and, well,=
more correct because it can be used more widely.
Thanks,
_______________________________________________
List: Catalyst at 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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20131221/058fb=
f00/attachment.htm
More information about the Catalyst
mailing list