[Catalyst] YAML Config

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Tue Jul 24 14:43:37 GMT 2007


Oleg Pronin wrote:
> Hi.
>  
> I would like to use references to variables that have been defined in my
> yaml config.
>  
> Something like this:
>  
> var_dir: &var __path_to(var)__
>  
> log_dir: &log *var/log
> log_file: *log/file.txt
>  
> This is a feature of YAML 1.0.

Can you give a specific reference to the place in the YAML spec that
says this is allowed? I can only find statements about aliases to nodes
(i.e. what you call pure aliases). I can't see any provision for
substituting values and then adding to them. So the modules are simply
implementing the YAML spec, on my reading.

> But it seems that only *pure* aliases (*var) work only in YAML::Syck &&
> YAML::XS
> log_dir: &log *var
>  
> YAML dies with "YAML Error: Can't define both an anchor and an alias".
>  
> And it is not clear for me how to modify *var to say: (this is a syntax
> error in all parsers)
> log_dir: &log *var/log
>  
> How to use other variables' values in yaml config?

I always end up implementing $substition (a la shell or perl) in my app.
But then I hate YAML, anyway.

Cheers, Dave



More information about the Catalyst mailing list