[jifty-devel] Playing with the class loader

Chia-liang Kao clkao at bestpractical.com
Tue Feb 26 23:59:50 EST 2008


This is quite neat.  I only skimmed the module a bit.  any reason the 
::declare modules isn't using object::declare?

A bit related to this particular abstraction, I was thinking the 
classloader should mostly only inject 'use base' and some very short subs:

   requiring 'Some::**::Class' => generates { qq{
       sub print_my_middle_names { print $1,"\n" }
   } };

can be:

   requiring 'Some::**::Class' =>
     base is 'YourBase',
     method print_my_middle_name => sub { ... },
     more_code is { qq{sub still_able_to_declare() { } } };

This also avoids string evals and gets us more compile time check.

should really be

> I got back around to playing with this and wanted to post this to the 
> list for others to try out before I made any commits. This has the 
> opportunity to be a fairly horrendous breakage of Jifty if I've screwed 
> it up. It passes tests for me on the latest trunk.
> 
> Attached you should find a patch that will convert the existing 
> Jifty::ClassLoader to use Class::AutoGenerate, which provides a 
> declarative DSL for code generation that is somewhat similar to 
> Template::Declare. It requires Class::AutoGenerate 0.05 which was only 
> recently uploaded to CPAN, but you can fetch from the PAUSE server or 
> directly from Subversion:
> 
> http://svn.contentment.org/svn/trunk/Class-AutoGenerate
> 
> Cheers,
> Andrew
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel



More information about the jifty-devel mailing list