schwern/Mite — Issue #11: discuss: is there a reason to spool rather then template? 
Author: notbenh
Created: 2012-02-29 01:14:01+00:00
State: open

So currently it seems that Mite is really just a big event driven write to file system, nice though it does lead to some issues like default being hard to manage as you really should be rewriting new all the time when has is called. It seems that this could be resolved if Mite was a code template system (for example, if it was just a big TT Wrapper) where you developer code was parsed at mite-compile time such that it just populated:

```template
package [% package_name %];
use strict;
use warnings;

sub new {
my $class = shift;
return bless {
[% FOREACH attr IN attrs.defaults.keys %]
[% attr %] => [% attrs.defaults.$attr #assumes prequoted strings %]
[% END %]
@_
}, $class;
}

[% FOREACH attr_method IN attrs.method_compiled %]
[% attr_method # much like now? %]

[% END %]

[% content %]
1;