[Catalyst] Serving "static" content from DB

Kieren Diment kieren at diment.org
Sat Jun 6 11:40:20 GMT 2009

On 06/06/2009, at 9:17 PM, Mihai Bazon wrote:

> Hi folks,
> I'm working on a simple CMS (actually started it for learning  
> Catalyst,
> but the goal is to be able to maintain a few websites with it).  Each
> page is stored in DB and it can have file attachments, also stored  
> in DB
> (content is BLOB).
> When serving an attachment, instead of always retrieving it from DB I
> want to save them in a cache directory.  So the first time a file is
> requested, it will be fetched from DB, saved in cache, then I want the
> Web server to do the job as if it were a static file.  With plain
> ModPerl, I would do it like this:
>  $r->filename($path_to_saved_file);
>  # plus some more hacks if it runs after PerlMapToStorageHandler
>  return Apache2::Const::DECLINED;

my $file = $c->path_to($something);
if (!-e $file) ) {
$c->serve_static_content($file); # part of  

or have a read of this...


More information about the Catalyst mailing list