root is a Path::Class::Dir: stringify it before dumping to metadata