I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2005-11-23 14:04:50-08 by earl
Exception die method
I put the following sub in my code.
sub check_object_type { my ($object, $expected_type) = @_; unless(Object::InsideOut::is_it($object, $expected_type)) { my actual_type = ref($object); OIO::Args-> die('message' => q/Bad parameter: Wrong type/, 'Usage' => "Expected an object or ref of type \"$expected_type\", ". "but saw an object or ref of type \"actual_type\""); } }

I want die to report the line of the caller's caller, not the caller.The body of this sub use to occur several times in my code. So, I decided to make this sub and the replace the redundant segments with a sub call. However, I don't want the reported line to change.

If I was using Carp, I suspect I would have to do a "local Carp::CarpLevel = 1;" before the Carp call. I was having difficult solving this problem, because I couldn't find the die method declaration in Exception::Class or Object::InsideOut.
Direct Responses: 1392 | Write a response