From 5adb3e1daaa42cedbd5f25ba300ca4e1ffcb3a44 Mon Sep 17 00:00:00 2001 From: "Andreas J. Koenig" Date: Sun, 19 Oct 2008 14:17:19 +0200 Subject: [PATCH] initial --- .gitignore | 10 ++++ .gitignore~ | 10 ++++ Changes | 5 ++ MANIFEST | 9 ++++ MANIFEST~ | 8 ++++ Makefile.PL | 26 +++++++++++ Makefile.PL~ | 16 +++++++ README | 44 ++++++++++++++++++ README~ | 52 +++++++++++++++++++++ lib/Acme/Study/Perl.pm | 121 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/Acme/Study/Perl.pm~ | 107 ++++++++++++++++++++++++++++++++++++++++++ t/00-load.t | 9 ++++ t/pod-coverage.t | 18 +++++++ t/pod.t | 12 +++++ t/studyperl.t | 18 +++++++ t/studyperl.t~ | 55 ++++++++++++++++++++++ 16 files changed, 520 insertions(+) create mode 100644 .gitignore create mode 100644 .gitignore~ create mode 100644 Changes create mode 100644 MANIFEST create mode 100644 MANIFEST~ create mode 100644 Makefile.PL create mode 100644 Makefile.PL~ create mode 100644 README create mode 100644 README~ create mode 100644 lib/Acme/Study/Perl.pm create mode 100644 lib/Acme/Study/Perl.pm~ create mode 100644 t/00-load.t create mode 100644 t/pod-coverage.t create mode 100644 t/pod.t create mode 100644 t/studyperl.t create mode 100644 t/studyperl.t~ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6848deb --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +blib* +Makefile +Makefile.old +Build +_build* +pm_to_blib* +*.tar.gz +.lwpcookies +Acme-Study-Perl-* +cover_db diff --git a/.gitignore~ b/.gitignore~ new file mode 100644 index 0000000..6848deb --- /dev/null +++ b/.gitignore~ @@ -0,0 +1,10 @@ +blib* +Makefile +Makefile.old +Build +_build* +pm_to_blib* +*.tar.gz +.lwpcookies +Acme-Study-Perl-* +cover_db diff --git a/Changes b/Changes new file mode 100644 index 0000000..b2dc69f --- /dev/null +++ b/Changes @@ -0,0 +1,5 @@ +Revision history for Acme-Study-Perl + +0.01 Date/time + First version, released on an unsuspecting world. + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..f16d598 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,9 @@ +Changes +MANIFEST +Makefile.PL +README +lib/Acme/Study/Perl.pm +t/00-load.t +t/pod-coverage.t +t/pod.t +t/studyperl.t diff --git a/MANIFEST~ b/MANIFEST~ new file mode 100644 index 0000000..66918a0 --- /dev/null +++ b/MANIFEST~ @@ -0,0 +1,8 @@ +Changes +MANIFEST +Makefile.PL +README +lib/Acme/Study/Perl.pm +t/00-load.t +t/pod-coverage.t +t/pod.t diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..99d463a --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,26 @@ +use strict; +use warnings; +use ExtUtils::MakeMaker; +$ExtUtils::MakeMaker::VERSION =~ s/_//g; +my @sign = (MM->can("signature_target") ? (SIGN => 1) : ()); + +WriteMakefile + ( + NAME => 'Acme::Study::Perl', + AUTHOR => 'Andreas König ', + VERSION_FROM => 'lib/Acme/Study/Perl.pm', + ABSTRACT_FROM => 'lib/Acme/Study/Perl.pm', + PL_FILES => {}, + PREREQ_PM => { + 'Data::Dumper' => 0, + 'Test::More' => 0, + }, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'Acme-Study-Perl-*' }, + ($ExtUtils::MakeMaker::VERSION >= 6.4502 ? + (META_ADD => { + # write: git push git+ssh://repo.or.cz/srv/git/XXX.git master + repository => "git://repo.or.cz/XXX.git", + }) : ()), + @sign, + ); diff --git a/Makefile.PL~ b/Makefile.PL~ new file mode 100644 index 0000000..4e540f7 --- /dev/null +++ b/Makefile.PL~ @@ -0,0 +1,16 @@ +use strict; +use warnings; +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => 'Acme::Study::Perl', + AUTHOR => 'Andreas König ', + VERSION_FROM => 'lib/Acme/Study/Perl.pm', + ABSTRACT_FROM => 'lib/Acme/Study/Perl.pm', + PL_FILES => {}, + PREREQ_PM => { + 'Test::More' => 0, + }, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'Acme-Study-Perl-*' }, +); diff --git a/README b/README new file mode 100644 index 0000000..bcb536d --- /dev/null +++ b/README @@ -0,0 +1,44 @@ +Acme-Study-Perl + +This module's test suite can be used to study the behaviour of perl on +multiple platforms. + +INSTALLATION + +You will normally not be interested to install this module. But if you +insist: 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 Acme::Study::Perl + +You can also look for information at: + + RT, CPAN's request tracker + http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-Study-Perl + + AnnoCPAN, Annotated CPAN documentation + http://annocpan.org/dist/Acme-Study-Perl + + CPAN Ratings + http://cpanratings.perl.org/d/Acme-Study-Perl + + Search CPAN + http://search.cpan.org/dist/Acme-Study-Perl + + +COPYRIGHT AND LICENCE + +Copyright (C) 2008 Andreas König + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + diff --git a/README~ b/README~ new file mode 100644 index 0000000..15438ff --- /dev/null +++ b/README~ @@ -0,0 +1,52 @@ +Acme-Study-Perl + +The README is used to introduce the module and provide instructions on +how to install the module, any machine dependencies it may have (for +example C compilers and installed libraries) and any other information +that should be provided before the module is installed. + +A README file is required for CPAN modules since CPAN extracts the README +file from a module distribution so that people browsing the archive +can use it to get an idea of the module's uses. It is usually a good idea +to provide version information here so that people can decide whether +fixes for the module are worth downloading. + + +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 Acme::Study::Perl + +You can also look for information at: + + RT, CPAN's request tracker + http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-Study-Perl + + AnnoCPAN, Annotated CPAN documentation + http://annocpan.org/dist/Acme-Study-Perl + + CPAN Ratings + http://cpanratings.perl.org/d/Acme-Study-Perl + + Search CPAN + http://search.cpan.org/dist/Acme-Study-Perl + + +COPYRIGHT AND LICENCE + +Copyright (C) 2008 Andreas König + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + diff --git a/lib/Acme/Study/Perl.pm b/lib/Acme/Study/Perl.pm new file mode 100644 index 0000000..bfd51e0 --- /dev/null +++ b/lib/Acme/Study/Perl.pm @@ -0,0 +1,121 @@ +package Acme::Study::Perl; + +use warnings; +use strict; +require Data::Dumper; +use Test::Builder; +use Exporter; +use base 'Exporter'; +our @EXPORT_OK = qw(studyperl); + +=head1 NAME + +Acme::Study::Perl - empirical studies about how perl behaves + +=cut + +use version; our $VERSION = qv('0.0.1'); + +=head1 SYNOPSIS + + use Acme::Study::Perl qw(studyperl); + studyperl("your expression goes here", "optional comment"); + +=head1 DESCRIPTION + +This module provides nothing that you cannot do yourself. Its focus +is the test suite. If cpantesters deliver what they promise, this +module's test suite can be used to study the behaviour of perl on +multiple platforms. + +The single function C only does some trivial formatting +which will help deciphering the output of the testsuite. + +=head1 EXPORT + +=head1 FUNCTIONS + +=head2 (void) studyperl ($expr, $comment) + +Evals the expression and sends with the diag() command from Test::More +a terse Data::Dumper representation for STDERR. + +So far we have defined four characters as hash keys per study: + + # comment + < input + > output + @ error ($@) + +We have configured Data::Dumpe to write one line and sort the keys + +=cut + +sub studyperl { + my($expr, $comment) = @_; + my $out = eval $expr; + my $err = $@; + my @err = $err ? ('@' => $err) : (); + my @comment = $comment ? ("#" => $comment) : (); + our $Test; + $Test ||= Test::Builder->new; + $Test->diag(Data::Dumper->new([{"<"=>$expr, ">"=>$out, @comment, @err}]) + ->Sortkeys(1)->Indent(0)->Useqq(1)->Terse(1)->Dump); + return; +} + +=head1 AUTHOR + +Andreas König, C<< >> + +=head1 BUGS + +Please report any bugs or feature requests through the web interface +at L. +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 Acme::Study::Perl + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L + +=item * AnnoCPAN: Annotated CPAN documentation + +L + +=item * CPAN Ratings + +L + +=item * Search CPAN + +L + +=back + + +=head1 ACKNOWLEDGEMENTS + +Thanks to RJBS for Module::Starter. + +=head1 COPYRIGHT & LICENSE + +Copyright 2008 Andreas König. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + + +=cut + +1; # End of Acme::Study::Perl diff --git a/lib/Acme/Study/Perl.pm~ b/lib/Acme/Study/Perl.pm~ new file mode 100644 index 0000000..c0db93f --- /dev/null +++ b/lib/Acme/Study/Perl.pm~ @@ -0,0 +1,107 @@ +package Acme::Study::Perl; + +use warnings; +use strict; + +=head1 NAME + +Acme::Study::Perl - The great new Acme::Study::Perl! + +=head1 VERSION + +Version 0.01 + +=cut + +our $VERSION = '0.01'; + + +=head1 SYNOPSIS + +Quick summary of what the module does. + +Perhaps a little code snippet. + + use Acme::Study::Perl; + + my $foo = Acme::Study::Perl->new(); + ... + +=head1 EXPORT + +A list of functions that can be exported. You can delete this section +if you don't export anything, such as for a purely object-oriented module. + +=head1 FUNCTIONS + +=head2 function1 + +=cut + +sub function1 { +} + +=head2 function2 + +=cut + +sub function2 { +} + +=head1 AUTHOR + +Andreas König, C<< >> + +=head1 BUGS + +Please report any bugs or feature requests to C, or through +the web interface at L. 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 Acme::Study::Perl + + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L + +=item * AnnoCPAN: Annotated CPAN documentation + +L + +=item * CPAN Ratings + +L + +=item * Search CPAN + +L + +=back + + +=head1 ACKNOWLEDGEMENTS + + +=head1 COPYRIGHT & LICENSE + +Copyright 2008 Andreas König, all rights reserved. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + + +=cut + +1; # End of Acme::Study::Perl diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..37c63bc --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,9 @@ +#!perl -T + +use Test::More tests => 1; + +BEGIN { + use_ok( 'Acme::Study::Perl' ); +} + +diag( "Testing Acme::Study::Perl $Acme::Study::Perl::VERSION, Perl $], $^X" ); diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100644 index 0000000..fc40a57 --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); diff --git a/t/pod.t b/t/pod.t new file mode 100644 index 0000000..ee8b18a --- /dev/null +++ b/t/pod.t @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); diff --git a/t/studyperl.t b/t/studyperl.t new file mode 100644 index 0000000..3924ba9 --- /dev/null +++ b/t/studyperl.t @@ -0,0 +1,18 @@ +#!perl -T + +use strict; +use warnings; +use Test::More qw(no_plan); +use Acme::Study::Perl qw(studyperl); + +SKIP: { + diag("no tests in this file, only diagnostics"); + skip; +} + +diag("\n"); +studyperl(q{'123456789123456789.2' <=> '123456789123456790'}, "native big math float/int"); +studyperl(q{'123456789123456789.2' <=> '123456789123456790.0'}, "native big math float/float"); +studyperl(q{'123456789123456789' <=> '123456789123456790'}, "native big math int/int"); +studyperl(q{'123456789123456789123456789123456789' <=> '123456789123456789123456789123456790'}, "native big math int/int larger"); + diff --git a/t/studyperl.t~ b/t/studyperl.t~ new file mode 100644 index 0000000..840f0c5 --- /dev/null +++ b/t/studyperl.t~ @@ -0,0 +1,55 @@ +#!perl -T + +use strict; +use warnings; +use Test::More tests => 3; + +sub not_in_file_ok { + my ($filename, %regex) = @_; + open( my $fh, '<', $filename ) + or die "couldn't open $filename for reading: $!"; + + my %violated; + + while (my $line = <$fh>) { + while (my ($desc, $regex) = each %regex) { + if ($line =~ $regex) { + push @{$violated{$desc}||=[]}, $.; + } + } + } + + if (%violated) { + fail("$filename contains boilerplate text"); + diag "$_ appears on lines @{$violated{$_}}" for keys %violated; + } else { + pass("$filename contains no boilerplate text"); + } +} + +sub module_boilerplate_ok { + my ($module) = @_; + not_in_file_ok($module => + 'the great new $MODULENAME' => qr/ - The great new /, + 'boilerplate description' => qr/Quick summary of what the module/, + 'stub function definition' => qr/function[12]/, + ); +} + +TODO: { + local $TODO = "Need to replace the boilerplate text"; + + not_in_file_ok(README => + "The README is used..." => qr/The README is used/, + "'version information here'" => qr/to provide version information/, + ); + + not_in_file_ok(Changes => + "placeholder date/time" => qr(Date/time) + ); + + module_boilerplate_ok('lib/Acme/Study/Perl.pm'); + + +} + -- 2.11.4.GIT