To appease PErl::Critic I have to replace die with croak and I want to be sure that what I'm doing in the object is the best way to it and maintain the simplicity of the application. In the code below, I've calledping() without logging in so it will login for me. The auth tokens timeout so ping() will re-login if a token has timed out due to inactivity.
/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.
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:
# 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; }
/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.
echo() called ping() first, ping() logged in, and then echo() returned back to caller.

In reply to Re^2: Best way to track an error string in module? by linxdev
in thread Best way to track an error string in module? by linxdev

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.