From 643108d2a44a01a0b91da40ecee705118b6013a2 Mon Sep 17 00:00:00 2001 From: gaissmai Date: Mon, 9 Jul 2012 22:55:54 +0200 Subject: [PATCH] version 0.5, nearly CPAN ready --- Build.PL | 1 + Changes | 4 +- MANIFEST.SKIP | 2 + META.yml | 12 +-- MYMETA.yml | 8 +- README | 214 +++++++++++++++++++++++++++++++------- lib/Config/TT.pm | 266 +++++++++++++++++++++++++---------------------- t/02-basics.t | 7 +- t/03-global.t | 6 +- t/05-meta.t | 6 +- t/boilerplate.t | 51 +++++---- t/pod-coverage.t | 4 + t/pod.t | 4 + 13 files changed, 367 insertions(+), 218 deletions(-) diff --git a/Build.PL b/Build.PL index b292c44..5806b3b 100644 --- a/Build.PL +++ b/Build.PL @@ -7,6 +7,7 @@ my $builder = Module::Build->new( license => 'perl', dist_author => q{Karl Gaissmaier }, dist_version_from => 'lib/Config/TT.pm', + create_readme => 1, build_requires => { 'Test::More' => 0, }, requires => { 'Template' => '2.21', diff --git a/Changes b/Changes index df8e922..ca9beb5 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,5 @@ Revision history for Config-TT -0.01 Date/time - First version, released on an unsuspecting world. +0.50 Mon, 09 Jul 2012 22:08:38 +0200 + Prepare the CPAN upload after internal hacking diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index ead7453..5c5f2b2 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -29,6 +29,8 @@ \#$ \b\.# \.bak$ +^temp/ +^test/ # Avoid Devel::Cover files. \bcover_db\b diff --git a/META.yml b/META.yml index 238554a..e379668 100644 --- a/META.yml +++ b/META.yml @@ -1,5 +1,5 @@ --- -abstract: 'Config files' +abstract: 'Reading configuration files with the Template-Toolkit parser.' author: - 'Karl Gaissmaier ' build_requires: @@ -12,12 +12,10 @@ meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Config-TT -provides: - Config::TT: - file: lib/Config/TT.pm - version: 0.01 requires: - Template: 2.24 + Carp: 0 + Template: 2.21 + Try::Tiny: 0 resources: license: http://dev.perl.org/licenses/ -version: 0.01 +version: 0.50 diff --git a/MYMETA.yml b/MYMETA.yml index 7583fcd..409688b 100644 --- a/MYMETA.yml +++ b/MYMETA.yml @@ -1,5 +1,5 @@ --- -abstract: 'Config files' +abstract: 'Reading configuration files with the Template-Toolkit parser.' author: - 'Karl Gaissmaier ' build_requires: @@ -13,14 +13,10 @@ meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Config-TT -provides: - Config::TT: - file: lib/Config/TT.pm - version: 0.01 requires: Carp: 0 Template: 2.21 Try::Tiny: 0 resources: license: http://dev.perl.org/licenses/ -version: 0.01 +version: 0.50 diff --git a/README b/README index dd6392b..5bc361b 100644 --- a/README +++ b/README @@ -1,55 +1,199 @@ -Config-TT +NAME + Config::TT - Reading configuration files with the Template-Toolkit + parser. -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. +ABSTRACT + Define configuration files in the powerful, flexible and extensible + Template-Toolkit syntax. -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. +SYNOPSIS + use Config::TT; + my $ctt = Config::TT->new; + my $stash = $ctt->process($file); -INSTALLATION +DESCRIPTION + "Config::TT" extends the "Template-Toolkit" aka "TT" in a very special + way: -To install this module, run the following commands: + It returns the VARIABLES STASH instead of the template text! - perl Build.PL - ./Build - ./Build test - ./Build install + The TT syntax is very powerful, flexible and extensible. One of the key + features of TT is the ability to bind template variables to any kind of + Perl data: scalars, lists, hash arrays, sub-routines and objects. -SUPPORT AND DOCUMENTATION + e.g. this Template-Toolkit config -After installing, you can find documentation for this module with the -perldoc command. + [% # tt2 directive start-tag + scalar = 'string' # strings in single or double quotes - perldoc Config::TT + array = [ 10 20 30 ] # commas are optional + rev = array.reverse # powerful virtual methods + item = array.0 # interpolate previous value -You can also look for information at: + hash = { foo = 'bar' # hashes to any depth + moo = array # points to above arrayref + } + %] - RT, CPAN's request tracker (report bugs here) - http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-TT + is returned as a perl datastructure: - AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/Config-TT + 'scalar' => 'string' + 'array' => ARRAY(0x8ad2708) + 0 10 + 1 20 + 2 30 + 'rev' => ARRAY(0x8afe740) + 0 30 + 1 20 + 2 10 + 'item' => 10 + 'hash' => HASH(0x8afe160) + 'foo' => 'bar' + 'moo' => ARRAY(0x8ad2708) + -> REUSED_ADDRESS - CPAN Ratings - http://cpanratings.perl.org/d/Config-TT + See the Template::Manuals for the whole story. - Search CPAN - http://search.cpan.org/dist/Config-TT/ +METHODS + new(%config) + The "new()" constructor method instantiates a new "Config::TT" object. + This method croaks on error. + Configuration items may be passed as a list of items or a hash array: -LICENSE AND COPYRIGHT + my $ctt = Template->new( + ABSOLUTE => 0, + DEBUG => 'all', + ); + + The supported configuration options are the same as for "Template", + please see the Template::Manual::Config as a reference and the + LIMITATIONS section below. + + The preset default options which differ from the Template default + options are: + + STRICT = 1 # undefined vars or values cause exceptions + ABSOLUTE = 1 # files with absolute filenames allowed + RELATIVE = 1 # files with relative filenames allowed + CACHE_SIZE = 0 # don't cache compiled config files + + process($config, $variables) + The "process()" method is called to process a config file or string. The + first parameter indicates the input as one of: a filename; a reference + to a text string containing the config text; or a file handle reference, + from which the config can be read. + + A reference to a hash array may be passed as the second parameter, + containing definitions of input variables. + + $stash = $ctt->process( '.myapp.cfg', { foo => $ENV{MYAPP_FOO}, } ); + + The returned datastructure is a "Template::Stash" object. You may access + the key and values through normal perl dereferencing: + + $item = $stash->{hash}{moo}[0]; + + or via the "Template::Stash->get" method like: + + $item = $stash->get('hash.moo.0'); + + For debugging purposes you can even request the template output from the + process method: + + ($stash, $output) = $ctt->process( $config ); + +LIMITATIONS + The Template-Toolkit processor uses the toplevel variables "template" + und "component" for meta information during template file processing. + You MUST NOT define or redefine these toplevel variables at object + creation, processing or within the config files. + + The "process" method purges these toplevel variables unconditionally + after processing but before returning the stash. + + See also the special meaning of the "global" toplevel variable. + + Successive calls to "process" with the same Config::TT instance MUST be + avoided. The Template CONTEXT and STASH have states belonging to the + processed config text. Create new instances for different "process" + calls. + + $stash1 = Config::TT->new->process($file1); + $stash2 = Config::TT->new->process($file2); + + The following Template options are not supported with Config::TT: -Copyright (C) 2012 Karl Gaissmaier + PRE_PROCESS + PROCESS + POST_PROCESS + WRAPPER + AUTO_RESET + DEFAULT + OUTPUT + OUTPUT_PATH + ERROR + ERRORS + +EXTENSIBILITY + context() + This is a setter/getter method to access/change the underlying + Template::Context object of the Config::TT instance. Through the context + you can also access the stash and do weird things. + + $ctt = Config::TT->new; + $stash = $ctt->context->stash; + + $stash->define_vmethod($type, $name, $code); + + See the manuals Template::Stash, Template::Context and + Template::Manual::Internals. + +SEE ALSO + Template::Manual::Intro, Template::Manual::Syntax, + Template::Manual::Config, Template::Manual::Variables, + Template::Manual::VMethods + +AUTHOR + Karl Gaissmaier, "" + +BUGS + Please report any bugs or feature requests to "bug-config-tt at + rt.cpan.org", or through the web interface at + . I will be + notified, and then you'll automatically be notified of progress on your + bug as I make changes. + +SUPPORT + You can find documentation for this module with the perldoc command. + + perldoc Config::TT + + You can also look for information at: + + * RT: CPAN's request tracker (report bugs here) + + + + * AnnoCPAN: Annotated CPAN documentation + + + + * CPAN Ratings + + + + * Search CPAN + + + +LICENSE AND COPYRIGHT + Copyright 2012 Karl Gaissmaier. -This program is free software; you can redistribute it and/or modify it -under the terms of either: the GNU General Public License as published -by the Free Software Foundation; or the Artistic License. + This program is free software; you can redistribute it and/or modify it + under the terms of either: the GNU General Public License as published + by the Free Software Foundation; or the Artistic License. -See http://dev.perl.org/licenses/ for more information. + See http://dev.perl.org/licenses/ for more information. diff --git a/lib/Config/TT.pm b/lib/Config/TT.pm index 145c095..351206f 100644 --- a/lib/Config/TT.pm +++ b/lib/Config/TT.pm @@ -4,95 +4,20 @@ use warnings; package Config::TT; use Template; +use Template::Config; use Try::Tiny; use Carp qw(croak); +our $VERSION = '0.50'; + =head1 NAME Config::TT - Reading configuration files with the Template-Toolkit parser. -=head1 VERSION - -Version 0.01 - -=cut - -our $VERSION = '0.01'; - -=head1 SYNOPSIS - - use Config::TT; - - my $ctt = Config::TT->new; - my $stash = $ctt->process($file); - =head1 ABSTRACT Define configuration files in the powerful, flexible and extensible Template-Toolkit syntax. -=head1 DESCRIPTION - -C<< Config::TT >> extends the C<< Template-Toolkit >> aka C<< TT >> in a very special way: - -It returns the B<< VARIABLES STASH >> instead of the template text! - -The TT syntax is very powerful, flexible and extensible. One of the key features of TT is the ability to bind template variables to any kind of Perl data: scalars, lists, hash arrays, sub-routines and objects. - -e.g. this Template-Toolkit config - - [% # tt2 directive start-tag - scalar = 'string' # strings in single or double quotes - - array = [ 10 20 30 ] # commas are optional - rev = array.reverse # powerful virtual methods - item = array.0 # interpolate previous value - - hash = { foo = 'bar' # hashes to any depth - moo = array # points to above arrayref - } - %] - -is returned as a perl datastructure: - - 'scalar' => 'string' - 'array' => ARRAY(0x8ad2708) - 0 10 - 1 20 - 2 30 - 'rev' => ARRAY(0x8afe740) - 0 30 - 1 20 - 2 10 - 'item' => 10 - 'hash' => HASH(0x8afe160) - 'foo' => 'bar' - 'moo' => ARRAY(0x8ad2708) - -> REUSED_ADDRESS - -See the L<< Template::Manuals >> for the whole story. - -=head1 METHODS - -=head2 new(%config) - -The C<< new() >> constructor method instantiates a new C object. This method croaks on error. - -Configuration items may be passed as a list of items or a hash array: - - my $ctt = Template->new( - ABSOLUTE => 0, - DEBUG => 'all', - ); - -The supported configuration options are the same as for C<< Template >>, please see the L<< Template::Manual::Config >> as a reference and the COMPATIBILITY section below. - -The preset default options which differ from the Template default options are: - - STRICT = 1 # undefined vars or values cause exceptions - ABSOLUTE = 1 # files with absolute filenames allowed - RELATIVE = 1 # files with relative filenames allowed - CACHE_SIZE = 0 # don't cache compiled config files - =cut sub new { @@ -127,61 +52,33 @@ sub new { # DEFAULTS, see Template::Manual::Config # my $defaults = { - STRICT => 1, - ABSOLUTE => 1, - RELATIVE => 1, - CACHE_SIZE => 0, + STRICT => 1, + ABSOLUTE => 1, + RELATIVE => 1, + CACHE_SIZE => 0, }; - # override defaults by params my $self = bless { _PARAMS => { %$defaults, %$params } }, $class; - $self->_build; - - return $self; -} - -sub _build { - my $self = shift; - my $tt = Template->new( $self->{_PARAMS} ) || croak "$Template::ERROR\n"; - # our entry level is Template::Context - $self->{_CONTEXT} = $tt->service->context; + # our entry level into TT is Template::Context to get the stash back + $self->context($tt->service->context); return $self; } -=head2 process($config, $variables) - -The C<< process() >> method is called to process a config file or string. The first parameter indicates the input as one of: a filename; a reference to a text string containing the config text; or a file handle reference, from which the config can be read. - -A reference to a hash array may be passed as the second parameter, containing definitions of input variables. - - $stash = $ctt->process( '.myapp.cfg', { foo => $ENV{MYAPP_FOO}, } ); - -The returned datastructure is a C<< Template::Stash >> object. You may access the key and values through normal perl dereferencing: - - $item = $stash->{hash}{moo}[0]; - -or via the C<< Template::Stash->get >> method like: - - $item = $stash->get('hash.moo.0'); - -For debugging purposes you can even request the template output from the process method: - - ($stash, $output) = $ctt->process( $config ); - -=cut +sub context { + my ( $self, $ctx ) = @_; + $self->{_CONTEXT} = $ctx if defined $ctx; + return $self->{_CONTEXT}; +} sub process { my ( $self, $template, $vars ) = @_; - # create new Template ... objects for every process() - $self->_build; - - my $ctx = $self->{_CONTEXT}; + my $ctx = $self->context; my $stash = $ctx->stash; # @@ -195,7 +92,7 @@ sub process { $stash->update( { template => $compiled } ); $stash->update($vars) if defined $vars; - $output = $compiled->process( $ctx ); + $output = $compiled->process($ctx); } catch { $error = $_ }; croak "$error" if $error; @@ -219,7 +116,14 @@ sub _purge_stash { dec ); - my $stash = $self->{_CONTEXT}->stash; + my $stash = $self->context->stash; + + if ( $stash->{_DEBUG} ) { + my $pkg = __PACKAGE__; + + warn "[${pkg}::_purge_stash] purging keys:\n"; + warn join( ', ', @purge_keys ) . "\n"; + } foreach my $key (@purge_keys) { @@ -235,7 +139,108 @@ sub _purge_stash { } } -=head1 COMPATIBILITY +=head1 SYNOPSIS + + use Config::TT; + + my $ctt = Config::TT->new; + my $stash = $ctt->process($file); + +=head1 DESCRIPTION + +C<< Config::TT >> extends the C<< Template-Toolkit >> aka C<< TT >> in a very special way: + +It returns the B<< VARIABLES STASH >> instead of the template text! + +The TT syntax is very powerful, flexible and extensible. One of the key features of TT is the ability to bind template variables to any kind of Perl data: scalars, lists, hash arrays, sub-routines and objects. + +e.g. this Template-Toolkit config + + [% # tt2 directive start-tag + scalar = 'string' # strings in single or double quotes + + array = [ 10 20 30 ] # commas are optional + rev = array.reverse # powerful virtual methods + item = array.0 # interpolate previous value + + hash = { foo = 'bar' # hashes to any depth + moo = array # points to above arrayref + } + %] + +is returned as a perl datastructure: + + 'scalar' => 'string' + 'array' => ARRAY(0x8ad2708) + 0 10 + 1 20 + 2 30 + 'rev' => ARRAY(0x8afe740) + 0 30 + 1 20 + 2 10 + 'item' => 10 + 'hash' => HASH(0x8afe160) + 'foo' => 'bar' + 'moo' => ARRAY(0x8ad2708) + -> REUSED_ADDRESS + +See the L<< Template::Manuals >> for the whole story. + +=head1 METHODS + +=head2 new(%config) + +The C<< new() >> constructor method instantiates a new C object. This method croaks on error. + +Configuration items may be passed as a list of items or a hash array: + + my $ctt = Template->new( + ABSOLUTE => 0, + DEBUG => 'all', + ); + +The supported configuration options are the same as for C<< Template >>, please see the L<< Template::Manual::Config >> as a reference and the LIMITATIONS section below. + +The preset default options which differ from the Template default options are: + + STRICT = 1 # undefined vars or values cause exceptions + ABSOLUTE = 1 # files with absolute filenames allowed + RELATIVE = 1 # files with relative filenames allowed + CACHE_SIZE = 0 # don't cache compiled config files + +=head2 process($config, $variables) + +The C<< process() >> method is called to process a config file or string. The first parameter indicates the input as one of: a filename; a reference to a text string containing the config text; or a file handle reference, from which the config can be read. + +A reference to a hash array may be passed as the second parameter, containing definitions of input variables. + + $stash = $ctt->process( '.myapp.cfg', { foo => $ENV{MYAPP_FOO}, } ); + +The returned datastructure is a C<< Template::Stash >> object. You may access the key and values through normal perl dereferencing: + + $item = $stash->{hash}{moo}[0]; + +or via the C<< Template::Stash->get >> method like: + + $item = $stash->get('hash.moo.0'); + +For debugging purposes you can even request the template output from the process method: + + ($stash, $output) = $ctt->process( $config ); + +=head1 LIMITATIONS + +The Template-Toolkit processor uses the toplevel variables C<< template >> und C<< component >> for meta information during template file processing. You B<< MUST NOT >> define or redefine these toplevel variables at object creation, processing or within the config files. + +The C<< process >> method purges these toplevel variables unconditionally after processing but before returning the stash. + +See also the special meaning of the C<< global >> toplevel variable. + +Successive calls to C<< process >> with the same Config::TT instance B<< MUST >> be avoided. The Template CONTEXT and STASH have states belonging to the processed config text. Create new instances for different C<< process >> calls. + + $stash1 = Config::TT->new->process($file1); + $stash2 = Config::TT->new->process($file2); The following Template options are not supported with Config::TT: @@ -250,6 +255,20 @@ The following Template options are not supported with Config::TT: ERROR ERRORS +=head1 EXTENSIBILITY + + +=head2 context() + +This is a setter/getter method to access/change the underlying Template::Context object of the Config::TT instance. Through the context you can also access the stash and do weird things. + + $ctt = Config::TT->new; + $stash = $ctt->context->stash; + + $stash->define_vmethod($type, $name, $code); + +See the manuals L<< Template::Stash >>, L<< Template::Context >> and L<< Template::Manual::Internals >>. + =head1 SEE ALSO L<< Template::Manual::Intro >>, L<< Template::Manual::Syntax >>, L<< Template::Manual::Config >>, L<< Template::Manual::Variables >>, L<< Template::Manual::VMethods >> @@ -293,10 +312,6 @@ L =back - -=head1 ACKNOWLEDGEMENTS - - =head1 LICENSE AND COPYRIGHT Copyright 2012 Karl Gaissmaier. @@ -307,7 +322,6 @@ by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. - =cut 1; # End of Config::TT diff --git a/t/02-basics.t b/t/02-basics.t index a83f5c2..9d732bf 100644 --- a/t/02-basics.t +++ b/t/02-basics.t @@ -6,12 +6,6 @@ BEGIN { use_ok('Config::TT') || print "Bail out!\n"; } -my $tcfg; -my $stash; - -$tcfg = Config::TT->new; -isa_ok( $tcfg, 'Config::TT' ); - my $tests = [ { name => 'simple scalar', @@ -45,6 +39,7 @@ my $tests = [ ]; foreach my $test (@$tests) { + my $tcfg = Config::TT->new; my $stash = $tcfg->process( \$test->{cfg}, $test->{vars} ); delete $stash->{global}; diff --git a/t/03-global.t b/t/03-global.t index 447e512..39ca158 100644 --- a/t/03-global.t +++ b/t/03-global.t @@ -7,11 +7,6 @@ BEGIN { use_ok('Config::TT') || print "Bail out!\n"; } -my $tcfg; -my $stash; - -$tcfg = Config::TT->new; - my $tests = [ { name => 'used global as scalar', @@ -44,6 +39,7 @@ my $tests = [ ]; foreach my $test (@$tests) { + my $tcfg = Config::TT->new; my $stash = $tcfg->process( \$test->{cfg}, $test->{vars} ); is_deeply( $stash, $test->{expect}, $test->{name} ); } diff --git a/t/05-meta.t b/t/05-meta.t index b566c02..7a591b4 100644 --- a/t/05-meta.t +++ b/t/05-meta.t @@ -7,11 +7,6 @@ BEGIN { use_ok('Config::TT') || print "Bail out!\n"; } -my $tcfg; -my $stash; - -$tcfg = Config::TT->new(); - my $tests = [ { name => 'set template.title via META', @@ -36,6 +31,7 @@ my $tests = [ ]; foreach my $test (@$tests) { + my $tcfg = Config::TT->new(); my $stash = $tcfg->process( \$test->{cfg}, $test->{vars} ); delete $stash->{global}; diff --git a/t/boilerplate.t b/t/boilerplate.t index 1848e54..33461a2 100644 --- a/t/boilerplate.t +++ b/t/boilerplate.t @@ -3,19 +3,24 @@ use 5.006; use strict; use warnings; -use Test::More tests => 3; +use Test::More; + +# Don't run tests during end-user installs +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} sub not_in_file_ok { - my ($filename, %regex) = @_; + my ( $filename, %regex ) = @_; open( my $fh, '<', $filename ) - or die "couldn't open $filename for reading: $!"; + 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}||=[]}, $.; + while ( my $line = <$fh> ) { + while ( my ( $desc, $regex ) = each %regex ) { + if ( $line =~ $regex ) { + push @{ $violated{$desc} ||= [] }, $.; } } } @@ -23,34 +28,28 @@ sub not_in_file_ok { if (%violated) { fail("$filename contains boilerplate text"); diag "$_ appears on lines @{$violated{$_}}" for keys %violated; - } else { + } + 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]/, + 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( + 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) - ); +not_in_file_ok( Changes => "placeholder date/time" => qr(Date/time) ); - module_boilerplate_ok('lib/Config/TT.pm'); - - -} +module_boilerplate_ok('lib/Config/TT.pm'); +done_testing(); diff --git a/t/pod-coverage.t b/t/pod-coverage.t index fc40a57..021e8fc 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -2,6 +2,10 @@ use strict; use warnings; use Test::More; +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; diff --git a/t/pod.t b/t/pod.t index ee8b18a..506aef0 100644 --- a/t/pod.t +++ b/t/pod.t @@ -4,6 +4,10 @@ use strict; use warnings; use Test::More; +unless ( $ENV{AUTOMATED_TESTING} or $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp";