cf057957c8e7e415149b3d1aaef036f672b796a4
[spider.git] / perl / Thingy.pm
1 #
2 # Thingy handling
3 #
4 # This is the new fundamental protocol engine handler
5 #
6 # $Id$
7 #
8 # Copyright (c) 2004 Dirk Koopman G1TLH
9 #
10
11 package Thingy;
12
13 use vars qw($VERSION $BRANCH);
14 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
15 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
16 $main::build += $VERSION;
17 $main::branch += $BRANCH;
18
19
20 use DXChannel;
21 use DXDebug;
22
23 our @queue;
24
25 # we expect all thingies to be subclassed
26 sub new
27 {
28         my $class = shift;
29         my $self = {@_};
30         
31         bless $self, $class;
32         return $self;
33 }
34
35 # add the Thingy to the queue
36 sub add
37 {
38         push @queue, shift;
39 }
40
41 # dispatch Thingies to action it.
42 sub process
43 {
44         my $t = pop @queue if @queue;
45
46         $t->process if $t;
47 }
48
49 1;
50