spider/perl/DXDebug.pm
djk d5b4190c36 1. fixed problem with missing DXDebug in DXProt.
2. Fixed DXDebug so that it actually works as advertised with and without
trailing \n.
3. Added deduping of WWV spots as well (at for date,time,sfi,k and i) dups
4. Replaced the 0 in "02-Dec-1998" with ' ' so it reads " 2-Dec-1998", it seems
hard to credit it but some 'programs' out there that connect to clusters have
problems with the leading '0'!
5. In the same vain, included a strictly AK1A compatible sh/heading, apparently
this is necessary for the same reason as 4.
6. Started contrib tree stored the old show/heading in contrib/g0rdi/show.
7. Because I now correctly dedupe spots and wwv (there's a hostage to fortune..)
I have added a merge command.
1998-12-21 23:49:08 +00:00

73 lines
959 B
Perl

#
# The system variables - those indicated will need to be changed to suit your
# circumstances (and callsign)
#
# Copyright (c) 1998 - Dirk Koopman G1TLH
#
# $Id$
#
package DXDebug;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(dbg dbgadd dbgsub dbglist isdbg);
@EXPORT_OK = qw(dbg dbgadd dbgsub dbglist isdbg);
use strict;
use vars qw(%dbglevel $fp);
use FileHandle;
use DXUtil;
use DXLog ();
use Carp;
%dbglevel = ();
$fp = DXLog::new('debug', 'dat', 'd');
sub dbg
{
my $l = shift;
if ($dbglevel{$l}) {
my @in = @_;
my $t = time;
for (@in) {
s/\n$//o;
s/\a//og; # beeps
print "$_\n" if defined \*STDOUT;
$fp->writeunix($t, "$t^$_");
}
}
}
sub dbgadd
{
my $entry;
foreach $entry (@_) {
$dbglevel{$entry} = 1;
}
}
sub dbgsub
{
my $entry;
foreach $entry (@_) {
delete $dbglevel{$entry};
}
}
sub dbglist
{
return keys (%dbglevel);
}
sub isdbg
{
my $s = shift;
return $dbglevel{$s};
}
1;
__END__