8.4. Getting rid of the boilerplate

The skeleton of the distribution generated by Module-Starter contains some boilerplate, which is pre-included text and code, used as placeholders. That should be replaced by more meaningful one by the programmer who is writing the distribution.

Luckily, it also generates a script on t/boilerplate.t that checks for that boilerplate and reports it. However, the tests there are marked as TODO tests, whose failure status is ignored by default. To turn off their TODO status, open t/boilerplate.t in your text editor and remove or comment-out the following line

  local $TODO = "Need to replace the boilerplate text";

After we do that, we get some test failures when running ./Build test:

$ ./Build test
t/00-load.t ....... 1/5 # Testing MyMath::Ops 0.01, Perl 5.014002, /usr/bin/perl5.14.2
t/00-load.t ....... ok
t/add.t ........... ok
t/boilerplate.t ... 1/7
#   Failed test 'README contains boilerplate text'
#   at t/boilerplate.t line 23.
# The README is used... appears on lines 3
# 'version information here' appears on lines 11

#   Failed test 'Changes contains boilerplate text'
#   at t/boilerplate.t line 23.
# placeholder date/time appears on lines 3

#   Failed test 'lib/MyMath/Ops.pm contains boilerplate text'
#   at t/boilerplate.t line 23.
# stub function definition appears on lines 37 41 44 48
# boilerplate description appears on lines 21
# the great new $MODULENAME appears on lines 8

#   Failed test 'lib/MyMath/Ops/Add.pm contains boilerplate text'
#   at t/boilerplate.t line 23.
# stub function definition appears on lines 74 78 81 85
# boilerplate description appears on lines 20
# the great new $MODULENAME appears on lines 8

#   Failed test 'lib/MyMath/Ops/Multiply.pm contains boilerplate text'
#   at t/boilerplate.t line 23.
# stub function definition appears on lines 37 41 44 48
# boilerplate description appears on lines 21
# the great new $MODULENAME appears on lines 8

#   Failed test 'lib/MyMath/Ops/Subtract.pm contains boilerplate text'
#   at t/boilerplate.t line 23.
# stub function definition appears on lines 37 41 44 48
# boilerplate description appears on lines 21
# the great new $MODULENAME appears on lines 8

#   Failed test 'lib/MyMath/Ops/Divide.pm contains boilerplate text'
#   at t/boilerplate.t line 23.
# stub function definition appears on lines 37 41 44 48
# boilerplate description appears on lines 21
# the great new $MODULENAME appears on lines 8
# Looks like you failed 7 tests of 7.
t/boilerplate.t ... Dubious, test returned 7 (wstat 1792, 0x700)
Failed 7/7 subtests
t/pod-coverage.t .. ok
t/pod.t ........... ok

Test Summary Report
-------------------
t/boilerplate.t (Wstat: 1792 Tests: 7 Failed: 7)
  Failed tests:  1-7
  Non-zero exit status: 7
Files=5, Tests=24,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.15 cusr  0.02 csys =  0.21 CPU)
Result: FAIL
Failed 1/5 test programs. 7/24 subtests failed.

Fixing them is left as an exercise for the reader.


Written by Shlomi Fish