CatalystX::UriForStatic either creates a local or production URI to your static files depending on your configuration! If your differences are that simple so you just can switch the host names, CatalystX::UriForStatic is for you.
Let's pretend this is your Catalyst application while sysenv controls whether your application is a development or production instance and static_host defines the host name of your static files for production environment:
static_host => 'http://static.example.net',
sysenv => 'production',
In your templates where you point to your images etc. change the URIs to:
<% $c->uri_for_static('/static/foo.png') %>
(Note this is Mason syntax.)
On your production environment like the one above this will return http://static.example.net/static/foo.png.
Leave everything as it and add a new config file myapp_local.yaml (See Catalyst::Plugin::ConfigLoader) with the following configuration line:
Now, calling "uri_for_static" in CatalystX::UriForStatic will return something like http://localhost/static/foo.png or whatever your local host name is.
There are plenty of different ways of your specific CDN implementation like not having the same paths for both systems. While adding a folder name to the static_host configuration is not an issue, removing one from the local path is. Suggestions are very welcome, as well as patches and so on.
To install this module, run the following commands:
Copyright (C) 2011 Matthias Dietrich
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install CatalystX::UriForStatic, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.