Package names and exported routines define the boundary other code should rely on.

module-boundary Small public boundaries keep modules easier to test and change.

Module Boundary

exports
module_boundary.pl
Replay: real traced execution (multi-file project)
use strict;
use warnings;

my $exports = "parse,format";
my @public = split /,/, $exports;
my $public_count = scalar @public;
my $has_debug = grep { $_ eq "debug" } @public;
my $boundary = $has_debug ? "too wide" : "focused";

print "exports=$exports\n";
print "public_count=$public_count\n";
print "has_debug=$has_debug\n";
print "boundary=$boundary\n";
use strict;
use warnings;

my $exports = "parse";
my @public = split /,/, $exports;
my $public_count = scalar @public;
my $has_debug = grep { $_ eq "debug" } @public;
my $boundary = $has_debug ? "too wide" : "focused";

print "exports=$exports\n";
print "public_count=$public_count\n";
print "has_debug=$has_debug\n";
print "boundary=$boundary\n";
use strict;
use warnings;

my $exports = "parse,format,debug";
my @public = split /,/, $exports;
my $public_count = scalar @public;
my $has_debug = grep { $_ eq "debug" } @public;
my $boundary = $has_debug ? "too wide" : "focused";

print "exports=$exports\n";
print "public_count=$public_count\n";
print "has_debug=$has_debug\n";
print "boundary=$boundary\n";
  1. $exports ← parse,format, @public ← 2, $public_count ← 2, $has_debug ← 0

    4my $exports→ parse,format = "parse,format"; #@exports="parse", "parse,format,debug"5my @public→ 2 = split /,/, $exportsparse,format;6my $public_count→ 2 = scalar @public2;7my $has_debug→ 0 = grep { $_ eq "debug" } @public2;8my $boundary→ focused = $has_debug0 ? "too wide" : "focused";910print "exports=$exportsparse,format\n";11print "public_count=$public_count2\n";12print "has_debug=$has_debug0\n";13print "boundary=$boundaryfocused\n";
    outputexports=parse,format
    public_count=2
    has_debug=0
    boundary=focused
  1. $exports ← parse, @public ← 1, $public_count ← 1, $has_debug ← 0

    4my $exports→ parse = "parse";5my @public→ 1 = split /,/, $exportsparse;6my $public_count→ 1 = scalar @public1;7my $has_debug→ 0 = grep { $_ eq "debug" } @public1;8my $boundary→ focused = $has_debug0 ? "too wide" : "focused";910print "exports=$exportsparse\n";11print "public_count=$public_count1\n";12print "has_debug=$has_debug0\n";13print "boundary=$boundaryfocused\n";
    outputexports=parse
    public_count=1
    has_debug=0
    boundary=focused
  1. $exports ← parse,format,debug, @public ← 3, $public_count ← 3

    4my $exports→ parse,format,debug = "parse,format,debug";5my @public→ 3 = split /,/, $exportsparse,format,debug;6my $public_count→ 3 = scalar @public3;7my $has_debug→ 1 = grep { $_ eq "debug" } @public3;8my $boundary→ too wide = $has_debug1 ? "too wide" : "focused";910print "exports=$exportsparse,format,debug\n";11print "public_count=$public_count3\n";12print "has_debug=$has_debug1\n";13print "boundary=$boundarytoo wide\n";
    outputexports=parse,format,debug
    public_count=3
    has_debug=1
    boundary=too wide