Compare commits

...

6 Commits

Author SHA1 Message Date
Zane C. B-H f6d73501c4 fix version number 2023-06-01 12:59:50 -05:00
Zane C. B-H b5b80708b0 cleanup and note changes 2023-06-01 12:55:29 -05:00
Zane C. B-H b5301ee773 remove the readme, integrating it into README.md 2023-06-01 12:35:37 -05:00
Zane C. B-H 1d64e8db8e re-organize the repo 2023-06-01 12:34:41 -05:00
Zane C. B-H 964cd1ace5 add none 2023-02-20 20:17:45 -06:00
Zane C. B-H 9d2fc471fb bump to 0.0.1 2019-07-30 02:31:33 -05:00
60 changed files with 315 additions and 227 deletions

12
Changes Normal file
View File

@ -0,0 +1,12 @@
Revision history for Net-Connection-Sort
0.1.1 2023-06-01/13:00
- Add unsorted.
0.0.1 2019-07-30/02:30
- Remove a bit of unused code that prevented one
method from running.
0.0.0 2019-07-27/22:00
- Initial release.

View File

@ -15,9 +15,10 @@ lib/Net/Connection/Sort/ptr_l.pm
lib/Net/Connection/Sort/state.pm
lib/Net/Connection/Sort/uid.pm
lib/Net/Connection/Sort/user.pm
lib/Net/Connection/Sort/unsorted.pm
Makefile.PL
MANIFEST This list of files
README
README.md
t/00-load.t
t/01-load.t
t/02-load.t
@ -34,21 +35,23 @@ t/12-load.t
t/13-load.t
t/14-load.t
t/15-load.t
t/manifest.t
t/pod-coverage.t
t/pod.t
t/16-load.t
t/host_f.t
t/host_fl.t
t/host_l.t
t/host_lf.t
t/manifest.t
t/pid.t
t/proto.t
t/pod-coverage.t
t/pod.t
t/port_f.t
t/port_fa.t
t/port_l.t
t/port_la.t
t/proto.t
t/ptr_f.t
t/ptr_l.t
t/state.t
t/uid.t
t/unsorted.t
t/user.t

View File

@ -1,5 +0,0 @@
Revision history for Net-Connection-Sort
0.0.0 2019-07-27/22:00
- Initial release.

View File

@ -1,64 +0,0 @@
Net-Connection-Sort
This sorts a array of Net::Connection objects.
Currently the methods below are supported.
host_f - Host foreign
host_fl - Host, foreign then local
host_l - Host, local
host_lf - Host, local then foreign
pid - Process ID
port_f - Port, foreign, numeric
port_fa - Port, foreign, alpha
port_l - Port, local, numeric
port_la - Port, local, alpha
proto - Network connection protocol
ptr_f - PTR, foreign
ptr_l - PTR, local
state - Connection
uid - User ID
user - Username
INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make install
SUPPORT AND DOCUMENTATION
After installing, 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
http://gitea.eesdp.org/vvelox/Net-Connection-Sort
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)

View File

@ -1,18 +0,0 @@
Makefile
Makefile.old
Build
Build.bat
META.*
MYMETA.*
.build/
_build/
cover_db/
blib/
inc/
.lwpcookies
.last_cover_stats
nytprof.out
pod2htm*.tmp
pm_to_blib
Net-Connection-Sort-*
Net-Connection-Sort-*.tar.gz

View File

@ -1,3 +1,23 @@
# Net-Connection-Sort
Sort a array of Net::Connection objects.
This sorts a array of Net::Connection objects.
Currently the methods below are supported.
```
host_f - Host foreign
host_fl - Host, foreign then local
host_l - Host, local
host_lf - Host, local then foreign
pid - Process ID
port_f - Port, foreign, numeric
port_fa - Port, foreign, alpha
port_l - Port, local, numeric
port_la - Port, local, alpha
proto - Network connection protocol
ptr_f - PTR, foreign
ptr_l - PTR, local
state - Connection
uid - User ID
user - Username
```

View File

@ -10,11 +10,11 @@ Net::Connection::Sort - Sorts array of Net::Connection objects.
=head1 VERSION
Version 0.0.0
Version 0.1.1
=cut
our $VERSION = '0.0.0';
our $VERSION = '0.1.1';
=head1 SYNOPSIS
@ -168,10 +168,6 @@ sub sorter{
@objects= @{$_[1]};
};
if( ! $self->errorblank ){
return undef;
}
return $self->{sorter}->sorter( \@objects );
}
@ -203,14 +199,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -179,14 +179,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -180,14 +180,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -179,14 +179,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -180,14 +180,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -184,14 +184,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -163,14 +163,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -174,14 +174,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -163,14 +163,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -176,14 +176,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -157,14 +157,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -182,14 +182,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -182,14 +182,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -157,14 +157,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -179,14 +179,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

View File

@ -0,0 +1,181 @@
package Net::Connection::Sort::unsorted;
use 5.006;
use strict;
use warnings;
=head1 NAME
Net::Connection::Sort::unsorted - Pass though. Does returns exactly what it was given.
=head1 VERSION
Version 0.0.1
=cut
our $VERSION = '0.0.1';
=head1 SYNOPSIS
use Net::Connection::Sort::unsorted;
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' => 'LISTEN',
'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' => 'FIN_WAIT_2',
'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' => 'TIME_WAIT',
'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 $sorter=$sorter=Net::Connection::Sort::unsorted->new;
@objects=$sorter->sorter( \@objects );
print Dumper( \@objects );
=head1 METHODS
=head2 new
This initiates the module.
No arguments are taken and this will always succeed.
my $sorter=$sorter=Net::Connection::Sort::state->new;
=cut
sub new{
my %args;
if(defined($_[1])){
%args= %{$_[1]};
};
my $self = {
};
bless $self;
return $self;
}
=head2 sort
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 );
=cut
sub sorter{
my $self=$_[0];
my @objects;
if (
defined( $_[1] ) &&
( ref($_[1]) eq 'ARRAY' )
){
@objects=@{ $_[1] };
}else{
die 'The passed item is either not a array or undefined';
}
return @objects;
}
=head1 AUTHOR
Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >>
=head1 BUGS
Please report any bugs or feature requests to C<bug-net-connection-sort at rt.cpan.org>, or through
the web interface at L<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.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::Connection::Sort
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker (report bugs here)
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>
=item * Git Repo
L<https://gitea.eesdp.org/vvelox/Net-Connection-Sort>
=back
=head1 ACKNOWLEDGEMENTS
=head1 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)
=cut
1; # End of Net::Connection::Sort

View File

@ -188,14 +188,6 @@ You can also look for information at:
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Connection-Sort>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Net-Connection-Sort>
=item * CPAN Ratings
L<https://cpanratings.perl.org/d/Net-Connection-Sort>
=item * Search CPAN
L<https://metacpan.org/release/Net-Connection-Sort>

13
t/16-load.t Normal file
View File

@ -0,0 +1,13 @@
#!perl -T
use 5.006;
use strict;
use warnings;
use Test::More;
plan tests => 1;
BEGIN {
use_ok( 'Net::Connection::Sort::unsorted' ) || print "Bail out!\n";
}
diag( "Testing Net::Connection::Sort::unsorted $Net::Connection::Sort::unsorted::VERSION, Perl $], $^X" );

78
t/unsorted.t Normal file
View File

@ -0,0 +1,78 @@
#!perl -T
use 5.006;
use strict;
use warnings;
use Test::More;
use Net::Connection;
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' => 'LISTEN',
'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' => 'FIN_WAIT_2',
'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' => 'TIME_WAIT',
'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'
}),
);
BEGIN {
use_ok( 'Net::Connection::Sort::unsorted' ) || print "Bail out!\n";
}
diag( "Testing Net::Connection::Sort::unsorted $Net::Connection::Sort::unsorted::VERSION, Perl $], $^X" );
my $sorter;
my $worked=0;
eval{
$sorter=Net::Connection::Sort::unsorted->new;
$worked=1;
};
ok( $worked eq 1, 'sorter init') or die ('Net::Connection::Sort::state->new resulted in... '.$@);
my @sorted;
$worked=0;
eval{
@sorted=$sorter->sorter( \@objects );
$worked=1;
};
ok( $worked eq 1, 'sort') or die ('Net::Connection::Sort::state->sorter(@objects) resulted in... '.$@);
ok( $sorted[0]->state =~ 'LISTEN', 'sort order 0') or die ('The state for 0 is not LISTEN');
ok( $sorted[1]->state =~ 'FIN_WAIT_2', 'sort order 1') or die ('The state for 1 is not FIN_WAIT_2');
ok( $sorted[2]->state =~ 'TIME_WAIT', 'sort order 2') or die ('The state for 2 is not TIME_WAIT');
ok( $sorted[3]->state =~ 'ESTABLISHED', 'sort order 2') or die ('The state for 3 is not ESTABLISHED');
done_testing(7);