Project Organization and Maintenance
Project Layout
A small Perl project is easier to maintain when scripts, modules, and tests have clear homes.
Project Layout
project_layout.pl
use strict;
use warnings;
my $include_tests = ;
my @paths = ("bin/report", "lib/App/Report.pm", "README.md");
if ($include_tests) {
push @paths, "t/report.t";
}
my $module_count = 0;
my $test_count = 0;
for my $path (@paths) {
$module_count = $module_count + 1 if $path =~ /^lib\//;
$test_count = $test_count + 1 if $path =~ /^t\//;
}
print "include_tests=$include_tests\n";
print "path_count=" . scalar(@paths) . "\n";
print "module_count=$module_count\n";
print "test_count=$test_count\n";
use strict;
use warnings;
my $include_tests = ;
my @paths = ("bin/report", "lib/App/Report.pm", "README.md");
if ($include_tests) {
push @paths, "t/report.t";
}
my $module_count = 0;
my $test_count = 0;
for my $path (@paths) {
$module_count = $module_count + 1 if $path =~ /^lib\//;
$test_count = $test_count + 1 if $path =~ /^t\//;
}
print "include_tests=$include_tests\n";
print "path_count=" . scalar(@paths) . "\n";
print "module_count=$module_count\n";
print "test_count=$test_count\n";
project-layout
Layout names communicate which files are entry points, reusable modules, and test files.