[Catalyst] newbie YAML question

John Napiorkowski jjn1056 at yahoo.com
Wed Jul 12 16:01:38 CEST 2006


Hi,

Please forgive this inane question but I just can't find an answer (although this is a simple problem and I am sure it's out there someplace.

I'm trying migrate all my __PACKAGE__-->config(...) to the applications main YAML file.  This is a cleanup job but needs doing since we want all our configuration for each server in one place.  So here is my problem.  When I am trying to create the myapp.yml lines for my template toolkit views one of the options is to set the search path.  So following the example's I've seen here is what the config looked like when it was inline with the package:

package myapp::View::tt_page;

__PACKAGE__->config(

   TEMPLATE_EXTENSION => '.tt',
   COMPILE_DIR => '/tmp/template_cache',
   INCLUDE_PATH => [talentspace_portal->path_to( 'tt_templates' )],

        );

When I try to convert this to yaml I tried:

##
## Config for Views: Pages
##
'View::tt_page':
  TEMPLATE_EXTENSION: '.tt'
  COMPILE_DIR: '/tmp/template_cache'
  INCLUDE_PATH:
    - talentspace_portal2->path_to( 'tt_templates' )

I actually need to set the include path because I have several sets of views each rooted to a different directory.  However the above doesn't work.  This is because it gets parsed by YAML into:

'View::tt_page' => {
 
    TEMPLATE_EXTENSION => '.tt',
    COMPILE_DIR => '/tmp/template_cache',
    INCLUDE_PATH => ["talentspace_portal->path_to( 'tt_templates' )"],
 
         },

It's hard to notice but there are quotes around "talentspace_portal->path_to( 'tt_templates' )", so this is caused the option to have the wrong value.

I tried adding the perl tag to the yaml file but it just generated a "YAML_PARSE_ERR_SINGLE_LINE" error.

##
 ## Config for Views: Pages
 ##
 'View::tt_page':
   TEMPLATE_EXTENSION: '.tt'
   COMPILE_DIR: '/tmp/template_cache'
   INCLUDE_PATH:
     - !perl/talentspace_portal2->path_to( 'tt_templates' )

I've looked around for examples of how other people did this but I can't seem to get it right.  Any YAML experts out there that can assist?  Thanks!

  --john






More information about the Catalyst mailing list