From 75bb1fd55773e7482197dc4cf6b1239c44ca3739 Mon Sep 17 00:00:00 2001 From: Heikki Hannikainen Date: Mon, 4 Jun 2012 14:44:02 +0000 Subject: [PATCH] IS.pm: added debug printing git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@387 3ce903b1-3385-4e86-93cd-f9a4a239f7ac --- tests/libperl/Ham/APRS/IS.pm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/libperl/Ham/APRS/IS.pm b/tests/libperl/Ham/APRS/IS.pm index 32596b9..91dac4b 100644 --- a/tests/libperl/Ham/APRS/IS.pm +++ b/tests/libperl/Ham/APRS/IS.pm @@ -14,6 +14,8 @@ our $VERSION = '0.01'; our $aprs_appid = "IS $VERSION"; +our $debug = 0; + =head1 new(hostport, mycall, optionshash) Initializes a new Ham::APRS::IS socket. Takes two mandatory arguments, @@ -282,14 +284,30 @@ sub getline_noncomment($;$) sub sendline($$) { my($self, $line) = @_; + + warn "sendline $line\n" if ($debug); + return undef if ($self->{'state'} ne 'connected'); + + warn "blocking(1)\n" if ($debug); if (!defined $self->{'sock'}->blocking(1)) { warn "sendline: blocking(1) failed: $!\n"; return undef; } + + warn "printf\n" if ($debug); + + if (!defined $self->{'sock'}) { + warn "sendline: sock not defined: $!\n"; + return undef; + } + my $ret = $self->{'sock'}->printf( "%s\r\n", $line); - if (!$self->{'sock'}->flush) { + + warn "flush\n" if ($debug); + + if (!defined $self->{'sock'}->flush) { warn "sendline: flush() failed: $!\n"; return undef; } @@ -299,7 +317,7 @@ sub sendline($$) return undef; } - #warn "sent ($ret): $line\n"; + warn "sent ($ret): $line\n" if ($debug); return $ret; }