common: global Data() to parse perl code includes
[sheet.git] / sc.plp
diff --git a/sc.plp b/sc.plp
index 87befbd5ec897ab90425e14c846163004d3ace2b..8d021b793a7eec2e2ffdcee31df65a3146077a65 100644 (file)
--- a/sc.plp
+++ b/sc.plp
@@ -34,7 +34,7 @@ if (ref $requestver ne 'HASH') {
 }
 
 my %scver = %{$requestver};
-my $datafile = "sc-units-$Request.inc.pl";
+my $datafile = "sc-units-$Request";
 
 Html({
        title => "$scver{title} unit cheat sheet",
@@ -54,13 +54,12 @@ Html({
        ],
        stylesheet => [qw( light dark )],
        raw => '<link rel="stylesheet" type="text/css" media="all" href="/sc.css?1.2">',
-       data => [$datafile],
+       data => ["$datafile.inc.pl"],
 });
 
 say "<h1>$scver{game} units</h1>\n";
 
-my $units = do $datafile;
-Abort("Cannot open unit data", 501, $_) for $@ || $! || ();
+my $units = Data($datafile);
 my $patch = shift @{$units}
        or Abort("Cannot open unit data: metadata not found", 501);