Port::Selector - pick some unused port
my $port_sel = Port::Selector->new(); $port_sel->port();
This module is used to find a free port, by default in the range 49152 to 65535, but you can change the range of ports that will be checked.
lowest numbered port to consider
default 49152
The range 49152-65535 is commonly used by applications that utilize a dynamic/random/configurable port.
highest numbered port to consider
default 65535
socket protocol
default tcp
local address
default localhost
Tries to find an unused port from min-max ports range, checking each port in turn until it finds an available one.
min
max
Net::EmptyPort (part of the Test-TCP distribution, provides a function empty_port which does the same thing as the port method in this module.
Test-TCP
empty_port
port
Copyright (C) Avast Software.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Jan Seidl <seidl@avast.com>
To install Port::Selector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Port::Selector
CPAN shell
perl -MCPAN -e shell install Port::Selector
For more information on module installation, please visit the detailed CPAN module installation guide.