Documentation for method curupdir assembled from the following pages:

Class: IO::Spec::Unix §

From IO::Spec::Unix

(IO::Spec::Unix) method curupdir §

Defined as:

method curupdir()

Returns a Block taking an argument. This block returns True if its argument is neither the string representing the current directory nor the string representing the directory one up from the current one. It returns False otherwise. This block is intended to be used with smartmatching.

say $*SPEC.curupdir;
# OUTPUT: «-> str $dir { #`(Block|65335808) ... }␤» 
 
my @dirs = <. foo .. bar>;
say @dirs.grep: { $_ ~~ $*SPEC.curupdir };
# OUTPUT: «(foo bar)␤» 

Neither foo nor bar are equal to the representation of the current or parent directory, that is why they are returned by grep.

Note: Before Rakudo version 2020.06 a none Junction was returned instead of a Block.