change our to use vars
[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 use vars qw(@queue);
24 @queue = ();                                    # the thingy queue
25
26 # we expect all thingies to be subclassed
27 sub new
28 {
29         my $class = shift;
30         my $self = {@_};
31         
32         bless $self, $class;
33         return $self;
34 }
35
36 # add the Thingy to the queue
37 sub add
38 {
39         push @queue, shift;
40 }
41
42 # dispatch Thingies to action it.
43 sub process
44 {
45         my $t = pop @queue if @queue;
46
47         $t->process if $t;
48 }
49
50 1;
51