projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change DXChannel::get_all_ak1a to get_all_nodes
[spider.git]
/
perl
/
DXChannel.pm
diff --git
a/perl/DXChannel.pm
b/perl/DXChannel.pm
index 8b71dbff499d7946a83378b2938f6c54f6ea41c4..17f34919e7eb970f4eef85a2cc893e3dd95469d2 100644
(file)
--- a/
perl/DXChannel.pm
+++ b/
perl/DXChannel.pm
@@
-87,6
+87,7
@@
use vars qw(%channels %valid);
pingave => '0,Ping ave time',
logininfo => '9,Login info req,yesno',
talklist => '0,Talk List,parray',
pingave => '0,Ping ave time',
logininfo => '9,Login info req,yesno',
talklist => '0,Talk List,parray',
+ node => '5,Node data',
);
# object destruction
);
# object destruction
@@
-106,6
+107,7
@@
sub DESTROY
undef $self->{inwwvfilter};
undef $self->{inspotfilter};
undef $self->{passwd};
undef $self->{inwwvfilter};
undef $self->{inspotfilter};
undef $self->{passwd};
+ undef $self->{node};
}
# create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)]
}
# create a new channel object [$obj = DXChannel->new($call, $msg_conn_obj, $user_obj)]
@@
-158,12
+160,11
@@
sub get_all
#
# gimme all the ak1a nodes
#
#
# gimme all the ak1a nodes
#
-sub get_all_
ak1a
+sub get_all_
nodes
{
{
- my @list = DXChannel->get_all();
my $ref;
my @out;
my $ref;
my @out;
- foreach $ref (
@list
) {
+ foreach $ref (
values %channels
) {
push @out, $ref if $ref->is_node;
}
return @out;
push @out, $ref if $ref->is_node;
}
return @out;
@@
-172,10
+173,9
@@
sub get_all_ak1a
# return a list of all users
sub get_all_users
{
# return a list of all users
sub get_all_users
{
- my @list = DXChannel->get_all();
my $ref;
my @out;
my $ref;
my @out;
- foreach $ref (
@list
) {
+ foreach $ref (
values %channels
) {
push @out, $ref if $ref->is_user;
}
return @out;
push @out, $ref if $ref->is_user;
}
return @out;
@@
-184,11
+184,10
@@
sub get_all_users
# return a list of all user callsigns
sub get_all_user_calls
{
# return a list of all user callsigns
sub get_all_user_calls
{
- my @list = DXChannel->get_all();
my $ref;
my @out;
my $ref;
my @out;
- foreach $ref (
@list
) {
- push @out, $ref->
call
if $ref->is_user;
+ foreach $ref (
values %channels
) {
+ push @out, $ref->
{call}
if $ref->is_user;
}
return @out;
}
}
return @out;
}
@@
-286,7
+285,7
@@
sub send_now
my $call = $self->{call};
for (@_) {
my $call = $self->{call};
for (@_) {
-
chomp;
+
#
chomp;
my @lines = split /\n/;
for (@lines) {
$conn->send_now("$sort$call|$_");
my @lines = split /\n/;
for (@lines) {
$conn->send_now("$sort$call|$_");
@@
-307,7
+306,7
@@
sub send # this is always later and always data
my $call = $self->{call};
for (@_) {
my $call = $self->{call};
for (@_) {
-
chomp;
+
#
chomp;
my @lines = split /\n/;
for (@lines) {
$conn->send_later("D$call|$_");
my @lines = split /\n/;
for (@lines) {
$conn->send_later("D$call|$_");
@@
-466,8
+465,13
@@
sub AUTOLOAD
$name =~ s/.*:://o;
confess "Non-existant field '$AUTOLOAD'" if !$valid{$name};
$name =~ s/.*:://o;
confess "Non-existant field '$AUTOLOAD'" if !$valid{$name};
- @_ ? $self->{$name} = shift : $self->{$name} ;
+
+ # this clever line of code creates a subroutine which takes over from autoload
+ # from OO Perl - Conway
+ *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ;
+ @_ ? $self->{$name} = shift : $self->{$name} ;
}
}
+
1;
__END__;
1;
__END__;