|
Hi folks,
Philosophy question for you. Is it a good idea to carp in a CPAN package? If the caller does not want this behavior, it needs to register a die handler, which can be inconvenient since the stack gets unwound.
I very much prefer Net-SSH2's "return false, then call error()" methodology, but it's not used everywhere.
In particular, I really want to do the following, but the carps inside the library get in the way:
my $ssh = Net::SSH2->new();
for my $host (@hosts) {
if ($ssh->connect($host)) {
# use connnection
}
else {
my ($code, $error_name, $error_string) = $ssh->error;
# handle bad host
}
}
If I have to do the eval{} and $SIG{__DIE__} thing, it's much more of a hassle.
Would anyone mind if I converted all the carps to the already-semi-standard:
$self->error(0, "oops");
return;
Thanks for reading,
- Mitch
|