From 2783660790718bb69e0442785ea41bdddb04ae5e Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Tue, 20 Jul 2010 22:27:20 +0200 Subject: [PATCH] dir() now defaults to filtering out . and .. --- src/core/IO.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/IO.pm b/src/core/IO.pm index a40b357b5f3..b69751f942d 100644 --- a/src/core/IO.pm +++ b/src/core/IO.pm @@ -255,13 +255,13 @@ multi sub note(*@args) { $*ERR.say(@args); } -multi sub dir($path as Str) { +multi sub dir($path as Str, Mu :$test = none('.', '..')) { Q:PIR { $P0 = find_lex '$path' $P1 = new ['OS'] $P1 = $P1.'readdir'($P0) %r = '&infix:<,>'($P1 :flat) - } + }.grep($test) } multi sub chdir($path as Str) {