diff --git a/Build.PL b/Build.PL old file mode 100755 new file mode 100644 index 7440ad6..7440ad6 100644 diff --git a/Changes b/Changes old file mode 100755 new file mode 100644 index 1ff7ed2..1ff7ed2 100644 diff --git a/MANIFEST b/MANIFEST old file mode 100755 new file mode 100644 index e995363..e995363 100644 diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP old file mode 100755 new file mode 100644 index 062bb72..062bb72 100644 diff --git a/Makefile.PL.old b/Makefile.PL.old deleted file mode 100755 index 8b5af66..0000000 --- a/Makefile.PL.old +++ /dev/null @@ -1,17 +0,0 @@ -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. -WriteMakefile( - 'NAME' => 'POE::Component::SSLify', - 'VERSION_FROM' => 'lib/POE/Component/SSLify.pm', - 'PREREQ_PM' => { - 'Net::SSLeay' => '1.30', - }, - ( $] >= 5.005 ? # Add new keywords - ( - 'ABSTRACT_FROM' => 'lib/POE/Component/SSLify.pm', # retrieve abstract from module - 'AUTHOR' => 'Apocalypse ', - 'LICENSE' => 'perl', - ) : () - ), -); diff --git a/POE-Component-SSLify-0.01.tar.gz b/POE-Component-SSLify-0.01.tar.gz old file mode 100755 new file mode 100644 index de1b8c7..de1b8c7 100644 Binary files a/POE-Component-SSLify-0.01.tar.gz and b/POE-Component-SSLify-0.01.tar.gz differ diff --git a/POE-Component-SSLify-0.02.tar.gz b/POE-Component-SSLify-0.02.tar.gz old file mode 100755 new file mode 100644 index b21bd20..b21bd20 100644 Binary files a/POE-Component-SSLify-0.02.tar.gz and b/POE-Component-SSLify-0.02.tar.gz differ diff --git a/POE-Component-SSLify-0.03.tar.gz b/POE-Component-SSLify-0.03.tar.gz old file mode 100755 new file mode 100644 index 644cef5..644cef5 100644 Binary files a/POE-Component-SSLify-0.03.tar.gz and b/POE-Component-SSLify-0.03.tar.gz differ diff --git a/POE-Component-SSLify-0.04.tar.gz b/POE-Component-SSLify-0.04.tar.gz old file mode 100755 new file mode 100644 index 96e542e..96e542e 100644 Binary files a/POE-Component-SSLify-0.04.tar.gz and b/POE-Component-SSLify-0.04.tar.gz differ diff --git a/POE-Component-SSLify-0.05.tar.gz b/POE-Component-SSLify-0.05.tar.gz old file mode 100755 new file mode 100644 index 3b17879..3b17879 100644 Binary files a/POE-Component-SSLify-0.05.tar.gz and b/POE-Component-SSLify-0.05.tar.gz differ diff --git a/POE-Component-SSLify-0.06.tar.gz b/POE-Component-SSLify-0.06.tar.gz old file mode 100755 new file mode 100644 index 9100bd0..9100bd0 100644 Binary files a/POE-Component-SSLify-0.06.tar.gz and b/POE-Component-SSLify-0.06.tar.gz differ diff --git a/POE-Component-SSLify-0.07.tar.gz b/POE-Component-SSLify-0.07.tar.gz old file mode 100755 new file mode 100644 index c6b71de..c6b71de 100644 Binary files a/POE-Component-SSLify-0.07.tar.gz and b/POE-Component-SSLify-0.07.tar.gz differ diff --git a/POE-Component-SSLify-0.08.tar.gz b/POE-Component-SSLify-0.08.tar.gz old file mode 100755 new file mode 100644 index 19df87c..19df87c 100644 Binary files a/POE-Component-SSLify-0.08.tar.gz and b/POE-Component-SSLify-0.08.tar.gz differ diff --git a/POE-Component-SSLify-0.09.tar.gz b/POE-Component-SSLify-0.09.tar.gz old file mode 100755 new file mode 100644 index 0dc00fd..0dc00fd 100644 Binary files a/POE-Component-SSLify-0.09.tar.gz and b/POE-Component-SSLify-0.09.tar.gz differ diff --git a/POE-Component-SSLify-0.10.tar.gz b/POE-Component-SSLify-0.10.tar.gz old file mode 100755 new file mode 100644 index c27e4cc..c27e4cc 100644 Binary files a/POE-Component-SSLify-0.10.tar.gz and b/POE-Component-SSLify-0.10.tar.gz differ diff --git a/POE-Component-SSLify-0.11.tar.gz b/POE-Component-SSLify-0.11.tar.gz old file mode 100755 new file mode 100644 index 656d0c1..656d0c1 100644 Binary files a/POE-Component-SSLify-0.11.tar.gz and b/POE-Component-SSLify-0.11.tar.gz differ diff --git a/POE-Component-SSLify-0.12.tar.gz b/POE-Component-SSLify-0.12.tar.gz old file mode 100755 new file mode 100644 index a515ebb..a515ebb 100644 Binary files a/POE-Component-SSLify-0.12.tar.gz and b/POE-Component-SSLify-0.12.tar.gz differ diff --git a/POE-Component-SSLify-0.13.tar.gz b/POE-Component-SSLify-0.13.tar.gz old file mode 100755 new file mode 100644 index d6e5532..d6e5532 100644 Binary files a/POE-Component-SSLify-0.13.tar.gz and b/POE-Component-SSLify-0.13.tar.gz differ diff --git a/POE-Component-SSLify-0.14.tar.gz b/POE-Component-SSLify-0.14.tar.gz old file mode 100755 new file mode 100644 index b51a992..b51a992 100644 Binary files a/POE-Component-SSLify-0.14.tar.gz and b/POE-Component-SSLify-0.14.tar.gz differ diff --git a/examples/serverclient.pl b/examples/serverclient.pl new file mode 100755 index 0000000..93b5c98 --- /dev/null +++ b/examples/serverclient.pl @@ -0,0 +1,179 @@ +#!/usr/bin/perl +use strict; use warnings; + +use POE; +use Socket qw( inet_ntoa unpack_sockaddr_in ); +use POE::Component::SSLify qw( Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_GetSocket ); +use POE::Wheel::ReadWrite; +use POE::Wheel::SocketFactory; +use POE::Driver::SysRW; +use POE::Filter::Line; +use POE::Wheel::ReadLine; + +# create the server +POE::Session->create( + 'inline_states' => { + '_start' => sub { + # Okay, set the SSL options + SSLify_Options( 'server.key', 'server.crt' ); + + # Set the alias + $_[KERNEL]->alias_set( 'server' ); + + # Create the socketfactory wheel to listen for requests + $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( + 'BindPort' => 5432, + 'BindAddress' => 'localhost', + 'Reuse' => 'yes', + 'SuccessEvent' => 'Got_Connection', + 'FailureEvent' => 'ListenerError', + ); + return 1; + }, + 'Got_Connection' => sub { + # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port + my $socket = $_[ ARG0 ]; + + # SSLify it! + $socket = Server_SSLify( $socket ); + + # testing stuff + warn "got connection from: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $socket ) ) ) )[1] ) . " cipher type: " . SSLify_GetCipher( $socket ); + + # Hand it off to ReadWrite + my $wheel = POE::Wheel::ReadWrite->new( + 'Handle' => $socket, + 'Driver' => POE::Driver::SysRW->new(), + 'Filter' => POE::Filter::Line->new(), + 'InputEvent' => 'Got_Input', + 'FlushedEvent' => 'Got_Flush', + 'ErrorEvent' => 'Got_Error', + ); + + # Store it... + $_[HEAP]->{'WHEELS'}->{ $wheel->ID } = $wheel; + return 1; + }, + 'ListenerError' => sub { + # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID + my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; + warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; + + return 1; + }, + 'Got_Input' => sub { + # ARG0: The Line, ARG1: Wheel ID + + # Send back to the client the line! + $_[HEAP]->{'WHEELS'}->{ $_[ARG1] }->put( $_[ARG0] ); + return 1; + }, + 'Got_Flush' => sub { + # We don't care about this event + return 1; + }, + 'Got_Error' => sub { + # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID + my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; + warn "Wheel $id generated $operation error $errnum: $errstr\n"; + + # Done with a wheel + delete $_[HEAP]->{'WHEELS'}->{ $_[ARG0] }; + return 1; + }, + }, +); + +# create the client +POE::Session->create( + 'inline_states' => { + '_start' => sub { + # Set the alias + $_[KERNEL]->alias_set( 'client' ); + + # Setup our ReadLine stuff + $_[HEAP]->{'RL'} = POE::Wheel::ReadLine->new( + 'InputEvent' => 'Got_ReadLine', + ); + + # Connect to the server! + $_[KERNEL]->yield( 'do_connect' ); + return 1; + }, + 'do_connect' => sub { + # Create the socketfactory wheel to listen for requests + $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( + 'RemotePort' => 5432, + 'RemoteAddress' => 'localhost', + 'Reuse' => 'yes', + 'SuccessEvent' => 'Got_Connection', + 'FailureEvent' => 'ConnectError', + ); + return 1; + }, + 'Got_ReadLine' => sub { + if ( defined $_[ARG0] ) { + if ( exists $_[HEAP]->{'WHEEL'} ) { + $_[HEAP]->{'WHEEL'}->put( $_[ARG0] ); + } + } else { + if ( $_[ARG1] eq 'interrupt' ) { + die 'stopped'; + } + } + }, + 'Got_Connection' => sub { + # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port + my $socket = $_[ ARG0 ]; + + # SSLify it! + $socket = Client_SSLify( $socket ); + + # Hand it off to ReadWrite + my $wheel = POE::Wheel::ReadWrite->new( + 'Handle' => $socket, + 'Driver' => POE::Driver::SysRW->new(), + 'Filter' => POE::Filter::Line->new(), + 'InputEvent' => 'Got_Input', + 'ErrorEvent' => 'Got_Error', + ); + + # Store it... + $_[HEAP]->{'WHEEL'} = $wheel; + $_[HEAP]->{'RL'}->put( 'Connected to SSL server' ); + $_[HEAP]->{'RL'}->get( 'Input: ' ); + + return 1; + }, + 'ConnectError' => sub { + # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID + my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; + warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; + delete $_[HEAP]->{'SOCKETFACTORY'}; + $_[HEAP]->{'RL'}->put( 'Unable to connect to SSL server...' ); + $_[KERNEL]->delay_set( 'do_connect', 5 ); + return 1; + }, + 'Got_Input' => sub { + # ARG0: The Line, ARG1: Wheel ID + + # Send back to the client the line! + $_[HEAP]->{'RL'}->put( 'Got Reply: ' . $_[ARG0] ); + $_[HEAP]->{'RL'}->get( 'Input: ' ); + return 1; + }, + 'Got_Error' => sub { + # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID + my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; + warn "Wheel $id generated $operation error $errnum: $errstr\n"; + delete $_[HEAP]->{'WHEEL'}; + $_[HEAP]->{'RL'}->put( 'Disconnected from SSL server...' ); + $_[KERNEL]->delay_set( 'do_connect', 5 ); + return 1; + }, + }, +); + +# Start POE! +POE::Kernel->run(); +exit 0; diff --git a/lib/POE/Component/SSLify/ClientHandle.pm b/lib/POE/Component/SSLify/ClientHandle.pm old file mode 100755 new file mode 100644 index f1c8417..f1c8417 100644 diff --git a/lib/POE/Component/SSLify/ServerHandle.pm b/lib/POE/Component/SSLify/ServerHandle.pm old file mode 100755 new file mode 100644 index 4ed8a29..4ed8a29 100644 diff --git a/lib/POE/Component/SSLify.pm b/lib/POE/Component/SSLify.pm old file mode 100755 new file mode 100644 index c3d91a1..c3d91a1 100644 diff --git a/t/1_load.t b/t/1_load.t new file mode 100644 index 0000000..c9bfe7b --- /dev/null +++ b/t/1_load.t @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +# Import the stuff +# XXX no idea why this is broken for this particular dist! +#use Test::UseAllModules; +#BEGIN { all_uses_ok(); } + +use Test::More tests => 4; +use_ok( 'POE::Component::Fuse' ); +use_ok( 'POE::Component::Fuse::SubProcess' ); +use_ok( 'POE::Component::Fuse::AsyncFsV' ); +use_ok( 'POE::Component::Fuse::myFuse' ); diff --git a/t/a_compile.t b/t/a_compile.t old file mode 100755 new file mode 100644 index 4b1abfc..4b1abfc 100644 diff --git a/t/a_critic.t b/t/a_critic.t old file mode 100755 new file mode 100644 index 7e30808..7e30808 100644 diff --git a/t/a_dependencies.t b/t/a_dependencies.t old file mode 100755 new file mode 100644 index ccc29aa..d14eba7 100644 --- a/t/a_dependencies.t +++ b/t/a_dependencies.t @@ -6,7 +6,7 @@ if ( not $ENV{TEST_AUTHOR} ) { plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; } else { - eval "use Test::Dependencies exclude => [ qw/ POE::Component::SSLify / ]"; + eval "use Test::Dependencies exclude => [ qw/ POE::Component::Fuse Module::Build / ], style => 'light';"; if ( $@ ) { plan skip_all => 'Test::Dependencies required to test perl module deps'; } else { diff --git a/t/a_distribution.t b/t/a_distribution.t old file mode 100755 new file mode 100644 index 27f7831..27f7831 100644 diff --git a/t/a_dosnewline.t b/t/a_dosnewline.t old file mode 100755 new file mode 100644 index d804bee..89bcd54 100644 --- a/t/a_dosnewline.t +++ b/t/a_dosnewline.t @@ -15,11 +15,11 @@ # generate the file list my $rule = File::Find::Rule->new; $rule->grep( qr/\r\n/ ); - my @files = $rule->in( qw( lib t examples ) ); + my @files = $rule->in( qw( lib t ) ); # FIXME read in MANIFEST.SKIP and use it! - # for now, we skip SVN stuff - @files = grep { $_ !~ /\/\.svn\// } @files; + # for now, we skip SVN + git stuff + @files = grep { $_ !~ /(?:\/\.svn\/|\/\.git\/)/ } @files; # do we have any? if ( scalar @files ) { diff --git a/t/a_fixme.t b/t/a_fixme.t old file mode 100755 new file mode 100644 index bea2261..627cc08 100644 --- a/t/a_fixme.t +++ b/t/a_fixme.t @@ -8,11 +8,11 @@ } else { eval "use Test::Fixme"; if ( $@ ) { - plan skip_all => 'Test::Fixme required for checking for presence of to-do stuff!'; + plan skip_all => 'Test::Fixme required for checking for presence of FIXMEs'; } else { run_tests( - 'where' => [ 'lib', 't' ], - 'match' => 'FIX' . 'ME', # weird work-around suggested in POD so we don't catch ourself! + 'where' => 'lib', + 'match' => qr/FIXME|TODO/, ); } } diff --git a/t/a_hasversion.t b/t/a_hasversion.t old file mode 100755 new file mode 100644 index 9491779..9491779 100644 diff --git a/t/a_is_prereq_outdated.t b/t/a_is_prereq_outdated.t new file mode 100644 index 0000000..ed1f17f --- /dev/null +++ b/t/a_is_prereq_outdated.t @@ -0,0 +1,126 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Test::More; + +# AUTHOR test +if ( not $ENV{TEST_AUTHOR} ) { + plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; +} else { + # can we load YAML? + eval "use YAML"; + if ( $@ ) { + plan skip_all => 'YAML is necessary to check META.yml for prerequisites!'; + } + + # can we load CPANPLUS? + eval "use CPANPLUS::Backend"; + if ( $@ ) { + plan skip_all => 'CPANPLUS is necessary to check module versions!'; + } + + # can we load version.pm? + eval "use version"; + if ( $@ ) { + plan skip_all => 'version.pm is necessary to compare versions!'; + } + + # does META.yml exist? + if ( -e 'META.yml' and -f _ ) { + load_yml( 'META.yml' ); + } else { + # maybe one directory up? + if ( -e '../META.yml' and -f _ ) { + load_yml( '../META.yml' ); + } else { + plan skip_all => 'META.yml is missing, unable to process it!'; + } + } +} + +# main entry point +sub load_yml { + # we'll load a file + my $file = shift; + + # okay, proceed to load it! + my $data; + eval { + $data = YAML::LoadFile( $file ); + }; + if ( $@ ) { + plan skip_all => "Unable to load $file => $@"; + } else { + note( "Loaded $file, proceeding with analysis" ); + } + + # massage the data + $data = $data->{'requires'}; + delete $data->{'perl'} if exists $data->{'perl'}; + + # FIXME shut up warnings ( eval's fault, blame it! ) + require version; + + # init the backend ( and set some options ) + my $cpanconfig = CPANPLUS::Configure->new; + $cpanconfig->set_conf( 'verbose' => 0 ); + $cpanconfig->set_conf( 'no_update' => 1 ); + my $cpanplus = CPANPLUS::Backend->new( $cpanconfig ); + + # silence CPANPLUS! + { + no warnings 'redefine'; + eval "sub Log::Message::Handlers::cp_msg { return }"; + eval "sub Log::Message::Handlers::cp_error { return }"; + } + + # Okay, how many prereqs do we have? + plan tests => scalar keys %$data; + + # analyze every one of them! + foreach my $prereq ( keys %$data ) { + check_cpan( $cpanplus, $prereq, $data->{ $prereq } ); + } +} + +# checks a prereq against CPAN +sub check_cpan { + my $backend = shift; + my $prereq = shift; + my $version = shift; + + # check CPANPLUS + my $module = $backend->parse_module( 'module' => $prereq ); + if ( defined $module ) { + # okay, for starters we check to see if it's version 0 then we skip it + if ( $version eq '0' ) { + ok( 1, "Skipping '$prereq' because it is specified as version 0" ); + return; + } + + # Does the prereq have funky characters that we're unable to process now? + if ( $version =~ /[<>=,!]+/ ) { + # FIXME simplistic style of parsing + my @versions = split( ',', $version ); + + # sort them by version, descending + s/[\s<>=!]+// for @versions; + @versions = sort { $b <=> $a } + map { version->new( $_ ) } @versions; + + # pick the highest version to use as comparison + $version = $versions[0]; + } + + # convert both objects to version objects so we can compare + $version = version->new( $version ) if ! ref $version; + my $cpanversion = version->new( $module->version ); + + # check it! + is( $cpanversion, $version, "Comparing '$prereq' to CPAN version" ); + } else { + ok( 0, "Warning: '$prereq' is not found on CPAN!" ); + } + + return; +} diff --git a/t/a_kwalitee.t b/t/a_kwalitee.t old file mode 100755 new file mode 100644 index 930ea87..ff0f7d7 100644 --- a/t/a_kwalitee.t +++ b/t/a_kwalitee.t @@ -11,5 +11,30 @@ plan skip_all => 'Test::Kwalitee required for measuring the kwalitee'; } else { Test::Kwalitee->import(); + + # That piece of crap dumps files all over :( + cleanup_debian_files(); } } + +# Module::CPANTS::Kwalitee::Distros suck! +#t/a_manifest..............1/1 +## Failed test at t/a_manifest.t line 13. +## got: 1 +## expected: 0 +## The following files are not named in the MANIFEST file: /home/apoc/workspace/VCS-perl-trunk/VCS-2.12.2/Debian_CPANTS.txt +## Looks like you failed 1 test of 1. +#t/a_manifest.............. Dubious, test returned 1 (wstat 256, 0x100) +sub cleanup_debian_files { + foreach my $file ( qw( Debian_CPANTS.txt ../Debian_CPANTS.txt ) ) { + if ( -e $file and -f _ ) { + my $status = unlink( $file ); + if ( ! $status ) { + warn "unable to unlink $file"; + } + } + } + + return; +} + diff --git a/t/a_manifest.t b/t/a_manifest.t old file mode 100755 new file mode 100644 index f74cc9a..57e9de1 100644 --- a/t/a_manifest.t +++ b/t/a_manifest.t @@ -11,7 +11,7 @@ plan skip_all => 'Test::CheckManifest required for validating the MANIFEST'; } else { ok_manifest( { - 'filter' => [ qr/\.svn/, qr/\.tar\.gz$/ ], + 'filter' => [ qr/\.svn/, qr/\.git/, qr/\.tar\.gz$/ ], } ); } } diff --git a/t/a_metayml.t b/t/a_metayml.t new file mode 100644 index 0000000..66562f0 --- /dev/null +++ b/t/a_metayml.t @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +use Test::More; + +# AUTHOR test +if ( not $ENV{TEST_AUTHOR} ) { + plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; +} else { + eval "use Test::YAML::Meta"; + if ( $@ ) { + plan skip_all => 'Test::YAML::Meta required for validating the meta.yml file'; + } else { + meta_yaml_ok(); + } +} diff --git a/t/a_minimumversion.t b/t/a_minimumversion.t old file mode 100755 new file mode 100644 index d1c9977..d1c9977 100644 diff --git a/t/a_perlmetrics.t b/t/a_perlmetrics.t new file mode 100644 index 0000000..36db637 --- /dev/null +++ b/t/a_perlmetrics.t @@ -0,0 +1,63 @@ +#!/usr/bin/perl + +use Test::More; + +# AUTHOR test +if ( not $ENV{TEST_AUTHOR} ) { + plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; +} else { + eval "use Perl::Metrics::Simple"; + if ( $@ ) { + plan skip_all => 'Perl::Metrics::Simple required to analyze code metrics'; + } else { + # do it! + plan tests => 1; + my $analzyer = Perl::Metrics::Simple->new; + my $analysis = $analzyer->analyze_files( 'lib/' ); + + if ( ok( $analysis->file_count(), 'analyzed at least one file' ) ) { + # only print extra stuff if necessary + if ( $ENV{TEST_VERBOSE} ) { + diag( '-- Perl Metrics Summary ( countperl ) --' ); + diag( ' File Count: ' . $analysis->file_count ); + diag( ' Package Count: ' . $analysis->package_count ); + diag( ' Subroutine Count: ' . $analysis->sub_count ); + diag( ' Total Code Lines: ' . $analysis->lines ); + diag( ' Non-Sub Lines: ' . $analysis->main_stats->{'lines'} ); + + diag( '-- Subrotuine Metrics Summary --' ); + my $summary_stats = $analysis->summary_stats; + diag( ' Min: lines(' . $summary_stats->{sub_length}->{min} . ') McCabe(' . $summary_stats->{sub_complexity}->{min} . ')' ); + diag( ' Max: lines(' . $summary_stats->{sub_length}->{max} . ') McCabe(' . $summary_stats->{sub_complexity}->{max} . ')' ); + diag( ' Mean: lines(' . $summary_stats->{sub_length}->{mean} . ') McCabe(' . $summary_stats->{sub_complexity}->{mean} . ')' ); + diag( ' Standard Deviation: lines(' . $summary_stats->{sub_length}->{standard_deviation} . ') McCabe(' . $summary_stats->{sub_complexity}->{standard_deviation} . ')' ); + diag( ' Median: lines(' . $summary_stats->{sub_length}->{median} . ') McCabe(' . $summary_stats->{sub_complexity}->{median} . ')' ); + + # set number of subs to display + my $num = 10; + + diag( "-- Top$num subroutines by McCabe Complexity --" ); + my @sorted_subs = sort { $b->{'mccabe_complexity'} <=> $a->{'mccabe_complexity'} } @{ $analysis->subs }; + foreach my $i ( 0 .. ( $num - 1 ) ) { + diag( ' ' . $sorted_subs[$i]->{'path'} . ':' . $sorted_subs[$i]->{'name'} . ' ->' . + ' McCabe(' . $sorted_subs[$i]->{'mccabe_complexity'} . ')' . + ' lines(' . $sorted_subs[$i]->{'lines'} . ')' + ); + } + + diag( "-- Top$num subroutines by lines --" ); + @sorted_subs = sort { $b->{'lines'} <=> $a->{'lines'} } @sorted_subs; + foreach my $i ( 0 .. ( $num - 1 ) ) { + diag( ' ' . $sorted_subs[$i]->{'path'} . ':' . $sorted_subs[$i]->{'name'} . ' ->' . + ' lines(' . $sorted_subs[$i]->{'lines'} . ')' . + ' McCabe(' . $sorted_subs[$i]->{'mccabe_complexity'} . ')' + ); + } + + #require Data::Dumper; + #diag( 'Summary Stats: ' . Data::Dumper::Dumper( $analysis->summary_stats ) ); + #diag( 'File Stats: ' . Data::Dumper::Dumper( $analysis->file_stats ) ); + } + } + } +} diff --git a/t/a_pod.t b/t/a_pod.t old file mode 100755 new file mode 100644 index 45420d5..45420d5 100644 diff --git a/t/a_pod_coverage.t b/t/a_pod_coverage.t old file mode 100755 new file mode 100644 index 49a5413..49a5413 100644 diff --git a/t/a_pod_spelling.t b/t/a_pod_spelling.t old file mode 100755 new file mode 100644 index 34230e4..d622cf7 100644 --- a/t/a_pod_spelling.t +++ b/t/a_pod_spelling.t @@ -13,8 +13,8 @@ if ( $@ ) { plan skip_all => 'Test::Spelling required to test POD for spelling errors'; } else { - # FIXME need to figure out how to add custom vocabulary to dictionary - all_pod_files_spelling_ok(); + #all_pod_files_spelling_ok(); + plan skip_all => 'need to figure out how to add custom vocabulary to dictionary'; } } } diff --git a/t/a_prereq.t b/t/a_prereq.t old file mode 100755 new file mode 100644 index a09eaed..4633fb9 100644 --- a/t/a_prereq.t +++ b/t/a_prereq.t @@ -6,10 +6,14 @@ if ( not $ENV{TEST_AUTHOR} ) { plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; } else { - eval "use Test::Prereq"; - if ( $@ ) { - plan skip_all => 'Test::Prereq required to test perl module deps'; + if ( not $ENV{PERL_TEST_PREREQ} ) { + plan skip_all => 'PREREQ test ( warning: LONG! ) Sent $ENV{PERL_TEST_PREREQ} to a true value to run.'; } else { - prereq_ok(); + eval "use Test::Prereq"; + if ( $@ ) { + plan skip_all => 'Test::Prereq required to test perl module deps'; + } else { + prereq_ok(); + } } } diff --git a/t/a_prereq_build.t b/t/a_prereq_build.t old file mode 100755 new file mode 100644 index 1ff111c..5b2df60 100644 --- a/t/a_prereq_build.t +++ b/t/a_prereq_build.t @@ -6,10 +6,14 @@ if ( not $ENV{TEST_AUTHOR} ) { plan skip_all => 'Author test. Sent $ENV{TEST_AUTHOR} to a true value to run.'; } else { - eval "use Test::Prereq::Build"; - if ( $@ ) { - plan skip_all => 'Test::Prereq required to test perl module deps'; + if ( not $ENV{PERL_TEST_PREREQ} ) { + plan skip_all => 'PREREQ test ( warning: LONG! ) Sent $ENV{PERL_TEST_PREREQ} to a true value to run.'; } else { - prereq_ok(); + eval "use Test::Prereq::Build"; + if ( $@ ) { + plan skip_all => 'Test::Prereq required to test perl module deps'; + } else { + prereq_ok(); + } } } diff --git a/t/a_strict.t b/t/a_strict.t old file mode 100755 new file mode 100644 index 021cb78..021cb78 100644 diff --git a/t/load.t b/t/load.t deleted file mode 100755 index 072a0da..0000000 --- a/t/load.t +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl - -use Test::More; - -# Import the stuff -eval "use Test::UseAllModules"; -if ( $@ ) { - plan skip_all => 'Test::UseAllModules required for verifying perl modules'; -} else { - all_uses_ok(); -}