download K4UTE.pm
Language: Perl
LOC: 122
Project Info
DXSpider DX Cluster System(dxspider)
Server: SourceForge
Type: cvs
...pider\dxspider\spider\perl\
   AGWConnect.pm
   AGWMsg.pm
   AnnTalk.pm
   BadWords.pm
   Bands.pm
   BBS.pm
   Buck.pm
   call.pl
   callbot.pl
   Chain.pm
   cluster.pl
   CmdAlias.pm
   connect.pl
   console.pl
   Console.pm
   convert_users.pl
   convkeps.pl
   create_prefix.pl
   create_qsl.pl
   create_sysop.pl
   create_usdb.pl
   DB0SDX.pm
   DXBearing.pm
   dxcc.pl
   DXChannel.pm
   DXCommandmode.pm
   DXConnect.pm
   DXCron.pm
   DXDb.pm
   DXDebug.pm
   DXDupe.pm
   DXHash.pm
   DXLog.pm
   DXLogPrint.pm
   DXM.pm
   DXMsg.pm
   dxoldtonew.pl
   DXProt.pm
   DXProtout.pm
   DXProtVars.pm
   DXSql.pm
   DXUser.pm
   DXUtil.pm
   DXVars.pm.issue
   DXXml.pm
   Editable.pm
   export_opernam.pl
   ExtMsg.pm
   Filter.pm
   ForkingServer.pm
   gen_usdb_data.pl
   Geomag.pm
   hlptohtml.pl
   importkeps.pl
   importwwv.pl
   Internet.pm
   IntMsg.pm
   Investigate.pm
   IsoTime.pm
   Julian.pm
   K4UTE.pm
   Keps.pm
   Listeners.pm
   Local.pm
   lock_nodes.pl
   log2csv.pl
   LRU.pm
   Minimuf.pm
   MiscLog.pm
   Mrtg.pm
   Msg.pm
   PC.pm
   Prefix.pm
   process_ursa.pl
   Prot.pm
   proto.html
   QRZ.pm
   QSL.pm
   RingBuf.pm
   Route.pm
   RouteDB.pm
   Script.pm
   Spot.pm
   spot2csv.pl
   Sun.pm
   talias.pl
   Thingy.pm
   Timer.pm
   UDPMsg.pm
   update_sysop.pl
   USDB.pm
   VE7CC.pm
   Verify.pm
   WCY.pm
   winclient.pl
   y2k.sh

#!/usr/bin/perl -w

package K4UTE;

use HTML::Parser;
use Data::Dumper;

@ISA = qw( HTML::Parser );

use strict;

use vars qw($VERSION $BRANCH);
$VERSION = sprintf( "%d.%03d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/ );
$BRANCH = sprintf( "%d.%03d", q$Revision: 1.3 $ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
$main::build += $VERSION;
$main::branch += $BRANCH;

sub new
{
    my $pkg = shift;
	my $self = SUPER::new $pkg;
	$self->{list} = [];
	$self->{state} = 'pre';
    $self->{sort} = undef;
	$self->{debug} = 0;
    $self->{call} = uc shift;
	return $self;
}

sub start
{
	my ($self, $tag, $attr, $attrseq, $origtext) = @_;
	if ($self->{debug}) {
		print "$self->{state} $tag";
        if ($attr) {
			my $dd = new Data::Dumper([$attr], [qw(attr)]);
			$dd->Terse(1);
			$dd->Indent(0);
			$dd->Quotekeys(0);
			print " ", $dd->Dumpxs;
		}
		print "\n";
	}
	if ($tag eq 'tr' ) {
		if ($self->{state} eq 't1') {
			$self->state('t1r');
		} elsif ($self->{state} eq 't1r') {
			$self->state('t1d1');
		} elsif ($self->{state} eq 't2') {
			$self->state('t2r');
		} elsif ($self->{state} eq 't2r') {
			$self->state('t2d1');
		}
	} 
}

sub text
{
	my ($self, $text) = @_;
	$text =~ s/^[\s\r\n]+//g;
	$text =~ s/[\s\r\n]+$//g;
    print "$self->{state} text $text\n" if $self->{debug};	
	if (length $text) {
		if ($self->{state} eq 'pre' && $text =~ /$self->{call}/i ) {
			$self->state('t1');
			$self->{addr} = "";
			$self->{laddr} = 0;
		} elsif ($self->{state} eq 't1d1') {
			$self->{dxcall} = $text;
			$self->state('t1d2');
		} elsif ($self->{state} eq 't1d2') {
			$self->{dxmgr} = $text;
			$self->state('t1d3');
		} elsif ($self->{state} eq 't1d3') {
			$self->{dxdate} = amdate($text);
			$self->state('t1d4');
		} elsif ($self->{state} eq 't1d4') {
			push @{$self->{list}}, "$self->{dxcall}|mgr|$self->{dxmgr}|$self->{dxdate}|$text";
			$self->state('t1e');
		} elsif ($self->{state} eq 't2d1') {
			$self->{dxcall} = $text;
			$self->state('t2d2');
		} elsif ($self->{state} eq 't2d2') {
			$self->{dxaddr} = $text;
			$self->state('t2d3');
		} elsif ($self->{state} eq 't2d3') {
			$self->{dxdate} = amdate($text);
			$self->state('t2d4');
		} elsif ($self->{state} eq 't2d4') {
			push @{$self->{list}}, "$self->{dxcall}|addr|$self->{dxaddr}|$self->{dxdate}|$text";
			$self->state('t2e');
		} elsif ($self->{state} eq 't2' && $text =~ /did\s+not\s+return/i) {
			$self->state('last');
		}
	}
}

sub end
{
	my ($self, $tag, $origtext) = @_;
    print "$self->{state} /$tag\n" if $self->{debug};
	if ($self->{state} =~ /^t1/ && $tag eq 'table') {
		$self->state('t2');
	} elsif ($self->{state} =~ /^t2/ && $tag eq 'table') {
		$self->state('last');
	}
}

sub amdate
{
	my $text = shift;
	my ($m, $d, $y) = split m{/}, $text;
	$y += 1900;
	$y += 100 if $y < 1990;
	return sprintf "%02d-%s-%d", $d, (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$m-1], $y;
}

sub state
{
	my $self = shift;
	$self->{state} = shift if @_;
	return $self->{state};
}

sub debug
{
	my ($self, $val) = @_;
	$self->{debug} = $val;
}

sub answer
{
	my $self = shift;
	return @{$self->{list}};
}

1;

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us