in reply to Archive::Tar and error handling
The warning "Something's wrong" is coming from the line
warn $tar->error unless $tar->read($device);
And indicates that whilst $tar->read( $device ) is returning false, the return value from $tar->error is undefined or null.
Whilst it may be considered "bad form" for a module to return and error, but fail to set it's error message, the module is free and if that means that the author hasn't crossed all the I's and dotted all the T's, it is still pretty good value for money:)
In this case, it probably means that the module was unable to open or read from the device. It is possible that you might get a little more information as to the cause if you were to check $! to see what, if any, system error was logged. It would be prudent to set $! = 0 before the failing call so that you aren't confused by a previous, unrelated error.
Exactly which is difficult to tell from a simple visual examination of the code. However, you have the code and the device. Maybe it time to learn to perl -d and step through the code until you can see where the error is being returned without an error message having been set. When you work out where the failure to set an error message is occuring, you can a) fix that ommission in your copy, b) send a suggestion to the author that he amends the module in a similar way.
The authors recommendation that you leave warnings enabled is only that, a recommendation. If you wish to handle the errors yourself internally, then set $Archive::Tar::WARN = 0;, the author won't hold it against you:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Archive::Tar and error handling
by Anonymous Monk on Oct 25, 2003 at 20:53 UTC |