[Catalyst] New method $c->path_to()

Sebastian Riedel sri at oook.de
Tue Oct 25 19:10:35 CEST 2005


Now that we also have $c->uri_for() in trunk, stuff like this just  
feels wrong. :)

     use YAML;

     __PACKAGE__->config( LoadFile( __PACKAGE__->config->{home} . '/ 
myapp.yml' ) );


So here is the obligatory solution.

     =item $c->path_to(@path)

     Merges C<@path> with $c->config->{home} and returns a  
L<Path::Class> object.

     For example:

         $c->path_to( 'db', 'sqlite.db' );

     =cut


Above example would now look so.

     use YAML;

     __PACKAGE__->config( LoadFile( __PACKAGE__->path_to 
('myapp.yml') ) );


--
sebastian




More information about the Catalyst mailing list