Skip to content

Commit

Permalink
Generate pod with Build.PL
Browse files Browse the repository at this point in the history
  • Loading branch information
dann committed Mar 13, 2012
1 parent f72ced6 commit 92591cc
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 20 deletions.
26 changes: 24 additions & 2 deletions Build.PL
Expand Up @@ -2,7 +2,27 @@ use strict;
use warnings FATAL => 'all';
use Module::Build;

my $build = Module::Build->new(
my $class = Module::Build->subclass(
class => 'My::Builder',
code => q{
sub ACTION_docs {
use Pod::Readme;
use Pod::Select;
my $self = shift;
podselect({ -output => 'README.pod' },
'lib/Test/Perl/Metrics/Lite.pm');
my $parser = Pod::Readme->new();
$parser->parse_from_file('README.pod', 'README');
return $self->SUPER::ACTION_docs;
}
}
);

my $build = $class->new(
name => 'Test-Perl-Metrics-Lite',
module_name => 'Test::Perl::Metrics::Lite',
dist_author => 'Dann',
Expand All @@ -26,7 +46,9 @@ my $build = Module::Build->new(
create_readme => 1,
create_license => 1,
meta_merge => {
resources => { 'repository' => 'http://github.com/dann/p5-test-perl-metrics-lite', }
resources => {
'repository' => 'http://github.com/dann/p5-test-perl-metrics-lite'
}
},
);
$build->create_build_script();
52 changes: 37 additions & 15 deletions README
@@ -1,27 +1,49 @@
This is Perl module Test::Perl::Metrics::Lite.
NAME
Test::Perl::Metrics::Lite - Use Perl::Metrics::Lite in test programs

INSTALLATION
SYNOPSIS
Basic usage.

Test::Perl::Metrics::Lite installation is straightforward. If your CPAN shell is set up,
you should just be able to do
use Test::Perl::Metrics::Lite;
all_metrics_ok();

% cpan Test::Perl::Metrics::Lite
You can change the metrics threshold.

Download it, unpack it, then build it as per the usual:
use Test::Perl::Metrics::Lite (-mccabe_complexity => 20, -loc => 100);
all_metrics_ok();

% perl Makefile.PL
% make && make test
Exclude some files with except_file option

Then install it:
use Test::Perl::Metrics::Lite (
-except_file => [
'lib/SomeClass.pm',
'lib/SomeDir/SomeClass.pm'
]
);
all_metrics_ok();

% make install
DESCRIPTION
Test::Perl::Metrics::Lite wraps the Perl::Metrics::Lite engine in a
convenient subroutine suitable for test programs written using the
Test::More framework

DOCUMENTATION
This makes it easy to integrate metrics enforcement into the build
process.

Test::Perl::Metrics::Lite documentation is available as in POD. So you can do:
Mccabe complexity theshold is 10 and the lines of code theshold is 60.
all_metrics_ok() test is failed when metrics exceed threshold values
relative to the baseline.

% perldoc Test::Perl::Metrics::Lite
SOURCE AVAILABILITY
This source is in Github:

to read the documentation online with your favorite pager.
http://github.com/dann/p5-test-perl-metrics-lite

AUTHOR
Dann <techmemo@gmail.com>

SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

Dann
3 changes: 0 additions & 3 deletions README.pod
Expand Up @@ -57,6 +57,3 @@ Dann E<lt>techmemo@gmail.comE<gt>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.


=cut

0 comments on commit 92591cc

Please sign in to comment.