Skip to content

Commit

Permalink
Applied jinzougen's patch to have alias_list return an arbitrary alias
Browse files Browse the repository at this point in the history
in scalar context.
  • Loading branch information
rcaputo committed Aug 27, 2002
1 parent dbd60b1 commit 02f8bfd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/POE/Kernel.pm
Expand Up @@ -3156,7 +3156,8 @@ sub alias_list {
}

# Return whatever can be found.
return keys %{$kr_sessions{$search_session}->[SS_ALIASES]};
my @alias_list = keys %{$kr_sessions{$search_session}->[SS_ALIASES]};
return wantarray() ? @alias_list : $alias_list[0];
}

#==============================================================================
Expand Down
15 changes: 9 additions & 6 deletions tests/03_aliases.t
Expand Up @@ -6,7 +6,7 @@
use strict;
use lib qw(./lib ../lib);
use TestSetup;
&test_setup(20);
&test_setup(21);

use POSIX qw (:errno_h);

Expand Down Expand Up @@ -84,6 +84,9 @@ sub machine_start {
grep( /^second name$/, @aliases ) == 1
);
print "ok 14\n";

print "not " if $kernel->alias_list($session) eq 2;
print "ok 15\n";
}

# Catch SIGIDLE and SIGZOMBIE.
Expand Down Expand Up @@ -114,10 +117,10 @@ sub machine_stop {
my $heap = $_[HEAP];

print "not " unless $heap->{idle_count} == 1;
print "ok 18\n";
print "ok 19\n";

print "not " unless $heap->{zombie_count} == 1;
print "ok 19\n";
print "ok 20\n";
}

### Main loop.
Expand Down Expand Up @@ -147,7 +150,7 @@ POE::Session->create
sub {
$_[KERNEL]->alias_set( 'a_sample_alias' );
print "not " if $_[KERNEL]->alias_remove( 'a_sample_alias' );
print "ok 16\n";
print "ok 17\n";
},
_signal =>
sub {
Expand All @@ -158,13 +161,13 @@ POE::Session->create
}
);

print "ok 17\n";
print "ok 18\n";

# Now run the kernel until there's nothing left to do.

my $poe_kernel = POE::Kernel->new();
$poe_kernel->run();

print "ok 20\n";
print "ok 21\n";

exit;

0 comments on commit 02f8bfd

Please sign in to comment.