Line 497 reads: if $dir !~~ :d { and should probably read: if $dir.IO !~~ :d { because it appears `d` can't be invoked on $dir which is of type string.