protect against 5.005; declare prereq version.pm (thx slaven for test reports)
[acme-study-perl.git] / lib / Acme / Study / Perl.pm
blobf2c111f312a9d3c3d8204b81cb909a253bd557d1
1 package Acme::Study::Perl;
3 use warnings;
4 use strict;
5 require Data::Dumper;
6 use Test::Builder;
7 use Exporter;
8 use base 'Exporter';
9 our @EXPORT_OK = qw(studyperl);
11 =head1 NAME
13 Acme::Study::Perl - empirical studies about how perl behaves
15 =cut
17 use version; our $VERSION = qv('0.0.2');
19 =head1 SYNOPSIS
21 use Acme::Study::Perl qw(studyperl);
22 studyperl("your expression goes here", "optional comment");
24 =head1 DESCRIPTION
26 This module provides nothing that you cannot do yourself. Its focus
27 is the test suite. If cpantesters deliver what they promise, this
28 module's test suite can be used to study the behaviour of perl on
29 multiple platforms.
31 The single function C<studyperl> only does some trivial formatting
32 which will help deciphering the output of the testsuite.
34 =head1 EXPORT
36 =head1 FUNCTIONS
38 =head2 (void) studyperl ($expr, $comment)
40 Evals the expression and sends with the diag() command from Test::More
41 a terse Data::Dumper representation for STDERR.
43 So far we have defined four characters as hash keys per study:
45 # comment
46 < input
47 > output
48 @ error ($@)
50 We have configured Data::Dumpe to write one line and sort the keys
52 =cut
54 sub studyperl {
55 my($expr, $comment) = @_;
56 my $out = eval $expr;
57 my $err = $@;
58 my @err = $err ? ('@' => $err) : ();
59 my @comment = $comment ? ("#" => $comment) : ();
60 our $Test;
61 $Test ||= Test::Builder->new;
62 $Test->diag(Data::Dumper->new([{"<"=>$expr, ">"=>$out, @comment, @err}])
63 ->Sortkeys(1)->Indent(0)->Useqq(1)->Terse(1)->Dump);
64 return;
67 =head1 AUTHOR
69 Andreas König, C<< <andreas.koenig.7os6VVqR at franz.ak.mind.de> >>
71 =head1 BUGS
73 Please report any bugs or feature requests through the web interface
74 at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-Study-Perl>.
75 I will be notified, and then you'll automatically be notified of
76 progress on your bug as I make changes.
78 =head1 SUPPORT
80 You can find documentation for this module with the perldoc command.
82 perldoc Acme::Study::Perl
84 You can also look for information at:
86 =over 4
88 =item * RT: CPAN's request tracker
90 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme-Study-Perl>
92 =item * AnnoCPAN: Annotated CPAN documentation
94 L<http://annocpan.org/dist/Acme-Study-Perl>
96 =item * CPAN Ratings
98 L<http://cpanratings.perl.org/d/Acme-Study-Perl>
100 =item * Search CPAN
102 L<http://search.cpan.org/dist/Acme-Study-Perl>
104 =back
107 =head1 ACKNOWLEDGEMENTS
109 Thanks to RJBS for Module::Starter.
111 =head1 COPYRIGHT & LICENSE
113 Copyright 2008 Andreas König.
115 This program is free software; you can redistribute it and/or modify it
116 under the same terms as Perl itself.
119 =cut
121 1; # End of Acme::Study::Perl