simplify_static_dir/lib/Directory/Simplify/Instruction/CopyTimestamp.pm
Dan Church 4d4edd5e9d
Move library code to lib/
Fixes accidental inclusion of test instrumentation into the all-in-one
script.
2023-06-29 13:01:29 -05:00

33 lines
669 B
Perl

package Directory::Simplify::Instruction::CopyTimestamp;
# vi: et sts=4 sw=4 ts=4
use strict;
use warnings;
use overload '""' => 'as_string';
# :squash-remove-start:
require Directory::Simplify::Utils;
# :squash-remove-end:
sub new {
my $class = shift;
return bless {
@_,
}, $class;
}
sub run {
my $self = shift;
# preserve older time stamp
utime $self->{source}->{atime}, $self->{source}->{mtime}, $self->{target}->{name};
}
sub bytes_freed {
return 0;
}
sub as_string {
my $self = shift;
return sprintf 'touch -r %s %s', Directory::Simplify::Utils::shell_quote($self->{source}->{name}, $self->{target}->{name});
}
1;