The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<!-- BEGIN slide -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>t/boilerplate.t</title>
<meta name="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Spork v0.20" />
<link rel='icon' href='favicon.png' />
  <link rel="stylesheet" type="text/css" href="" />
<style type="text/css"><!--
/* BEGIN index.css */
hr {
    color: #202040;
    height: 0px;
    border-top: 0px;
    border-bottom: 3px #202040 ridge;
    border-left: 0px;
    border-right: 0px;
}

a:link {
    color: #123422;
    text-decoration: none;
}

a:visited {
    color: #123333;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    font-size: 24pt;
    margin: 6pt;
}

div p {
    font-size: 18pt;
    margin-top: 12pt;
    margin-bottom: 12pt;
    margin-left: 6pt;
    margin-right: 6pt;
}

small {
    font-size: 9pt;
    font-style: italic;
}

#topbar {
    background: lightblue;
    color: blue;
    position:absolute;
    right: 5px;
    left: 5px;
    top: 5px;
    height: 50px;
}

#bottombar {
    background: lightblue;
    color: blue;
    position: fixed;
    right: 5px;
    left: 5px;
    bottom: 5px;
    height: 50px;
    z-index: 0;
}

.top_spacer {
    height: 0px;
    margin: 0px 0px 0px 0px;
    padding: 1px 0px 0px 0px;
}

.spacer {
    bottom: 5px;
    height: 50px;
}

#content {
    background:#fff;
    margin-left: 20px;
    margin-right:20px;
    margin-top: 80px;
}


#logo {
    position: fixed;
    right: 40px;
    bottom: 51px;
    width: 130px;
    height: 150px;
    z-index:3;
    background-image: url(/logo.png);
    background-repeat: no-repeat;
}
/* END index.css */

--></style>
<script type="text/javascript">
// BEGIN controls.js
function nextSlide() {
    window.location = 'slide16.html';
}

function prevSlide() {
    window.location = 'slide14.html';
}

function indexSlide() {
    window.location = 'index.html';
}

function startSlide() {
    window.location = 'start.html';
}

function closeSlide() {
    window.close();
}

function handleKey(e) {
    var key;
    if (e == null) {
        // IE
        key = event.keyCode
    } 
    else {
        // Mozilla
        if (e.altKey || e.ctrlKey) {
            return true
        }
        key = e.which
    }
    switch(key) {
        case 8: prevSlide(); break
        case 13: nextSlide(); break
        case 32: nextSlide(); break
        case 81: closeSlide(); break
        case 105: indexSlide(); break
        case 110: nextSlide(); break
        case 112: prevSlide(); break
        case 115: startSlide(); break
        default: //xxx(e.which)
    }
}

document.onkeypress = handleKey
// END controls.js

</script>
</head>
<body>
<div id="topbar">
<table width='100%'>
<tr>
<td width="13%">CPAN</td>
<td align="center" width="73%">
    <a accesskey="s" href="start.html">Creating CPAN modules</a>
</td>
<td align="right" width="13%">
    #15
</td>
</tr>
</table>
</div>
<!-- END top -->

<div id="content">
<div class="top_spacer"></div>

<h1>t/boilerplate.t</h1>
<pre class="formatter_pre">#!perl -T

use strict;
use warnings;
use Test::More tests =&gt; 3;

sub not_in_file_ok {
    my &#40;$filename, %regex&#41; = @_;
    open my $fh, &#34;&lt;&#34;, $filename
        or die &#34;couldn&#39;t open $filename for reading: $!&#34;;

    my %violated;

    while &#40;my $line = &lt;$fh&gt;&#41; {
        while &#40;my &#40;$desc, $regex&#41; = each %regex&#41; {
            if &#40;$line =~ $regex&#41; {
                push @{$violated{$desc}||=[]}, $.;
            }
        }
    }

    if &#40;%violated&#41; {
        fail&#40;&#34;$filename contains boilerplate text&#34;&#41;;
        diag &#34;$_ appears on lines @{$violated{$_}}&#34; for keys %violated;
    } else {
        pass&#40;&#34;$filename contains no boilerplate text&#34;&#41;;
    }
}

not_in_file_ok&#40;README =&gt;
    &#34;The README is used...&#34;       =&gt; qr/The README is used/,
    &#34;&#39;version information here&#39;&#34;  =&gt; qr/to provide version information/,
&#41;;

not_in_file_ok&#40;Changes =&gt;
    &#34;placeholder date/time&#34;       =&gt; qr&#40;Date/time&#41;
&#41;;

sub module_boilerplate_ok {
    my &#40;$module&#41; = @_;
    not_in_file_ok&#40;$module =&gt;
        &#39;the great new $MODULENAME&#39;   =&gt; qr/ - The great new /,
        &#39;boilerplate description&#39;     =&gt; qr/Quick summary of what the module/,
        &#39;stub function definition&#39;    =&gt; qr/function[12]/,
    &#41;;
}

module_boilerplate_ok&#40;&#39;lib/Acme/CreatingCPANModules.pm&#39;&#41;;
</pre>

</div>
<!-- BEGIN bottom -->
<div id="bottombar">
<table width="100%">
<tr>
<td align="left" valign="middle">
    <div style="display:none">
    <a accesskey='p' href="slide14.html">&lt; &lt; Previous</a> |
    <a accesskey='i' href="index.html">Index</a> |
    <a accesskey='n' href="slide16.html">Next &gt;&gt;</a>
    </div>
</td>
<td align="right" valign="middle">
    Copyright &copy; 2005 Jos&eacute; Castro
</td>
</tr>
</table>
</div> 
<div id="logo"></div>
<div class="spacer">
<a name="end"></a>
</div>
</body>
</html>


<!-- END slide -->