in reply to Re: Best way to track an error string in module?
in thread Best way to track an error string in module?
The AUTOLOAD needs to go too. In the past I'd keep track of indention within each function. This is tedious and often forgotten, but indented debug trace makes reading easy for me. The debug id done simliar to this and this is mostly just pseudo:/usr/bin/perl-MObject -le 'my $cIn the past, I'd keep track of my = O +bject->new("192.168.1.63"); $c->ping() or die $c->errstr();' soap:Server, invalid login/password at -e line 1. at -e line 1.
# Print Debug output sub p_debug { my $self = shift; return unless $self->{'DEBUG'}; printf "DEBUG: [%04f] %s%s\n", delta_time($last), (' ' x $indent), s +printf(shift @_, @_); return } # Th old way of tracking indent forced me to make sure I was increment +ing and decrementing when required. I was looking for a way to autom +atically increment on entry and automatically decrement on return sub ping { my $self = shift; $self->{'INDENT'}++; .... $self->{'INDENT'}--; return $result; }
echo() called ping() first, ping() logged in, and then echo() returned back to caller./usr/bin/perl-MObject -le 'my $cIn the past, I'd keep track of my = O +bject->new("192.168.1.63"); $c->ping() or die $c->errstr();' DEBUG: 0.0033 Object::echo(): sending data to soap server to be echoed + back. DEBUG: 0.0034 Object::ping(): pinging SOAP interface. DEBUG: 0.0275 Object::login(): authenticating on service. DEBUG: 1.5343 Object::login(): token 828609a7e43e4ce22131694bed3f6a7 +1. DEBUG: 1.5346 Object::login(): authenticated. DEBUG: 2.9340 Object::ping(): SOAP interface up. DEBUG: 3.1558 Object::echo(): complete.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best way to track an error string in module?
by LanX (Saint) on Mar 04, 2021 at 21:40 UTC |