summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opcode.h2
-rwxr-xr-xopcode.pl2
-rw-r--r--pod/perlfunc.pod5
-rw-r--r--t/op/cproto.t2
-rwxr-xr-xt/op/mkdir.t22
5 files changed, 27 insertions, 6 deletions
diff --git a/opcode.h b/opcode.h
index 8e52cf6f6c..8161c70443 100644
--- a/opcode.h
+++ b/opcode.h
@@ -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 */
diff --git a/opcode.pl b/opcode.pl
index ac9499d5d7..cef6e0ca60 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -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);
+}