POSIX::remove() and directories
Peter Dintelmann [Wed, 22 Nov 2006 17:41:55 +0000 (18:41 +0100)]
From: "Dintelmann, Peter" <Peter.Dintelmann@Dresdner-Bank.com>
Message-ID: <3852726AFA94DE4F87E616F13F416A5F0A912F@naimucu1.ffz00k.rootdom.net>

p4raw-id: //depot/perl@29353

ext/POSIX/POSIX.pm

index a67f883..617d999 100644 (file)
@@ -421,7 +421,7 @@ sub puts {
 
 sub remove {
     usage "remove(filename)" if @_ != 1;
-    CORE::unlink($_[0]);
+    (-d $_[0]) ? CORE::rmdir($_[0]) : CORE::unlink($_[0]);
 }
 
 sub rename {