Connector

 view release on metacpan or  search on metacpan

lib/Connector/Builtin/File/Path.pm  view on Meta::CPAN


    if (my $filemode = $self->mode()) {
        if ($filemode =~ m{\A[0-7]{4}\z}) {
            chmod (oct($filemode), $filename) || die "Unable to change mode to $filemode";
        } else {
            die "Given mode string '$filemode' is not valid";
        }
    }

    if ($gid) {
        chown ($uid, $gid, $filename) || die "Unable to chown $filename to $uid/$gid";
    }

    #FIXME - some error handling might not hurt

    return 1;
}


sub _sanitize_path {

t/01-builtin-file-path.t  view on Meta::CPAN


$conn->mode("8999");
$conn->ifexists('replace');
eval { $conn->set('testumask', 'wont see'); };
like( $EVAL_ERROR, "/Given mode string '8999' is not valid/", 'wrong umask');

$conn->mode("0640");
$conn->set('testumask', 'wont see');

SKIP: {
    skip  "skipping chown test - set CONN_PATH_USER in ENV", 1 unless ( $ENV{CONN_PATH_USER} );
    $conn->user($ENV{CONN_PATH_USER} );
    $conn->set('testuser', 'wont see');
    is ($ENV{CONN_PATH_USER}, getpwuid(( stat "t/config/testuser.txt")[4]));
}

SKIP: {
    skip  "skipping chown test - set CONN_PATH_GROUP in ENV", 1 unless ( $ENV{CONN_PATH_GROUP} );
    $conn->group($ENV{CONN_PATH_GROUP} );
    $conn->set('testuser', 'wont see');
    is ($ENV{CONN_PATH_GROUP}, getgrgid(( stat "t/config/testuser.txt")[5]));
}



( run in 3.170 seconds using v1.01-cache-2.11-cpan-71847e10f99 )