NAME

Net::Connection::Sort::port_fa - Sorts the connections via the foreign port alphabetically.

VERSION

Version 0.1.2

SYNOPSIS

This sorts on the service name where there is one. Ports without a service name sort after those with one, numerically. For purely numeric sorting use port_f.

use Net::Connection::Sort::port_fa;
use Net::Connection;
use Data::Dumper;

 my @objects=(
              Net::Connection->new({
                                    'foreign_host' => '3.3.3.3',
                                    'local_host' => '4.4.4.4',
                                    'foreign_port' => 'FTP',
                                    'local_port' => '11132',
                                    'sendq' => '1',
                                    'recvq' => '0',
                                    'state' => 'ESTABLISHED',
                                    'proto' => 'tcp4',
                                    'ports' => 0,
                                    }),
              Net::Connection->new({
                                    'foreign_host' => '1.1.1.1',
                                    'local_host' => '2.2.2.2',
                                    'foreign_port' => 'SSH',
                                    'local_port' => '11132',
                                    'sendq' => '1',
                                    'recvq' => '0',
                                    'state' => 'ESTABLISHED',
                                    'proto' => 'tcp4',
                                    'ports' => 0,
                                    }),
              Net::Connection->new({
                                    'foreign_host' => '5.5.5.5',
                                    'local_host' => '6.6.6.6',
                                    'foreign_port' => 'HTTP',
                                    'local_port' => '11132',
                                    'sendq' => '1',
                                    'recvq' => '0',
                                    'state' => 'ESTABLISHED',
                                    'proto' => 'tcp4',
                                    'ports' => 0,
                                    }),
              Net::Connection->new({
                                    'foreign_host' => '3.3.3.3',
                                    'local_host' => '4.4.4.4',
                                    'foreign_port' => 'HTTPS',
                                    'local_port' => '11132',
                                    'sendq' => '1',
                                    'recvq' => '0',
                                    'state' => 'ESTABLISHED',
                                    'proto' => 'tcp4',
                                    'ports' => 0,
                                    }),
             );

my $sorter=Net::Connection::Sort::port_fa->new;

@objects=$sorter->sorter( \@objects );

print Dumper( \@objects );

METHODS

new

This initiates the module.

No arguments are taken and this will always succeed.

my $sorter=Net::Connection::Sort::port_fa->new;

sorter

This sorts the array of Net::Connection objects.

One object is taken and that is a array of objects.

@objects=$sorter->sorter( \@objects );

print Dumper( \@objects );

helper

This is a internal function.

Two items are returned for the connection passed to it. The first is true if the port has no service name and the second is the value to sort on, either the service name or the port itself.

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-net-connection-sort at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Connection-Sort. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::Connection::Sort

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2019 by Zane C. Bowers-Hadley.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)