Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Class CPAN distribution.

Maintainer(s)' notes

I prefer that bugs & patches are filed on GitHub rather than on RT: https://github.com/kenahoo/Path-Class/issues. Thanks.

Report information
The Basics
Id: 12053
Status: resolved
Priority: 0/
Queue: Path-Class

People
Owner: Nobody in particular
Requestors: smylers [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08
Fixed in: (no value)



Subject: die in IO::Dir->next
Hello again. If $dir doesn't exist then $dir->next dies with an error message, which is reasonable. (It can't return undef, cos that would be hard to distinguish from the undef that results from all the directory entries having been returned.) But it'd be good if this behaviour was documented, so people don't have to read the source to find out what happens in such a situation. Also, using croak rather than die would be better, so that if a user sees the error message it doesn't look to be a bug in your module! I've just changed from using $dir->next and trapping failures with eval and displaying them to the user, because I feared that warnings with Path/Class/Dir.pm in them would only result in people who see the warnings thinking "buggy Cpan modules again" (and unfairly propagating a bad repuation of Cpan) rather than actually fixing the problem that we're missing a directory that's supposed to be there. I'm now using $dir->open instead, to test for failure before iterating. (The only problem with that is finding a different variable name to use for the directory handle, since I'm already using $dir for the directory object ...) Smylers
Subject: die in Path::Class::Dir->next
From: Smylers <smylers [...] cpan.org>
Ooops, so this time I remembered to include my name in the bug report but got the name of the module wrong in the Subject: line. I meant Path::Class::Dir, not IO::Dir. Apologies for my continued incompetence. Smylers
Sounds good, I'll change it to Carp::croak() and document it. For the dir handle, that's why we have $dh. =) -Ken
Done. -Ken