Static::Simple 0.06 (Re: [Catalyst] Sessions, Auth::CDBI, and static files)

Thomas L. Shinnick tshinnic at io.com
Mon Sep 5 23:44:28 CEST 2005


At 14:42 9/5/2005, Andy Grundman wrote:
>Andy Grundman wrote:
>>Thomas L. Shinnick wrote:
>>
>>>So, is it an unavoidable consequence of having plugins perform real work in prepare_* steps, that every action and every request is going to have all the overhead of all the plugins installed?
>>
>>It might be possible to move up the file checking from dispatch() into an earlier prepare stage, I'll play around with this and see what works.
>
>Static::Simple 0.06 (just released) moves the checking into prepare_action, so you can bypass other plugins which also use prepare_action by listing Static::Simple before your other plugins in your setup() line or use Catalyst line.
>
>This may not work for all plugins, since some probably use other prepare methods to do their work.  Let me know how it works for you.
>
>http://pause.perl.org/incoming/Catalyst-Plugin-Static-Simple-0.06.tar.gz
>
>-Andy

Works a peach!  Using
    use Catalyst qw{ 
            -Debug 
             Static::Simple
             Session::FastMmap 
             Authentication::CDBI 
        };
I no longer see the session setup messages.  Changing it to:
    use Catalyst qw{ 
            -Debug 
             Session::FastMmap 
             Authentication::CDBI 
             Static::Simple
        };
brings the messages back.
  [Mon Sep  5 16:29:52 2005] [catalyst] [d] Found sessionid "7b6523f87b4934ca96fb87c341b43f39" in cookie
  [Mon Sep  5 16:29:52 2005] [catalyst] [d] Retrieved session '7b6523f87b4934ca96fb87c341b43f39'
  [Mon Sep  5 16:29:52 2005] [catalyst] [d] "GET" request for "static/effects.js" from 127.0.0.1
  [Mon Sep  5 16:29:52 2005] [catalyst] [d] Static::Simple: Serving C:\...\Widget\trunk\root/static/effects.js as application/x-javascript

I see in your code that prepare_action decides whether to simply return having found a static file, or returns having done the $c->NEXT::prepare_action(@_) call.  I wonder if this is not worthy of a note on the Wiki? 

Thanks again! 
Tom  (shenme on irc #catalyst)





More information about the Catalyst mailing list