in reply to get the "last part" of a Path::Class object

It's absurd that these two classes don't have a method with the same name for this common operation. The obvious solution is patching Path::Class::Dir to get (pseudocode):
sub Path::Class::Dir::basename { return $self->dir_list(-1); }

Alternatively, this idiom would probably work for most cases:

file($p)->basename;