<commit_before>use strict;
use warnings;
use Amon2::Lite;
use Plack::App::File;
use FindBin;
use Plack::Builder;

my $JQLUSTER_DIR = "$FindBin::RealBin/js";

my @JQLUSTER_FILES = qw(util.js
                        connection.js
                        connection_websocket.js
                        transport.js
                        remote_selector.js
                        remote_selector_factory.js
                        jquery_adaptor.js
                   );

get '/' => sub {
    my ($c) = @_;
    return $c->render('index.tt');
};

get '/single.html' => sub {
    my ($c) = @_;
    return $c->render('single.tt');
};

get '/jqluster.js' => sub {
    my ($c) = @_;
    my $total = "";
    foreach my $filename (@JQLUSTER_FILES) {
        open my $file, "<", "$JQLUSTER_DIR/$filename" or die "Cannot open $filename";
        $total .= do { local $/; <$file> };
        close $file;
    }
    return $c->create_response(200, ["Content-Type" => "application/javascript",
                                     "Content-Length" => length($total)],
                               [$total]);
};
 
return builder {
    mount "/lib" => Plack::App::File->new(root => "$FindBin::RealBin/js/lib");
    mount "/" => __PACKAGE__->to_app();
};

<commit_msg>app.psgi: Plack::App::File::to_app should be called to get PSGI app object.<commit_after>use strict;
use warnings;
use Amon2::Lite;
use Plack::App::File;
use FindBin;
use Plack::Builder;

my $JQLUSTER_DIR = "$FindBin::RealBin/js";

my @JQLUSTER_FILES = qw(util.js
                        connection.js
                        connection_websocket.js
                        transport.js
                        remote_selector.js
                        remote_selector_factory.js
                        jquery_adaptor.js
                   );

get '/' => sub {
    my ($c) = @_;
    return $c->render('index.tt');
};

get '/single.html' => sub {
    my ($c) = @_;
    return $c->render('single.tt');
};

get '/jqluster.js' => sub {
    my ($c) = @_;
    my $total = "";
    foreach my $filename (@JQLUSTER_FILES) {
        open my $file, "<", "$JQLUSTER_DIR/$filename" or die "Cannot open $filename";
        $total .= do { local $/; <$file> };
        close $file;
    }
    return $c->create_response(200, ["Content-Type" => "application/javascript",
                                     "Content-Length" => length($total)],
                               [$total]);
};
 
return builder {
    mount "/lib" => Plack::App::File->new(root => "$FindBin::RealBin/js/lib")->to_app;
    mount "/" => __PACKAGE__->to_app();
};


{'fraction_non_alphanumeric': 0.16408068269976725, 'fraction_numerical': 0.0031031807602792862, 'mean_word_length': 1.8185792349726777, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5224731', 'n_tokens_mistral': 833, 'n_tokens_neox': 797, 'n_words': 167}