App-tarweb

 view release on metacpan or  search on metacpan

lib/App/tarweb.pm  view on Meta::CPAN

      return 2;
    }

    $app->mount("/" => sub ($env) {
      my $html;
      $tt->process('index.html.tt', {
        title    => 'archives',
        archives => [ sort grep { $_ ne 'favicon.ico' } keys %dedupe ],
      }, \$html);
      $html = encode('UTF-8', $html, Encode::FB_CROAK);
      return [ 200, [ 'Content-Type' => 'text/html; charset=utf-8', 'Content-Length' => length $html ], [ $html ] ];
    });

  }

  $runner->run($app->to_app);

  return 0;
}

sub _random_port ($)

share/wrapper.html.tt  view on Meta::CPAN

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>[% IF archive %][% archive.name %][% ELSE %][% title %][% END %]</title>
    <style>
      a {
        text-decoration: none;
        color: blue;
      }
      a:visited {
        color: blue;
      }
      h1, h2, h3 {

t/app_tarweb.t  view on Meta::CPAN


        my $url = URI->new('http://localhost');

        my $guard = psgi_app_guard $url => $app;

        http_request
          GET($url),
          http_response {
            http_code 200;
            http_content_type 'text/html';
            http_content_type_charset 'UTF-8';
            http_content dom {
                find 'ul li a' => [
                  dom { attr href => 'foo.tar';    content 'foo.tar'   },
                  dom { attr href => 'foo.tar-0';  content 'foo.tar-0' },
                ];
            };
          };


        $url->path("/favicon.ico");



( run in 0.293 second using v1.01-cache-2.11-cpan-4d50c553e7e )