X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FThingy.pm;fp=perl%2FThingy.pm;h=cf057957c8e7e415149b3d1aaef036f672b796a4;hb=1284d2e7cc4c25bb02c7f4fa7c59246de9c0027c;hp=0000000000000000000000000000000000000000;hpb=2ffd50e69be8f5e17e8ac3f8735139af7316195a;p=spider.git diff --git a/perl/Thingy.pm b/perl/Thingy.pm new file mode 100644 index 00000000..cf057957 --- /dev/null +++ b/perl/Thingy.pm @@ -0,0 +1,50 @@ +# +# Thingy handling +# +# This is the new fundamental protocol engine handler +# +# $Id$ +# +# Copyright (c) 2004 Dirk Koopman G1TLH +# + +package Thingy; + +use vars qw($VERSION $BRANCH); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); +$main::build += $VERSION; +$main::branch += $BRANCH; + + +use DXChannel; +use DXDebug; + +our @queue; + +# we expect all thingies to be subclassed +sub new +{ + my $class = shift; + my $self = {@_}; + + bless $self, $class; + return $self; +} + +# add the Thingy to the queue +sub add +{ + push @queue, shift; +} + +# dispatch Thingies to action it. +sub process +{ + my $t = pop @queue if @queue; + + $t->process if $t; +} + +1; +