]> iEval git - app-web-oof.git/blobdiff - lib/App/Web/Oof.pm
Fix invalid HTML by adding footer before </body>
[app-web-oof.git] / lib / App / Web / Oof.pm
index 2814ad3760b879b85193982019d69e91cb2b79e1..e7d93f5d856a10621d526b79a6a3194eb86130c4 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use utf8;
 use parent qw/Plack::Component/;
 
-our $VERSION = '0.000_003';
+our $VERSION = '0.000_004';
 
 use DBIx::Simple;
 use File::Slurp;
@@ -164,7 +164,8 @@ sub order_app {
        my $req = Plack::Request->new($env);
        my ($id) = $env->{PATH_INFO} =~ m,^/([0-9A-F]+),;
        if ($id) {
-               my $total = $db{$$}->select(orders => 'total', {id => $id})->list;
+               my $total = $db{$$}->select(orders => 'total', {id => $id})->list or
+                 return [500, ['Content-type', 'text/plain'], ['Order not found']];
                $tree->fid('orderid')->replace_content($id);
                $tree->look_down(name => 'order')->attr(value => $id);
                $tree->fid('total')->replace_content(stringify_money $total);
@@ -254,7 +255,7 @@ sub app {
                        my $app = shift;
                        sub {
                                my $res = $app->(@_);
-                               push @{$res->[2]}, $footer if $res->[0] == 200;
+                               $res->[2][0] =~ s,</body>,$footer</body>, if $res->[0] == 200;
                                $res;
                        }
                };
This page took 0.021906 seconds and 4 git commands to generate.