App-rs
view release on metacpan or search on metacpan
BEGIN {
for my $c (qw/green cyan yellow magenta red/) {
no strict 'refs';
my $f = uc substr $c, 0, 1;
*$f = sub () { [$c] };
*{$f x 2} = sub () { ['bold', $c] };
}
}
sub set {
my ($f, $m) = @_;
# chown should be called before chmod to prevent setuid, setgid bit gets reset.
chown @$m{qw/uid gid/}, $f and chmod $m->{mode} & 07777, $f and utimensat($f, $m->{mtime}) or die "$f: $!";
}
sub equiv {
my ($p, $q) = @_;
no warnings 'uninitialized';
all { $p->{$_} eq $q->{$_} } qw/mode uid gid size mtime hl sl/;
}
sub elf {
open my $fh, '<', shift or die $!;
my $b;
read($fh, $b, 4) == 4 and $b eq "\x7fELF";
( run in 0.228 second using v1.01-cache-2.11-cpan-496ff517765 )