[Catalyst] Small patch for ConfigLoader
Brian Cassidy
brian.cassidy at nald.ca
Tue Apr 18 20:22:21 CEST 2006
Hi Andreas,
> -----Original Message-----
> > I couldnt understand why __HOME__ was only alloved in the beginning
> > of the strings, making it totaly useless for things like dbi driver
> > strings (think dbd:SQLite:__HOME/db/ape.db), so I wrote a small
> > patch to allow such constructs.
>
> its against current cpan for one, and it also kills a warning on
> empty lines (which I like to add for readability)
The latest SVN version already squashes the warnings. So, all that's left is
allowing __HOME__ anywhere in the string. After chatting with mst on IRC a
little bit, we've come up with a possible solution:
Firstly, __HOME__ should not take any params. It will simple be replaced
with the value of $c->path_to( '' );
Secondly, there will be an alternate substitution that takes arguments:
__path_to(db/ape.db)__ -- this will translate to $c->path_to( 'db', 'ape.db'
);
The code could look something like this:
my $v = Data::Visitor::Callback->new(
plain_value => sub {
return unless defined $_;
s[__HOME__][ $c->path_to( '' ) ]e;
s[__path_to\((.+)\)__][ $c->path_to( split( '/', $1 ) ) ]e;
}
);
Thoughts?
-Brian
More information about the Catalyst
mailing list