package YAML::Syck; use strict; use vars qw( @ISA @EXPORT $VERSION $Headless $SortKeys $ImplicitTyping $ImplicitUnicode $UseCode $LoadCode $DumpCode $DeparseObject ); use 5.00307; use Exporter; BEGIN { $VERSION = '0.82'; @EXPORT = qw( Dump Load DumpFile LoadFile ); @ISA = qw( Exporter ); $SortKeys = 1; local $@; eval { require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); 1; } or do { require DynaLoader; push @ISA, 'DynaLoader'; __PACKAGE__->bootstrap($VERSION); }; } sub Dump { $#_ ? join('', map { YAML::Syck::DumpYAML($_) } @_) : YAML::Syck::DumpYAML($_[0]); } sub Load { if (wantarray) { my ($rv) = YAML::Syck::LoadYAML($_[0]); @{$rv}; } else { YAML::Syck::LoadYAML($_[0]); } } sub DumpFile { my $file = shift; local *FH; open FH, "> $file" or die "Cannot write to $file: $!"; print FH Dump($_[0]); } sub LoadFile { my $file = shift; local *FH; open FH, "< $file" or die "Cannot read from $file: $!"; Load(do { local $/; }) } 1;