[Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Charlie Garrison

Good evening,

I updated heaps of modules on my dev server last night, and my 
app broke horribly. Various errors in the log, common one being:


Caught exception in engine Wrong Content-Length value: 

I reverted to a backup and updated modules in small batches. The 
error returned when updating 
Catalyst::Plugin::Session::State::URI v0.14.


The change notes indicate a couple things I probably should 
focus on:


- Fix behaviour when debug is turned on by wrapping prepare_path
  rather than prepare_action (RT#56753).
- Fix for loading the session ID with a cookie for some actions
  and Session::State::URI for others (RT#57620)

I'm guessing the error is due to the change from prepare_action 
to prepare_path but I don't know enough about the C::Engine 
internals to figure out what the real problem is. Or maybe it's 
not even a problem with C::Engine, and that's just where 
exception gets thrown.


During my testing I determined the issue happens when running 
under both myapp_server and myapp_fastcgi. (So I don't think 
it's an issue specific to C::Engine::HTTP or C::Engine::FastCGI.)


Can anyone help with the debug process from here? What should I 
try next? What other info should I provide?


Plugin list is:

__PACKAGE__-setup(qw/
ConfigLoader
AutoCRUD
Static::Simple
Params::Nested
I18N
Unicode::Encoding
Cache::HTTP

Session
Session::Store::DBIC
Session::State::Cookie
Session::State::URI

Authentication
Authorization::Roles
Authorization::ACL
RequireSSL

Cache
/);


Just using C::P::Session::State::URI v0.13 for now is fine. But 
I'd like to get this solved before pushing changes to production.


Thanks,
Charlie

--
Ꮚ Charlie Garrison   char...@garrison.com.au
♊  Garrison Computer Services  http://www.garrison.com.au

()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
〠   http://www.ietf.org/rfc/rfc1855.txt

___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Ash Berlin
On 19 Aug 2010, at 13:07, Charlie Garrison wrote:
 Good evening,
 
 I updated heaps of modules on my dev server last night, and my app broke 
 horribly. Various errors in the log, common one being:
 
Caught exception in engine Wrong Content-Length value: 


I see this error occasionally when I restart a server and the client is in the 
middle of a request and retries. Does this error happen every time? Including 
once you close the browser and using lwp-request etc.?

-ash

 
 I reverted to a backup and updated modules in small batches. The error 
 returned when updating Catalyst::Plugin::Session::State::URI v0.14.
 
 The change notes indicate a couple things I probably should focus on:
 
- Fix behaviour when debug is turned on by wrapping prepare_path
  rather than prepare_action (RT#56753).
- Fix for loading the session ID with a cookie for some actions
  and Session::State::URI for others (RT#57620)
 
 I'm guessing the error is due to the change from prepare_action to 
 prepare_path but I don't know enough about the C::Engine internals to figure 
 out what the real problem is. Or maybe it's not even a problem with 
 C::Engine, and that's just where exception gets thrown.
 
 During my testing I determined the issue happens when running under both 
 myapp_server and myapp_fastcgi. (So I don't think it's an issue specific to 
 C::Engine::HTTP or C::Engine::FastCGI.)
 
 Can anyone help with the debug process from here? What should I try next? 
 What other info should I provide?
 
 Plugin list is:
 
 __PACKAGE__-setup(qw/
ConfigLoader
AutoCRUD
Static::Simple
Params::Nested
I18N
Unicode::Encoding
Cache::HTTP
 
Session
Session::Store::DBIC
Session::State::Cookie
Session::State::URI
 
Authentication
Authorization::Roles
Authorization::ACL
RequireSSL
 
Cache
 /);
 
 
 Just using C::P::Session::State::URI v0.13 for now is fine. But I'd like to 
 get this solved before pushing changes to production.
 
 Thanks,
 Charlie




___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Charlie Garrison

Good morning,

On 19/08/10 at 1:17 PM +0100, Ash Berlin 
ash_c...@firemirror.com wrote:



   Caught exception in engine Wrong Content-Length value: 



I see this error occasionally when I restart a server and the 
client is in the middle of a request and retries. Does this 
error happen every time? Including once you close the browser 
and using lwp-request etc.?


I've tested with different clients and different servers; the 
behavior is consistent. I upgrade to C::P::Session::State::URI 
v0.14 and the problem starts. I downgrade to 
C::P::Session::State::URI v0.13 and the problem goes away.


I failed to mention in my original message; the problem 
manifests with POST requests. I'm not sure whether GET requests 
are immune, but POST requests with size 0 will always fail.


At this point I don't know whether to approach this as bug with 
C::P::Session::State::URI or with my app. Or how to determine 
which it might be. I can dive into the debugger, but I was 
hoping someone with better knowledge of Catalyst internals might 
have some ideas where I should look first.


Thanks,
Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Bryan Opfer
 I've tested with different clients and different servers; the behavior is
 consistent. I upgrade to C::P::Session::State::URI v0.14 and the problem
 starts. I downgrade to C::P::Session::State::URI v0.13 and the problem goes
 away.

 I failed to mention in my original message; the problem manifests with POST
 requests. I'm not sure whether GET requests are immune, but POST requests
 with size 0 will always fail.

I have the same exact behavior in my app after upgrading to 0.14.  So,
I don't think it is just your app.  Interestingly, if I remove param
from my config and use the mode where the session id is appended to
the URI, then things work fine.  But, if I use the session id in the
param, it breaks just like your app.

-Bryan

___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Charlie Garrison

Good morning,

On 19/08/10 at 9:12 AM -0700, Bryan Opfer b...@opfermail.com wrote:


I have the same exact behavior in my app after upgrading to 0.14.  So,
I don't think it is just your app.  Interestingly, if I remove param
from my config and use the mode where the session id is appended to
the URI, then things work fine.  But, if I use the session id in the
param, it breaks just like your app.


We're hitting the same thing then. I've just been playing with 
C::P::Session::State::URI code and found that if I change line 
323 from:


if ( my $sid = $c-request-param($param) ) {

to:

if ( my $sid = 0 ) {

then the problem goes away. So without knowing more about Cat 
internals I would conclude that calling $c-request-param 
during `prepare_path` is creating problems elsewhere. I also tried:


if ( my $sid = $c-request-parameters-{$param} ) {

And that fails as well.

I've tried following the code logic but I'm quickly getting lost 
in all the different prepare_* methods spread among Catalyst.pm 
and the different C::Engine modules.


For now I've changed C::P::Session::State::URI with `sub 
prepare_action {...]` rather than `prepare_path` and my app is 
working. Hopefully someone with some better ideas than me can 
suggest what the proper fix is.



Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Ash Berlin
On 19 Aug 2010, at 18:12, Charlie Garrison wrote:
 Good morning,
 
 On 19/08/10 at 9:12 AM -0700, Bryan Opfer b...@opfermail.com wrote:
 
 I have the same exact behavior in my app after upgrading to 0.14.  So,
 I don't think it is just your app.  Interestingly, if I remove param
 from my config and use the mode where the session id is appended to
 the URI, then things work fine.  But, if I use the session id in the
 param, it breaks just like your app.
 
 We're hitting the same thing then. I've just been playing with 
 C::P::Session::State::URI code and found that if I change line 323 from:
 
if ( my $sid = $c-request-param($param) ) {
 
 to:
 
if ( my $sid = 0 ) {
 
 then the problem goes away. So without knowing more about Cat internals I 
 would conclude that calling $c-request-param during `prepare_path` is 
 creating problems elsewhere. I also tried:
 
if ( my $sid = $c-request-parameters-{$param} ) {

Try changing parameters to query_parameters. It sounds like hitting params is 
causing it to read the body and mess things up when it comes to read the body 
again.

Also if you could see to creating a (failing) regression test this would help.



 
 And that fails as well.
 
 I've tried following the code logic but I'm quickly getting lost in all the 
 different prepare_* methods spread among Catalyst.pm and the different 
 C::Engine modules.
 
 For now I've changed C::P::Session::State::URI with `sub prepare_action 
 {...]` rather than `prepare_path` and my app is working. Hopefully someone 
 with some better ideas than me can suggest what the proper fix is.
 
 
 Charlie




___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Charlie Garrison

Good morning,

On 19/08/10 at 6:32 PM +0100, Ash Berlin 
ash_c...@firemirror.com wrote:



   if ( my $sid = $c-request-parameters-{$param} ) {


Try changing parameters to query_parameters. It sounds like 
hitting params is causing it to read the body and mess things 
up when it comes to read the body again.


Will do. And that fixes it, thanks.


Also if you could see to creating a (failing) regression test this would help.


I've been working on that. But apparently I don't know how to 
create a POST request with body parameters using Test::WWW::Mechanize::Catalyst.


I'm trying to use something like this:

 $m-post_ok(http://localhost/uri/body_param;,
   
{content_type='application/x-www-form-urlencoded',content=body_param=value},
   post request);

Any quick suggestions on what I'm doing wrong?


Charlie

--
   Ꮚ Charlie Garrison ♊ garri...@zeta.org.au

O ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

___
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: [Catalyst] App breaks after updating to Catalyst::Plugin::Session::State::URI v0.14

2010-08-19 Thread Tomas Doran


On 19 Aug 2010, at 19:32, Charlie Garrison wrote:


Good morning,

On 19/08/10 at 6:32 PM +0100, Ash Berlin ash_c...@firemirror.com  
wrote:



  if ( my $sid = $c-request-parameters-{$param} ) {


Try changing parameters to query_parameters. It sounds like hitting  
params is causing it to read the body and mess things up when it  
comes to read the body again.


Will do. And that fixes it, thanks.


Great, come grab a commit bit? :)

Also if you could see to creating a (failing) regression test this  
would help.


I've been working on that. But apparently I don't know how to create  
a POST request with body parameters using  
Test::WWW::Mechanize::Catalyst.


I'm trying to use something like this:

$m-post_ok(http://localhost/uri/body_param;,
  {content_type='application/x-www-form- 
urlencoded',content=body_param=value},

  post request);

Any quick suggestions on what I'm doing wrong?


how about -post_ok(http://localhost/uri/body_param;,  
{ body_param=value });


Cheers
t0m


___
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/


[Catalyst] Catalyst::Plugin::ConfigLoader snag [and SOLVED]

2010-08-19 Thread w...@serensoft.com
Found a snag in Catalyst::Plugin::ConfigLoader (v0.27, also looks like it
applied to 0.28) on line 186:

186:my ( $extension ) = ( $path =~ m{\.(.{1,4})$} );

We created our app via catalyst.pl QX, and all was well and good until we
started deploying versioned instances where the version number was part of
the directory name:

/QX-0.9.5/qx

The $extension on line 186 now is 5/qx which of course isn't a legal
config-type file extension. The error message is:

Unable to handle files with the extension '5/qx' at
/usr/share/perl5/Catalyst/Plugin/ConfigLoader.pm line 141.
Compilation failed in require at script/qx_server.pl line 55.

How about

186:my ( $extension ) = ( $path =~ m{\.([^./]{1,4})$} );

instead?

-- 
will trillich
I just try to make sure that the laziest thing I can do at any moment is
what I should be doing. -- matt.might.net
___
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/


[Catalyst] [Absolute Beginner] Navigation?

2010-08-19 Thread Ekki Plicht (DF4OR)
Hi,
I am just getting to learn Catalyst and have to admit that I am a bit lost. I 
have so many questions that I will probably fire off more questions in the 
near future.

Where am I today?
I have read THE BOOK, studied docs on CPAN, played around with DispatchTest 
example from THE BOOK, but nothing more.


Anyway, here goes.
I am contemplating converting a mid-sized, sucessfully operating web shop 
(written in Perl) to Catalyst. Ok, one should never change a running system, 
but I have my reasons.

My first question is - how do you tackle the problem of building a navigation 
tree? We currently have about 260 static pages multiplied by 5 languages, so 
in each language the navig tree is fairly long. 

Currently the nav tree is in 12 top sections (lets call them product groups), 
each of these product groups can have several (up to 25) sub groups, which 
themselves have the selection even further narrowed down, up to 5 levels deep.

I know that I can have zillions of possibilities with the dispatcher to take 
apart the URI and act accordingly, but first my customers must find the 
appropriate section of what they are looking for. So is there a way to get 
back from my dispatcher scheme (which does not exist yet) to a navigation 
tree? Some kind of introspection of the dispatcher which spits out a list of 
handled URIs which I can turn into a nav tree? I know that the debug output of 
the built-in server has something like this, but I am looking for something 
easier accessible.

Or do I have to write that nav tree manually, or better write a tool for that 
purpose? I have tested several CMSs (e.g. Typo3) which start out with 
designing a nav tree and then assigning pages (templates) to the entries in 
the tree. If that's the way to go, ok, just need to know.

Cheers,
Ekki

___
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/


[Catalyst] Philip Medes Opa Philip Medes

2010-08-19 Thread Philip Medes
http://vig17261.kilretynud.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: [Catalyst] Catalyst::Plugin::ConfigLoader snag [and SOLVED]

2010-08-19 Thread Tomas Doran


On 19 Aug 2010, at 22:17, w...@serensoft.com wrote:

How about

186:my ( $extension ) = ( $path =~ m{\.([^./]{1,4})$} );

instead?


Sure.

Could you write a failing test for this?

Cheers
t0m


___
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: [Catalyst] Catalyst::Plugin::ConfigLoader snag [and SOLVED]

2010-08-19 Thread w...@serensoft.com
I'm not sure. This isn't just $c-something, It'd involve running 
catalyst.pl to create a fresh MyApp with a two-character (or one-character)
name, which would then require some post-processing cleanup.

Is there a style guide for writing Catalyst tests?



On Thu, Aug 19, 2010 at 4:55 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 On 19 Aug 2010, at 22:17, w...@serensoft.com wrote:

 How about

 186:my ( $extension ) = ( $path =~ m{\.([^./]{1,4})$} );

 instead?


 Sure.

 Could you write a failing test for this?

 Cheers
 t0m


 ___
 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/




-- 
will trillich
I just try to make sure that the laziest thing I can do at any moment is
what I should be doing. -- matt.might.net
___
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: [Catalyst] Catalyst::Plugin::ConfigLoader snag [and SOLVED]

2010-08-19 Thread Tomas Doran


On 19 Aug 2010, at 23:20, w...@serensoft.com wrote:

I'm not sure. This isn't just $c-something, It'd involve running  
catalyst.pl to create a fresh MyApp with a two-character (or one- 
character) name, which would then require some post-processing  
cleanup.


I really don't think so.

You just need to call the misbehaving method (which is small) and  
observe it failing.. I decided that just mocking the methods called by  
the misbehaving method was easiest (as there were only 2 of them), ergo:


http://dev.catalystframework.org/svnweb/Catalyst/revision?rev=13507

Cheers
t0m


___
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/