Commit | Line | Data |
2b56fd3b |
1 | #!/usr/local/bin/perl -w |
2 | |
3 | use strict ; |
4 | use Test::More ; |
5 | use File::Slurp ; |
6 | |
7 | plan tests => 2 ; |
8 | |
9 | my $file = "perms.$$" ; |
10 | |
11 | my $text = <<END ; |
12 | This is a bit of contents |
13 | to store in a file. |
14 | END |
15 | |
16 | umask 027 ; |
17 | |
18 | write_file( $file, $text ) ; |
19 | is( getmode( $file ), 0640, 'default perms works' ) ; |
20 | unlink $file ; |
21 | |
22 | write_file( $file, { perms => 0777 }, $text ) ; |
23 | is( getmode( $file ), 0750, 'set perms works' ) ; |
24 | unlink $file ; |
25 | |
26 | exit ; |
27 | |
28 | sub getmode { |
29 | return 07777 & (stat $_[0])[2] ; |
30 | } |