CPAN and Tooling Concepts
Dependency Check
Dependency checks compare required module names with modules already available.
dependency
A dependency is another module that a program needs.
Dependency Check
dependency_check.pl
Replay: real traced execution (multi-file project)
use strict;
use warnings;
my $extra = "JSON";
my @required = ("strict", "warnings", $extra);
my %available = (
strict => 1,
warnings => 1,
JSON => 1,
);
my $missing = 0;
my $checked = 0;
foreach my $module (@required) {
$checked = $checked + 1;
if (!$available{$module}) {
$missing = $missing + 1;
}
}
print "extra=$extra\n";
print "checked=$checked\n";
print "missing=$missing\n";
use strict;
use warnings;
my $extra = "DBI";
my @required = ("strict", "warnings", $extra);
my %available = (
strict => 1,
warnings => 1,
JSON => 1,
);
my $missing = 0;
my $checked = 0;
foreach my $module (@required) {
$checked = $checked + 1;
if (!$available{$module}) {
$missing = $missing + 1;
}
}
print "extra=$extra\n";
print "checked=$checked\n";
print "missing=$missing\n";
use strict;
use warnings;
my $extra = "Path::Tiny";
my @required = ("strict", "warnings", $extra);
my %available = (
strict => 1,
warnings => 1,
JSON => 1,
);
my $missing = 0;
my $checked = 0;
foreach my $module (@required) {
$checked = $checked + 1;
if (!$available{$module}) {
$missing = $missing + 1;
}
}
print "extra=$extra\n";
print "checked=$checked\n";
print "missing=$missing\n";
$extra ← JSON, @required ← 3, %available ← 3, $missing ← 0, $checked ← 0
4my $extra→ JSON = "JSON"; #@extra="DBI", "Path::Tiny"5my @required→ 3 = ("strict", "warnings", $extraJSON);6my %available→ 3 = (7 strict => 1,8 warnings => 1,9 JSON => 1,10);11my $missing→ 0 = 0;12my $checked→ 0 = 0;$checked ← 1
pass 1 of 314foreach my $modulestrict (@required3) {15 $checked→ 1 = $checked + 1;16 if (!$available{$module}) {All 3 passes — pass 1 is the card above pass $module$checked1 strict 0 → 1 2 warnings 1 → 2 3 JSON 2 → 3 print "extra=$extra ";
21print "extra=$extraJSON\n";22print "checked=$checked3\n";23print "missing=$missing0\n";outputextra=JSON checked=3 missing=0
$extra ← DBI, @required ← 3, %available ← 3, $missing ← 0, $checked ← 0
4my $extra→ DBI = "DBI";5my @required→ 3 = ("strict", "warnings", $extraDBI);6my %available→ 3 = (7 strict => 1,8 warnings => 1,9 JSON => 1,10);11my $missing→ 0 = 0;12my $checked→ 0 = 0;$checked ← 1
pass 1 of 314foreach my $modulestrict (@required3) {15 $checked→ 1 = $checked + 1;16 if (!$available{$module}) {All 3 passes — pass 1 is the card above pass $module$available{$module}$checked$missing1 strict — 0 → 1 — 2 warnings — 1 → 2 — 3 DBI (empty) 2 → 3 0 → 1 $missing ← 1
15$checked = $checked + 1;16if (!$available{$module}(empty)) {17 $missing→ 1 = $missing + 1;18}print "extra=$extra ";
21print "extra=$extraDBI\n";22print "checked=$checked3\n";23print "missing=$missing1\n";outputextra=DBI checked=3 missing=1
$extra ← Path::Tiny, @required ← 3, %available ← 3, $missing ← 0
4my $extra→ Path::Tiny = "Path::Tiny";5my @required→ 3 = ("strict", "warnings", $extraPath::Tiny);6my %available→ 3 = (7 strict => 1,8 warnings => 1,9 JSON => 1,10);11my $missing→ 0 = 0;12my $checked→ 0 = 0;$checked ← 1
pass 1 of 314foreach my $modulestrict (@required3) {15 $checked→ 1 = $checked + 1;16 if (!$available{$module}) {All 3 passes — pass 1 is the card above pass $module$available{$module}$checked$missing1 strict — 0 → 1 — 2 warnings — 1 → 2 — 3 Path::Tiny (empty) 2 → 3 0 → 1 $missing ← 1
15$checked = $checked + 1;16if (!$available{$module}(empty)) {17 $missing→ 1 = $missing + 1;18}print "extra=$extra ";
21print "extra=$extraPath::Tiny\n";22print "checked=$checked3\n";23print "missing=$missing1\n";outputextra=Path::Tiny checked=3 missing=1