Repository-Simple
view release on metacpan or search on metacpan
lib/Repository/Simple/Engine/FileSystem.pm view on Meta::CPAN
close $handle;
}
elsif ($basename eq 'fs:mode') {
chmod $value, $real_path
or croak qq(Failed to change "$path" to "$value": $!);
}
elsif ($basename eq 'fs:uid') {
my $gid = $self->_get_scalar($real_path, 'fs:gid');
chown $value, $gid, $real_path
or croak qq(Failed to change "$path" to "$value": $!);
}
elsif ($basename eq 'fs:gid') {
my $uid = $self->_get_scalar($real_path, 'fs:uid');
chown $uid, $value, $real_path
or croak qq(Failed to change "$path" to "$value": $!);
}
elsif ($basename eq 'fs:atime') {
my $mtime = $self->_get_scalar($real_path, 'fs:mtime');
utime $value, $mtime, $real_path
or croak qq(Failed to change "$path" to "$value": $!);
}
elsif ($basename eq 'fs:mtime') {
t/engine_file_system.t view on Meta::CPAN
# Test get_scalar() and get_handle()
my $scalar = $engine->get_scalar($property_path);
my $handle = $engine->get_handle($property_path);
is($scalar, join '', <$handle>);
}
# Test path_exists() on a non-existent property
ok(!$engine->path_exists($path_slash.'fs:notta'), '!path_exists property');
# Test chown/chgrp if we are root
SKIP: {
skip 'Cannot test uid changes unless tested as root', 4
unless $< == 0;
# Test chown
my $fs_uid = $path_slash.'fs:uid';
my $old_uid = $engine->get_scalar($fs_uid);
$engine->set_scalar($fs_uid, 1);
$engine->save_property($fs_uid);
is($engine->get_scalar($fs_uid), 1);
$engine->set_scalar($fs_uid, $old_uid);
$engine->save_property($fs_uid);
is($engine->get_scalar($fs_uid), $old_uid);
# Test chgrp
( run in 0.846 second using v1.01-cache-2.11-cpan-5511b514fd6 )