X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/2645cbf6f7364951ad8dc72649361844181c2b20..637b7a6936d2937561bdbcd44595384fc5cc14f3:/sc.plp diff --git a/sc.plp b/sc.plp index 19149cf..87befbd 100644 --- a/sc.plp +++ b/sc.plp @@ -20,18 +20,25 @@ my %scvers = ( game => 'StarCraft II LotV', major => 2, }, + index => 'bw', + 1 => 'bw', + 2 => 'lotv', ); -$Request ||= 'bw'; -$Request = 'lotv' if $Request eq '2'; -my %scver = %{ $scvers{$Request} // {} } +my $requestver = $scvers{$Request ||= 'index'} or Html(), Abort("Requested version $Request not available", '404 request not found'); +if (ref $requestver ne 'HASH') { + $header{Location} = "/sc/$requestver"; + Abort("Canonical URL for $Request is at $requestver", '302 subpage alias'); +} + +my %scver = %{$requestver}; my $datafile = "sc-units-$Request.inc.pl"; Html({ title => "$scver{title} unit cheat sheet", - version => '1.2', + version => '1.3', description => [ "Reference of $scver{game} unit properties," . " comparing various statistics of all the units in $scver{name}"