--------------------------------------------------------------

I find "ab" to be very quick to type
&ab('processing...');&ab(\%whats_in_here);

use Data::Dumper;
sub ab {
    return if exists $ENV{SERVER} && $ENV{SERVER} eq 'PRODUCTION';
    my $msg=shift;
    if (ref $msg) {
        print STDERR "scriptname: " . Data::Dumper->Dumper($msg) . "\n";
    } else {
        print STDERR "scriptname: $msg\n";
    }
}

---------------------------------------------------------------

This is pretty easy to use...


use Time::HiRes qw(gettimeofday tv_interval);
our($start_time,$last_time);
sub handler {
  $start_time = $last_time = [gettimeofday];
  &timer("subname.1");
  &timer("subname.2");
  &timer("subname.2a");
}

sub timer {
    return if exists $ENV{SERVER} && $ENV{SERVER} eq 'PRODUCTION';
    my $msg=shift;
    my $new_time = [gettimeofday];
    &ab(join
':','Split',substr(tv_interval($last_time,$new_time),0,6),$msg);
    &ab(join
':','Total',substr(tv_interval($start_time,$new_time),0,6),$msg);
    $last_time = $new_time;
}

-------------------------------------------------------------------

I have these in my ~/.vimrc

:ab timtim sub timer {#{{{<CR>    return if exists $ENV{SERVER} &&
$ENV{SERVER} eq 'PRODUCTION';<CR>    my $msg=shift;<CR>    my $new_time =
[gettimeofday];<CR>    &ab(join
':','Split',substr(tv_interval($last_time,$new_time),0,6),$msg);<CR>
&ab(join
':','Total',substr(tv_interval($start_time,$new_time),0,6),$msg);<CR>
$last_time = $new_time;<CR>}<CR>#}}}<CR>

:ab abbb sub ab {#{{{<CR>    return if exists $ENV{SERVER} && $ENV{SERVER}
eq 'PRODUCTION';<CR>    my $msg=shift;<CR>    if (ref $msg) {<CR>
print STDERR "scriptname: " . Data::Dumper->Dumper($msg) . "\n";<CR>    }
else {<CR>        print STDERR "scriptname: $msg\n";<CR>
}<CR>}<CR>#}}}<CR>

The funny {{{ and }}} are for vim's foldmethod=marker


-----------------------------------------------------------------------

Yes, lwp-request for testing.

I make sure my output is XHTML, so I can use XPath to do things like [[look
up all href="" of <a>]], and try running lwp-request on them, too
(non-recursively, of course, but it's all Intranet, regardless)

-----------------------------------------------------------------------



------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.


Reply via email to