Re: [Catalyst] Minify JS/CSS and server as static files

2011-08-01 Thread Trevor Leffler
If you've a build process, that can also be a good time to create 
minified versions of css/js, pre-process templates, etc. so that 
everything is how you want it for your production environment.


--Trevor


Pavel Karoukin wrote:

Hello,

I am looking to develop feature in my project but want to check if
something already exists or there is existing pattern to implement it.

Bassically, I want in my TT templates add JS/CSS files into header. And
in production mode I want minify/aggregate 'em and save on disc so web
server could serve these minified and aggregated files directly.

How I plan to do it:

In TT layout template define array variable and all templates will be
adding there JS/CSS they need. Then in main template I will generate
code like:

link rel=stylesheet type=text/css
href=/minify/css?files=path/to/file1.css;path/to/file2.css /

/minify/css will be action of controller minify to join and minify these
files and save them in /static subfolder as single file. Then I need to
configure webserver somehow to look for this file (good question - how
to do it...) and serve it directly instead of firing catalyst action.

Few problems tho:
1) How to name files to keep track of: list of files in minified file,
their update date.
2) How to remove old files. (probably with cron?)

Any ideas will be really appreciated!

Regards,
Pavel

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


___
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] Refactoring Controllers

2011-08-01 Thread Steve

Thanks to all who responded :)
On 7/29/2011 4:40 PM, Eden Cardim wrote:

Steve == Stevest...@matsch.com  writes:

 Steve  Hi all,
 Steve  I have a question regarding controller refactoring, and whether 
subclassing

snip

If the actions aren't private,...
They are not, but perhaps they *should* be.  Which is *likely* to be 
most maintainable long-term do you think?

  you want to create a base controller to
preserve the URI paths and keep them consistent across the several
inheriting controllers. If not, move the methods into a model and use
delegation.



___
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 Model Issue

2011-08-01 Thread Alejandro Imass
On Sun, Jul 31, 2011 at 12:18 PM,  gor...@gorste.plus.com wrote:
 To better help you, please indicate:

 - Operating System of the Catalyst App

          Ubuntu 8.04.4 LTS

 - RDBMS version and host OS

          Ubuntu 8.04.4 LTS using MySql  5.0.51a-3ubuntu5.8-log
          (same box as my catalyst application)


The Perl in 8.04 is probably quite old.

 - DBD (DBI Driver)

          DBIx::Class                               0.08195
          DBIx::Class::Schema::Loader               0.07010
          DBIx::Class::Schema::Loader::DBI::mysql   0.07010
          DBIx::Class::Schema::Loader::DBI::SQLite  0.07010

 I get the same if I use sqllite or mysql so I think there is an issue with
 DBIx::Class.

DBIx::Class works on top of the plain-old DBI/DBD scheme. So when I
asked for the DBD I meant the actual DBI driver, examples:

DBD::SQLite
DBD::mysql
DBD:;Pg

Try static models like the following examples:

When working with SQLite you must generate your model clases with the
path to the DB file like so:

script/[app]_create.pl model [model name] DBIC::Schema
[app]::Schema::[model name] create=static
dbi:SQLite:dbname=data/catmodels.db

Assuming data/ exists from the root of the application

When working with MySQL try something like this:

script/[app]_create.pl model [model name] DBIC::Schema
[app]::Schema::[model name] create=static dbi:mysql:[dbname] [user]
[pass]

If you are connecting to more than one DB just use different model
names for each ;-)

If the static model generation was successful you should be able to
look inside the Schema Result classes and verify that you can actually
see the relations defined in each class with every field, type and
relationships (has_many, belongs_to etc.).

If you are unable to generate the static DBIC model try a small
program with plain-old DBI and see if you can actually connect to the
DB and have the correct privileges to extract the schema.

perldoc DBI

Cheers,

--
Alejandro Imass






 Gordon


 On Fri, Jul 29, 2011 at 12:14 PM,  gor...@gorste.plus.com wrote:
 Alejandro

 I am using the create fuction catalyst provides,  I find that is the
 best
 way of creating the model.  Does it need 'source_name'  in the classes
 that it creates.



 Hi Gordon,

 To better help you, please indicate:

 - Operating System of the Catalyst App
 - RDBMS version and host OS
 - DBD (DBI Driver)

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




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


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