App-DistSync
view release on metacpan or search on metacpan
lib/App/DistSync/Util.pm view on Meta::CPAN
=head2 slurp
my $data = slurp($file, %args);
my $data = slurp($file, { %args });
slurp($file, { buffer => \my $data });
my $data = slurp($file, { binmode => ":raw:utf8" });
Reads file $filename into a scalar
my $data = slurp($file, { binmode => ":unix" });
Reads file in fast, unbuffered, raw mode
my $data = slurp($file, { binmode => ":unix:encoding(UTF-8)" });
Reads file with UTF-8 encoding
By default it returns this scalar. Can optionally take these named arguments:
=over 4
=item binmode
Set the layers to read the file with. The default will be something sensible on your platform
lib/App/DistSync/Util.pm view on Meta::CPAN
mtime => (stat($_))[9] || 0,
size => (-s $_) || 0,
dir => $fdir,
path => $path,
file => File::Spec->abs2rel( $path, $fdir ),
};
};
# We have to use "$File::Find::dir/$_" in preprocess, because
# $File::Find::name is unavailable.
# Also, it's okay to use / here, because MANIFEST files use Unix-style
# paths.
find({
wanted => $wanted,
no_chdir => 1,
}, $dir);
return $found;
}
sub maniwrite {
my $file = shift;
( run in 1.776 second using v1.01-cache-2.11-cpan-64ef6c95b5d )