7 use List::Util qw'shuffle';
11 Exim::Runtest - helper functions for the runtest script
16 my $foo = Exim::Runtest::foo('foo');
20 The B<Exim::Runtest> module provides some simple functions
21 for the F<runtest> script. No functions are exported yet.
28 croak "Need a group *name*, not a numeric group id."
31 return $group if getgrnam $group;
34 setgrent or die "setgrent: $!\n";
35 push @groups, $_ while defined($_ = getgrent);
37 return (shuffle @groups)[0];
42 for (my $port = 1024; $port < 65000; $port++) {
43 $socket = IO::Socket::INET->new(
44 LocalHost => '127.0.0.1',
50 croak 'Can not allocate a free port.';
61 =item B<mailgroup>(I<$default>)
63 Check if the mailgroup I<$default> exists. Return the checked
64 group name or some other random but existing group.
66 =item B<dynamic_socket>()
68 Return a dynamically allocated listener socket in the range
69 between 1024 and 65534;