Subject: | LoadFile doesn't work on non-regular-files |
lib/YAML/Syck.pm contains the following definition for LoadFile:
###
sub LoadFile {
my $file = shift;
if ( _is_openhandle($file) ) {
if( -z $file ) {
die("Cannot load an empty file");
};
Load(do { local $/; <$file> });
}
else {
if(!-e $file || -z $file) {
die("'$file' is empty or non-existant");
}
open(my $fh, '<', $file) or die "Cannot read from $file: $!";
Load(do { local $/; <$fh> });
}
}
###
This makes LoadFile refuse to load anything for which -z returns true,
which is unfortunate, because -z appears to return true on things like
*STDIN (when a TTY or various other things.)
Simple test case:
$ (echo '---'; echo 'hello: world') | perl -MYAML::Syck -e 'print
Dump(LoadFile(\*STDIN))'
Perl is the standard package for Debian squeeze
Show quoted text
> This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
> (with 53 registered patches, see perl -V for more detail)