[Catalyst] JSON instead of YAML?

Daniel Westermann-Clark daniel at acceleration.net
Wed Jan 25 16:41:10 CET 2006


On 2006-01-25 10:13:20 -0500, Andrew Libby wrote:
> One thing that drives me crazy about YAML is my desire to have
> variable references within my config file.  I my short reading up on
> YAML, it didn't seem to support that.

[10:38:00 dwc at fortuna ~]$ cat refs.yml
ref: &r
  key1: value1
  key2: value2
deref: *r
[10:38:14 dwc at fortuna ~]$ perl -MData::Dumper -MYAML -e 'print Dumper YAML::LoadFile("refs.yml");'
$VAR1 = {
          'ref' => {
                     'key2' => 'value2',
                     'key1' => 'value1'
                   },
          'deref' => $VAR1->{'ref'}
        };

IIRC, YAML calls them anchors and aliases.

You might also find the YAML cookbook helpful:

http://yaml4r.sourceforge.net/cookbook/

-- 
Daniel Westermann-Clark



More information about the Catalyst mailing list