GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::Connection::Sort(3) User Contributed Perl Documentation Net::Connection::Sort(3)

Net::Connection::Sort - Sorts array of Net::Connection objects.

Version 0.0.1

    use Net::Connection::Sort;
    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' => '22',
                                        'local_port' => '11132',
                                        'sendq' => '1',
                                        'recvq' => '0',
                                        'state' => 'ESTABLISHED',
                                        'proto' => 'tcp4'
                                        }),
                  Net::Connection->new({
                                        'foreign_host' => '1.1.1.1',
                                        'local_host' => '2.2.2.2',
                                        'foreign_port' => '22',
                                        'local_port' => '11132',
                                        'sendq' => '1',
                                        'recvq' => '0',
                                        'state' => 'ESTABLISHED',
                                        'proto' => 'tcp4'
                                        }),
                  Net::Connection->new({
                                        'foreign_host' => '5.5.5.5',
                                        'local_host' => '6.6.6.6',
                                        'foreign_port' => '22',
                                        'local_port' => '11132',
                                        'sendq' => '1',
                                        'recvq' => '0',
                                        'state' => 'ESTABLISHED',
                                        'proto' => 'tcp4'
                                        }),
                  Net::Connection->new({
                                        'foreign_host' => '3.3.3.3',
                                        'local_host' => '4.4.4.4',
                                        'foreign_port' => '22',
                                        'local_port' => '11132',
                                        'sendq' => '1',
                                        'recvq' => '0',
                                        'state' => 'ESTABLISHED',
                                        'proto' => 'tcp4'
                                        }),
                 );
    
    my $sort_args={
                  type=>'host_f',
                  invert=>0,
                  };
    
    my $mcs;
    eval{
        $mcs=Net::Connection::Sort->new( $sort_args );
    };
    
    if ( ! defined( $mcs ) ){
        print "Failed to init the sorter... ".$@;
    }
    
    my @sorted=$mcs->sorter( \@objects );
    
    print Dumper( \@sorted );

This initiates the module.

One argument is taken and that is a hash ref with two possible keys, 'type' and 'invert'. If not passed or any of the keys are undef, then the defaults will be used.

'type' is the module to use. It is relative to 'Net::Connection::Sort', so 'host_f' becomes 'Net::Connection::Sort::host_f'.

    my $sort_args={
                  type=>'host_f',
                  invert=>0,
                  };
    
    my $mcs;
    eval{
        $ncs=Net::Connection::Sort->new( $sort_args );
    };
    
    if ( ! defined( $mcs ) ){
        print "Failed to init the sorter... ".$@;
    }

This sorts the array of Net::Connection objects.

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

    my @sorted=$mcs->sorter( \@objects );
    
    print Dumper( \@sorted );

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

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.

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

    perldoc Net::Connection::Sort

You can also look for information at:

  • RT: CPAN's request tracker (report bugs here)

    <https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>

  • AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/Net-Connection-Sort>

  • CPAN Ratings

    <https://cpanratings.perl.org/d/Net-Connection-Sort>

  • Search CPAN

    <https://metacpan.org/release/Net-Connection-Sort>

  • Git Repo

    <https://gitea.eesdp.org/vvelox/Net-Connection-Sort>

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

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
2019-07-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.