[ABE.pm] Reference fun
Faber J. Fedor
faber at linuxnj.com
Fri Nov 9 17:35:46 PST 2007
In some code I have, I do something like this:
use YAML::Tiny;
my $simparms;
$simparms->{name} = 'foo';
my $yaml->[0] = $simparms;
$yaml->write('myfile.yml');
and it does exactly what you would expect, which is creates a file like
--
name: foo
However, this code:
use YAML::Tiny;
use Config::IniFiles;
my $inFile = 'foo.ini' ;
my %fndVars ;
tie %fndVars, 'Config::IniFiles', ( -file => $inFile);
my $ref = \%fndVars;
my $yaml = YAML::Tiny->new;
$yaml->[0] = $ref;
$yaml->write("foo.yml");
produces a file like this:
--- {}
If I replace '$yaml->[0] = $ref;' with '$yaml->[0] = %fndVars;' I get
this:
--- 0
WTF?
And yes, there is data in %fndVars.
--
Regards,
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701
http://www.linuxnj.com
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the ABE-pm
mailing list