17 return (((stat($filename))[2]) & 07777);
20 sub test_if_chmod_is_working
22 my $test_dir = File
::Spec
->catdir(
23 File
::Spec
->curdir(), "testdir", "chtest"
26 my $test_file = File
::Spec
->catfile($test_dir, "test.file");
28 mkdir($test_dir, 0755);
30 open my $out, ">$test_file";
31 print {$out} "Foobar.";
37 chmod ($perm, $test_file);
39 return (get_perm
($test_file) == $perm);
42 my $verdict = $test_perm->(0444) && $test_perm->(0666);
50 if (!test_if_chmod_is_working
())
52 plan skip_all
=> "chmod() is not working on this machine.";
59 my $zip = Archive
::Zip
->new();
61 $zip->read(File
::Spec
->catfile(File
::Spec
->curdir(), "t", "data", "chmod.zip"));
65 File
::Spec
->curdir(), "testdir", "chtest"
68 mkdir($test_dir, 0777);
70 my $test_file = File
::Spec
->catfile($test_dir, "test_file");
72 $zip->memberNamed("test_dir/test_file")->extractToFileNamed($test_file);
75 is
(get_perm
($test_file),
77 "File permission is OK."