From: djk Date: Tue, 16 Jun 1998 10:57:31 +0000 (+0000) Subject: added Ids and changed the name of DXConnect to DXChannel X-Git-Tag: SPIDER_1_5~60 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=0017002e2dc438d49fcc090dc99b6d22f7037aa7 added Ids and changed the name of DXConnect to DXChannel --- diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm new file mode 100644 index 00000000..d4b20a2b --- /dev/null +++ b/perl/DXChannel.pm @@ -0,0 +1,65 @@ +# +# module to manage channel lists & data +# +# Copyright (c) 1998 - Dirk Koopman G1TLH +# +# $Id$ +# +package DXChannel; + +require Exporter; +@ISA = qw(Exporter); + +%connects = undef; + +# create a new connection object [$obj = Connect->new($call, $msg_conn_obj, $user_obj)] +sub new +{ + my ($pkg, $call, $conn, $user) = @_; + my $self = {}; + + die "trying to create a duplicate Connect for call $call\n" if $connects{$call}; + $self->{call} = $call; + $self->{conn} = $conn; + $self->{user} = $user; + $self->{t} = time; + $self->{state} = 0; + bless $self, $pkg; + return $connects{$call} = $self; +} + +# obtain a connection object by callsign [$obj = Connect->get($call)] +sub get +{ + my ($pkg, $call) = @_; + return $connect{$call}; +} + +# obtain all the connection objects +sub get_all +{ + my ($pkg) = @_; + return values(%connects); +} + +# obtain a connection object by searching for its connection reference +sub get_by_cnum +{ + my ($pkg, $conn) = @_; + my $self; + + foreach $self (values(%connects)) { + return $self if ($self->{conn} == $conn); + } + return undef; +} + +# get rid of a connection object [$obj->del()] +sub del +{ + my $self = shift; + delete $connects{$self->{call}}; +} + +1; +__END__; diff --git a/perl/DXConnect.pm b/perl/DXConnect.pm deleted file mode 100644 index 0d48676f..00000000 --- a/perl/DXConnect.pm +++ /dev/null @@ -1,62 +0,0 @@ -# -# module to manage connection lists & data -# - -package DXConnect; - -require Exporter; -@ISA = qw(Exporter); - -%connects = undef; - -# create a new connection object [$obj = Connect->new($call, $msg_conn_obj, $user_obj)] -sub new -{ - my ($pkg, $call, $conn, $user) = @_; - my $self = {}; - - die "trying to create a duplicate Connect for call $call\n" if $connects{$call}; - $self->{call} = $call; - $self->{conn} = $conn; - $self->{user} = $user; - $self->{t} = time; - $self->{state} = 0; - bless $self, $pkg; - return $connects{$call} = $self; -} - -# obtain a connection object by callsign [$obj = Connect->get($call)] -sub get -{ - my ($pkg, $call) = @_; - return $connect{$call}; -} - -# obtain all the connection objects -sub get_all -{ - my ($pkg) = @_; - return values(%connects); -} - -# obtain a connection object by searching for its connection reference -sub get_by_cnum -{ - my ($pkg, $conn) = @_; - my $self; - - foreach $self (values(%connects)) { - return $self if ($self->{conn} == $conn); - } - return undef; -} - -# get rid of a connection object [$obj->del()] -sub del -{ - my $self = shift; - delete $connects{$self->{call}}; -} - -1; -__END__; diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 6f7756ff..ac06615d 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -1,6 +1,10 @@ # # DX cluster user routines # +# Copyright (c) 1998 - Dirk Koopman G1TLH +# +# $Id$ +# package DXUser; diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index d7ddcf62..638a2bce 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -1,6 +1,10 @@ # # various utilities which are exported globally # +# Copyright (c) 1998 - Dirk Koopman G1TLH +# +# $Id$ +# package DXUtil; diff --git a/perl/DXVars.pm b/perl/DXVars.pm index df781429..23367a14 100644 --- a/perl/DXVars.pm +++ b/perl/DXVars.pm @@ -2,6 +2,10 @@ # The system variables - those indicated will need to be changed to suit your # circumstances (and callsign) # +# Copyright (c) 1998 - Dirk Koopman G1TLH +# +# $Id$ +# package main; diff --git a/perl/Msg.pm b/perl/Msg.pm index 7114eba8..20e00033 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -5,6 +5,9 @@ # # I have modified it to suit my devious purposes (Dirk Koopman G1TLH) # +# $Id$ +# + package Msg; require Exporter; diff --git a/perl/client.pl b/perl/client.pl index c508d942..0cdbe9c2 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -9,6 +9,7 @@ # # Copyright (c) 1998 Dirk Koopman G1TLH # +# $Id$ # use Msg; diff --git a/perl/cluster.pl b/perl/cluster.pl index c324930f..6fded241 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -9,12 +9,13 @@ # # Copyright (c) 1998 Dirk Koopman G1TLH # +# $Id$ # use Msg; use DXVars; use DXUtil; -use DXConnect; +use DXChannel; use DXUser; package main; @@ -55,7 +56,7 @@ sub disconnect sub rec { my ($conn, $msg, $err) = @_; - my $dxconn = DXConnect->get_by_cnum($conn); # get the dxconnnect object for this message + my $dxconn = DXChannel->get_by_cnum($conn); # get the dxconnnect object for this message if (defined $err && $err) { disconnect($dxconn); @@ -78,7 +79,7 @@ sub login sub cease { my $dxconn; - foreach $dxconn (DXConnect->get_all()) { + foreach $dxconn (DXChannel->get_all()) { disconnect($dxconn); } } diff --git a/perl/persistent.pl b/perl/persistent.pl index 39e993b5..23b302eb 100644 --- a/perl/persistent.pl +++ b/perl/persistent.pl @@ -1,3 +1,12 @@ +# +# This allows perl programs to call functions dynamically +# +# This has been nicked directly from the perlembed pages +# so has the perl copyright +# +# $Id$ +# + package Embed::Persistent; #persistent.pl