diff options
-rw-r--r-- | opcode.h | 2 | ||||
-rwxr-xr-x | opcode.pl | 2 | ||||
-rw-r--r-- | pod/perlfunc.pod | 5 | ||||
-rw-r--r-- | t/op/cproto.t | 2 | ||||
-rwxr-xr-x | t/op/mkdir.t | 22 |
5 files changed, 27 insertions, 6 deletions
@@ -1767,7 +1767,7 @@ EXT const U32 PL_opargs[] = { 0x0002291c, /* link */ 0x0002291c, /* symlink */ 0x0001368c, /* readlink */ - 0x0012291c, /* mkdir */ + 0x0013299c, /* mkdir */ 0x0001379c, /* rmdir */ 0x0002c814, /* open_dir */ 0x0000d600, /* readdir */ @@ -834,7 +834,7 @@ rename rename ck_fun isT@ S S link link ck_fun isT@ S S symlink symlink ck_fun isT@ S S readlink readlink ck_fun stu% S? -mkdir mkdir ck_fun isT@ S S? +mkdir mkdir ck_fun isTu@ S? S? rmdir rmdir ck_fun isTu% S? # Directory calls. diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 79ebdf9a0e..81a42c2ab3 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2687,10 +2687,13 @@ and you get list of anonymous hashes each with only 1 entry. =item mkdir FILENAME +=item mkdir + Creates the directory specified by FILENAME, with permissions specified by MASK (as modified by C<umask>). If it succeeds it returns true, otherwise it returns false and sets C<$!> (errno). -If omitted, MASK defaults to 0777. +If omitted, MASK defaults to 0777. If omitted, FILENAME defaults +to C<$_>. In general, it is better to create directories with permissive MASK, and let the user modify that with their C<umask>, than it is to supply diff --git a/t/op/cproto.t b/t/op/cproto.t index 8b6bad147c..a50a85192b 100644 --- a/t/op/cproto.t +++ b/t/op/cproto.t @@ -137,7 +137,7 @@ lstat (*) lt ($$) m undef map undef -mkdir ($;$) +mkdir () msgctl ($$$) msgget ($$) msgrcv ($$$$$) diff --git a/t/op/mkdir.t b/t/op/mkdir.t index 6198000642..65a7d3a4ed 100755 --- a/t/op/mkdir.t +++ b/t/op/mkdir.t @@ -1,4 +1,4 @@ -#!./perl +#!./perl -w BEGIN { chdir 't' if -d 't'; @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 13; +plan tests => 22; use File::Path; rmtree('blurfl'); @@ -34,3 +34,21 @@ SKIP: { ok(rmdir('blurfl///')); ok(!-d 'blurfl'); } + +# test default argument + +$_ = 'blurfl'; +ok(mkdir); +ok(-d); +ok(rmdir); +ok(!-d); +$_ = 'lfrulb'; + +{ + my $_ = 'blurfl'; + ok(mkdir); + ok(-d); + ok(-d 'blurfl'); + ok(!-d 'lfrulb'); + ok(rmdir); +} |