Subject: | YAML doesn't serialize odd objects very well |
YAML.pm doesn't serialize objects other than hashes or array. Best displayed with the following script:
use YAML;
use Data::Dumper;
use FileHandle;
use URI;
use CGI;
my $d = {
fh => FileHandle->new( ">/tmp/$$" ),
uri => URI->new( "http://localhost/" ),
p => {
names => ['james','alexander','duncan'],
},
cgi => CGI->new(),
arr => MyObj::Class->new()
};
$d->{a} = $d->{p}->{names};
my $y = Store( $d );
print $y;
print Dumper( Load( $y ) );
print Dumper( $d );
$d->{fh}->close();
unlink("/tmp/$$");
package MyObj::Class;
sub new {
return bless ['one','two','three'], $_[0];
}