blob: 8f71355ec5a1322d780c32da7039b78e95d5a8f5 [file] [log] [blame]
Marc Kupietzdc22b982015-10-09 09:19:34 +02001#!/usr/local/bin/perl
Marc Kupietzbf9bac02022-04-11 21:16:47 +02002our $VERSION = '0.90';
3
4use IDS::DeReKoVecs::Read qw(init_net load_sprofiles getCollocationAssociation getClassicCollocatorsCached getClassicCollocatorsCached getBiggestMergedDifferences filter_garbage get_neighbours);
Marc Kupietzdc22b982015-10-09 09:19:34 +02005use Mojolicious::Lite;
Marc Kupietzc4893362016-02-25 08:04:46 +01006use Mojo::JSON qw(decode_json encode_json to_json);
Marc Kupietz30ca4342017-11-22 21:21:20 +01007use base 'Mojolicious::Plugin';
8
Marc Kupietz247500f2015-10-09 11:29:01 +02009use Encode qw(decode encode);
Marc Kupietza5b90152016-03-15 17:39:19 +010010use Getopt::Std;
Marc Kupietze8e3ded2020-07-13 17:53:56 +020011#use Mojo::Server::Daemon;
Marc Kupietzffef9302017-11-07 15:58:01 +010012use Cwd;
Marc Kupietz66bfd952017-12-11 09:59:45 +010013
Marc Kupietzbf9bac02022-04-11 21:16:47 +020014my $mojo_config = $ENV{MOJO_CONFIG} // '../derekovecs-server.conf';
Marc Kupietzc0d41872021-02-25 16:33:22 +010015plugin Config => {file => $mojo_config};
16
Marc K20476c72021-03-11 12:18:01 +010017my $DEFAULT_VECS = app->config->{w2v}->{vecs} // "../models/dereko-2021-i.vecs";
Marc Kupietzc0d41872021-02-25 16:33:22 +010018my $DEFAULT_NET_NAME = "";
19if ($DEFAULT_VECS=~ /\.vecs/) {
20 $DEFAULT_NET_NAME = $DEFAULT_VECS;
21 $DEFAULT_NET_NAME =~ s/\.vecs/.net/;
22}
23my $DEFAULT_NET = app->config->{w2v}->{net} // $DEFAULT_NET_NAME;
Marc Kupietz397ce852020-07-13 17:52:21 +020024
Marc Kupietzffef9302017-11-07 15:58:01 +010025app->static->paths->[0] = getcwd;
26
Marc Kupietz1b856fa2019-12-07 23:01:43 +010027plugin 'Piwik';
Marc Kupietz2b8d44a2019-12-09 10:38:16 +010028plugin "RemoteAddr";
Marc Kupietz1b856fa2019-12-07 23:01:43 +010029plugin 'Util::RandomString' => {
30 piwik_rand_id => {
31 alphabet => '0123456789abcdef',
32 length => 16
33 }
34};
35
Marc Kupietzd4227392016-03-01 16:45:12 +010036plugin 'Log::Access';
Marc Kupietzb3422c12017-07-04 14:12:11 +020037plugin "RequestBase";
Marc Kupietz95104512019-12-05 10:13:05 +010038#plugin 'AutoReload';
39plugin Localize => {
40 dict => {
41 _ => sub { $_->locale },
42 },
Marc Kupietzbf9bac02022-04-11 21:16:47 +020043 resources => ['../derekovecs-server.dict']
Marc Kupietz95104512019-12-05 10:13:05 +010044};
Marc Kupietza5b90152016-03-15 17:39:19 +010045our $opt_i = 0; # latin1-input?
46our $opt_l = undef;
Marc Kupietza2e64502016-04-27 09:53:51 +020047our $opt_m;
Marc Kupietz6ed81872016-04-27 14:04:04 +020048our $opt_M;
Marc Kupietze8e3ded2020-07-13 17:53:56 +020049our $opt_n = $DEFAULT_NET;
Marc Kupietz43ee87e2016-04-25 10:50:08 +020050our $opt_d;
Marc Kupietzfa194262018-06-05 09:39:32 +020051our $opt_D;
Marc Kupietze8e3ded2020-07-13 17:53:56 +020052our $opt_G = 1;
Marc Kupietzbf9bac02022-04-11 21:16:47 +020053
54our $mergedEnd=0;
55our %cache;
56our %cccache; # classic collocator cache
57our %spcache; # similar profile cache
58our $opt_p = 5676;
Marc Kupietze8e3ded2020-07-13 17:53:56 +020059our $opt_C;
Marc Kupietza5b90152016-03-15 17:39:19 +010060
Marc Kupietz6ed81872016-04-27 14:04:04 +020061my %marked;
Marc Kupietzc053d972019-01-10 10:41:51 +010062my $title="";
Marc Kupietz793413b2016-04-02 21:48:57 +020063my $training_args="";
64
Marc Kupietz3080f172020-07-13 17:51:28 +020065getopts('d:D:Gil:p:m:n:M:C');
Marc Kupietz6ed81872016-04-27 14:04:04 +020066
67if($opt_M) {
Marc Kupietzed930212016-04-27 15:42:38 +020068 open my $handle, '<:encoding(UTF-8)', $opt_M
69 or die "Can't open '$opt_M' for reading: $!";
70 while(<$handle>) {
Marc Kupietz6ed81872016-04-27 14:04:04 +020071 foreach my $mw (split /\s+/) {
72 $marked{$mw}=1
73 }
74 }
Marc Kupietzed930212016-04-27 15:42:38 +020075 close($handle);
Marc Kupietz6ed81872016-04-27 14:04:04 +020076}
Marc Kupietza5b90152016-03-15 17:39:19 +010077
Marc Kupietze8e3ded2020-07-13 17:53:56 +020078my $vecs_name = (@ARGV > 0 && -r $ARGV[0] ? $ARGV[0] : $DEFAULT_VECS);
79init_net($vecs_name, $opt_n, ($opt_i? 1 : 0), 1);
80if(open(FILE, "$vecs_name.args")) {
81 $training_args = <FILE>;
Marc Kupietz2cb667e2016-03-10 09:44:12 +010082}
Marc Kupietze8e3ded2020-07-13 17:53:56 +020083close(FILE);
84$title = fname2corpusname($vecs_name);
Marc Kupietzdc22b982015-10-09 09:19:34 +020085
Marc Kupietze8e3ded2020-07-13 17:53:56 +020086my $have_sprofiles = load_sprofiles($vecs_name);
Marc Kupietza51dcfa2018-03-19 16:22:05 +010087
Marc Kupietzc0d41872021-02-25 16:33:22 +010088if (app->config->{w2v}->{merge}) {
89 $opt_m = app->config->{w2v}->{merge};
90}
91
Marc Kupietza2e64502016-04-27 09:53:51 +020092if($opt_m) {
93 $mergedEnd = mergeVectors($opt_m);
Marc Kupietzc053d972019-01-10 10:41:51 +010094 $title = "<span class=\"merged\">" . $title . "</span> vs. " . fname2corpusname($opt_m);
Marc Kupietza2e64502016-04-27 09:53:51 +020095}
96
Marc Kupietze5568a02018-12-20 11:42:02 +010097
Marc Kupietz43ee87e2016-04-25 10:50:08 +020098if($opt_d) { # -d: dump vecs and exit
99 dump_vecs($opt_d);
100 exit;
101}
102
Marc Kupietzfa194262018-06-05 09:39:32 +0200103if($opt_D) { # -D: dump vecs for numpy and exit
104 dump_for_numpy($opt_D);
105 exit;
106}
107
Marc Kupietze8e3ded2020-07-13 17:53:56 +0200108#my $daemon = Mojo::Server::Daemon->new(
109# app => app,
110# listen => ['http://'.($opt_l ? $opt_l : '*').":$opt_p"]
111#);
Marc Kupietza5b90152016-03-15 17:39:19 +0100112
Marc Kupietz5c3887d2016-04-28 08:53:35 +0200113if($opt_G) {
114 print "Filtering garbage\n";
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100115 filter_garbage();
Marc Kupietzc0d41872021-02-25 16:33:22 +0100116 print "Finished filtering garbage\n";
Marc Kupietz5c3887d2016-04-28 08:53:35 +0200117}
118
Marc Kupietz554aff52017-11-09 14:42:09 +0100119get '*/js/*' => sub {
Marc Kupietzffef9302017-11-07 15:58:01 +0100120 my $c = shift;
121 my $url = $c->req->url;
Marc K20476c72021-03-11 12:18:01 +0100122 $url =~ s@/derekovecs/@/@g;
Marc Kupietzffef9302017-11-07 15:58:01 +0100123 $c->app->log->info("GET: " . $url);
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100124 $c->reply->static($url);
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100125} => 'js';
Marc Kupietzffef9302017-11-07 15:58:01 +0100126
Marc Kupietza9270572018-03-17 15:17:07 +0100127get '*/css/*' => sub {
128 my $c = shift;
129 my $url = $c->req->url;
130 $url =~ s@/derekovecs/@/@g;
131 $c->app->log->info("GET: " . $url);
132 $c->reply->static($url);
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100133} => 'css';
Marc Kupietza9270572018-03-17 15:17:07 +0100134
Marc Kupietzc053d972019-01-10 10:41:51 +0100135sub fname2corpusname {
136 ($_) = @_;
137 s@.*/@@;
Marc Kupietz86b50292019-02-17 21:03:59 +0100138 s@\.en@-en@;
Marc Kupietzc053d972019-01-10 10:41:51 +0100139 s@\..*@@;
140 return $_;
141}
142
Marc Kupietzcb43e492019-12-03 10:07:53 +0100143sub getWord {
144 ($_) = @_;
145 if ($_ =~ /^\d+/) {
146 return $_;
147 } else {
148 return getWordNumber($_);
149 }
150}
151
Marc Kupietza51dcfa2018-03-19 16:22:05 +0100152
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100153post '/derekovecs/getVecsByRanks' => sub {
Marc Kupietz66bfd952017-12-11 09:59:45 +0100154 my $self = shift;
155 my $vec = getVecs($self->req->json);
156 $self->render(json => $vec);
157};
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100158
Marc Kupietzf6080012021-03-12 09:14:42 +0100159any '*/getCollocationAssociation' => sub {
160 my $self = shift;
161 $self->render(data => getCollocationAssociation($self, getWord($self->param("w") ? $self->param("w") : $self->req->json), getWord($self->param("c"))), format=>'json');
162} => 'getCollocationAssociation';
163
164any '/getCollocationAssociation' => sub {
165 my $self = shift;
166 $self->render(data => getCollocationAssociation($self, getWord($self->param("w") ? $self->param("w") : $self->req->json), getWord($self->param("c"))), format=>'json');
167} => 'getCollocationAssociation1';
168
Marc Kupietze13a3552018-01-25 08:48:34 +0100169any '*/getClassicCollocators' => sub {
Marc Kupietze243efd2018-01-11 22:19:24 +0100170 my $self = shift;
Marc Kupietzcb43e492019-12-03 10:07:53 +0100171 $self->render(data => getClassicCollocatorsCached($self, getWord($self->param("w") ? $self->param("w") : $self->req->json)), format=>'json');
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100172} => 'getClassicCollocators1';
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100173
Marc Kupietze13a3552018-01-25 08:48:34 +0100174any '/getClassicCollocators' => sub {
Marc Kupietze243efd2018-01-11 22:19:24 +0100175 my $self = shift;
Marc Kupietzcb43e492019-12-03 10:07:53 +0100176 $self->render(data => getClassicCollocatorsCached($self, getWord($self->param("w") ? $self->param("w") : $self->req->json)), format=>'json');
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100177} => 'getClassicCollocators';
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100178
Marc Kupietzd7760b42019-02-21 09:01:44 +0100179any '/getBiggestVocabDistances' => sub {
180 my $self = shift;
181 $self->render(data => getBiggestMergedDifferences(), format=>'json');
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100182} => 'getBiggestVocabDistances1';
Marc Kupietzd7760b42019-02-21 09:01:44 +0100183
184any '*/getBiggestVocabDistances' => sub {
185 my $self = shift;
186 $self->render(data => getBiggestMergedDifferences(), format=>'json');
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100187} => 'getBiggestVocabDistances';
Marc Kupietzd7760b42019-02-21 09:01:44 +0100188
Marc Kupietz33c79d32019-08-02 15:11:23 +0200189any '*/getPosWiseW2VCollocators' => sub {
190 my $self = shift;
191 $self->render(data => getPosWiseW2VCollocatorsAsTsv($self->param("w"),
192 ($self->param("max")? $self->param("max") : 200),
193 ($self->param("cutoff")? $self->param("cutoff") :750000),
194 ($self->param("threshold")? $self->param("threshold") : 0.2)),
195 format=>'tsv');
196};
197
198any '/getPosWiseW2VCollocators' => sub {
199 my $self = shift;
200 $self->render(data => getPosWiseW2VCollocatorsAsTsv($self->param("w"),
201 ($self->param("max")? $self->param("max") : 200),
202 ($self->param("cutoff")? $self->param("cutoff") : 750000),
203 ($self->param("threshold")? $self->param("threshold") : 0.2)),
204 format=>'tsv');
205};
206
Marc Kupietza51dcfa2018-03-19 16:22:05 +0100207any '*/getSimilarProfiles' => sub {
208 my $self = shift;
Marc Kupietzcb43e492019-12-03 10:07:53 +0100209 $self->render(data => getSimilarProfilesCached($self, getWord($self->param("w") ? $self->param("w") : $self->req->json)), format=>'json');
Marc Kupietza51dcfa2018-03-19 16:22:05 +0100210};
211
Marc Kupietzc987fa82018-03-21 12:14:25 +0100212any '/getSimilarProfiles' => sub {
213 my $self = shift;
Marc Kupietzcb43e492019-12-03 10:07:53 +0100214 $self->render(data => getSimilarProfilesCached($self, getWord($self->param("w") ? $self->param("w") : $self->req->json)), format=>'json');
Marc Kupietzc987fa82018-03-21 12:14:25 +0100215};
216
Marc Kupietz9f301572020-04-06 18:29:16 +0200217any '*/getWord' => sub {
218 my $self = shift;
219 my $w = $self->param("w");
220 my $rank = getWord($w);
221 my $status = 200;
222 if ($rank <= 0) {
223 $rank = -1;
224 $status = 404;
225 }
226 $self->render(data => encode_json({word => $w, frequencyRank => $rank}), format => 'json', status => $status);
227};
228
229any '/getWord' => sub {
230 my $self = shift;
231 my $w = $self->param("w");
232 my $rank = getWord($w);
233 my $status = 200;
234 if ($rank <= 0) {
235 $rank = -1;
236 $status = 404;
237 }
238 $self->render(data => encode_json({word => $w, frequencyRank => $rank}), format => 'json', status => $status);
239};
240
Marc Kupietz98ed1c02019-08-02 15:05:37 +0200241any '/getSimilarity' => sub {
242 my $self = shift;
243 my $w1 = $self->param("w1");
244 my $w2 = $self->param("w2");
245 $self->render(data => cos_similarity_as_json($w1, $w2), format=>'json');
246};
247
248any '*/getSimilarity' => sub {
249 my $self = shift;
250 my $w1 = $self->param("w1");
251 my $w2 = $self->param("w2");
252 $self->render(data => cos_similarity_as_json($w1, $w2), format=>'json');
253};
254
Marc Kupietzdf3d4b52017-11-29 16:57:27 +0100255get '*/img/*' => sub {
256 my $c = shift;
257 my $url = $c->req->url;
258 $url =~ s@/derekovecs@@g;
259 $c->app->log->info("GET: " . $url);
260 $c->reply->static($url);
261};
262
Marc Kupietzdc22b982015-10-09 09:19:34 +0200263get '/' => sub {
264 my $c = shift;
Marc Kupietza5f60042017-05-04 10:38:12 +0200265 $c->app->log->info("get: ".$c->req->url->to_abs);
Marc Kupietzdc22b982015-10-09 09:19:34 +0200266 my $word=$c->param('word');
Marc Kupietz2da2a812019-02-21 14:17:35 +0100267 my $no_nbs=$c->param('n') || ($opt_m? 50 : 100);
Marc Kupietz44bee3c2016-02-25 16:26:29 +0100268 my $no_iterations=$c->param('N') || 2000;
Marc Kupietzd4227392016-03-01 16:45:12 +0100269 my $perplexity=$c->param('perplexity') || 20;
Marc Kupietzc4d62f82016-03-01 11:04:24 +0100270 my $epsilon=$c->param('epsilon') || 5;
Marc Kupietzd7aea722016-03-02 11:59:12 +0100271 my $som=$c->param('som') || 0;
Marc Kupietza2e64502016-04-27 09:53:51 +0200272 my $searchBaseVocabFirst=$c->param('sbf') || 0;
Marc Kupietz6d9a6782016-03-23 17:25:25 +0100273 my $sort=$c->param('sort') || 0;
Marc Kupietzc469f3b2017-11-13 14:07:36 +0100274 my $csv=$c->param('csv') || 0;
Marc Kupietzb613b052016-04-28 14:11:59 +0200275 my $json=$c->param('json') || 0;
Marc Kupietzdb2dc7e2017-12-02 12:04:03 +0100276 my $cutoff=$c->param('cutoff') || 500000;
Marc Kupietzd91212f2017-11-13 10:05:09 +0100277 my $dedupe=$c->param('dedupe') || 0;
Marc Kupietzac707b32018-12-20 11:36:38 +0100278 my $nosp=$c->param('nosp') || 0;
Marc Kupietz6b2975c2016-03-18 21:59:33 +0100279 my $res;
Marc Kupietz7b2cbeb2016-02-25 11:22:00 +0100280 my @lists;
Marc Kupietz6b2975c2016-03-18 21:59:33 +0100281 my @collocations;
Marc Kupietzcddc8482019-12-04 08:57:33 +0100282 if(defined($word) && $word !~ /^\s*$/) {
Marc Kupietz7bc85fd2016-02-24 11:42:41 +0100283 $c->inactivity_timeout(300);
Marc Kupietz44bee3c2016-02-25 16:26:29 +0100284 $word =~ s/\s+/ /g;
Marc Kupietz3082fd02019-01-09 14:54:06 +0100285 if($opt_m && $word !~ /\|/) {
286 $word .= "|$word";
287 }
Marc Kupietz44bee3c2016-02-25 16:26:29 +0100288 for my $w (split(' *\| *', $word)) {
Marc Kupietz3082fd02019-01-09 14:54:06 +0100289 if($opt_m) {
290 if($searchBaseVocabFirst) {
291 $searchBaseVocabFirst=0;
292 } else {
293 $searchBaseVocabFirst=1;
294 }
295 }
296 if ($cache{$w.$cutoff.$no_nbs.$sort.$dedupe,$searchBaseVocabFirst}) {
Marc Kupietz15987412017-11-07 15:56:58 +0100297 $c->app->log->info("Getting $w results from cache");
Marc Kupietz3082fd02019-01-09 14:54:06 +0100298 $res = $cache{$w.$cutoff.$no_nbs.$sort.$dedupe.$searchBaseVocabFirst}
Marc Kupietza5b90152016-03-15 17:39:19 +0100299 } else {
Marc Kupietz15987412017-11-07 15:56:58 +0100300 $c->app->log->info('Looking for neighbours of '.$w);
301 if($opt_i) {
Marc Kupietzac707b32018-12-20 11:36:38 +0100302 $res = get_neighbours(encode("iso-8859-1", $w), $no_nbs, $sort, $searchBaseVocabFirst, $cutoff, $dedupe, $nosp);
Marc Kupietz15987412017-11-07 15:56:58 +0100303 } else {
Marc Kupietzac707b32018-12-20 11:36:38 +0100304 $res = get_neighbours($w, $no_nbs, $sort, $searchBaseVocabFirst, $cutoff, $dedupe, $nosp);
Marc Kupietz15987412017-11-07 15:56:58 +0100305 }
Marc Kupietz2dd2dd72017-12-01 22:08:14 +0100306 $cache{$w.$cutoff.$no_nbs.$sort.$dedupe} = $res;
Marc Kupietza5b90152016-03-15 17:39:19 +0100307 }
Marc Kupietz6b2975c2016-03-18 21:59:33 +0100308 push(@lists, $res->{paradigmatic});
Marc Kupietz15987412017-11-07 15:56:58 +0100309 }
310 }
Marc Kupietz56844a22019-08-02 15:12:19 +0200311
Marc Kupietz000ad862016-02-26 14:59:12 +0100312 $word =~ s/ *\| */ | /g;
Marc Kupietzb613b052016-04-28 14:11:59 +0200313 if($json) {
314 return $c->render(json => {word => $word, list => \@lists, collocators=>$res->{syntagmatic}});
Marc Kupietzc469f3b2017-11-13 14:07:36 +0100315 } elsif($csv) {
316 my $csv_data="";
317 for (my $i=0; $i <= $no_nbs; $i++) {
318 $csv_data .= $res->{paradigmatic}->[$i]->{word} . ", ";
319 }
320 for (my $i=0; $i < $no_nbs; $i++) {
321 $csv_data .= $res->{syntagmatic}->[$i]->{word} . ", ";
322 }
323 chop $csv_data;
324 chop $csv_data;
Marc Kupietz56dbabe2019-12-10 14:33:57 +0100325 $csv_data .= "\n";
Marc Kupietzc469f3b2017-11-13 14:07:36 +0100326 return $c->render(text=>$csv_data);
Marc Kupietzb613b052016-04-28 14:11:59 +0200327 } else {
Marc Kupietzd7760b42019-02-21 09:01:44 +0100328 my $distantWords="";
329 if(!defined($word) || $word !~ /^\s*$/) {
330 $distantWords = getBiggestMergedDifferences();
331 }
332 $c->render(template=>"index", title=>$title, word=>$word, distantWords=>$distantWords, cutoff=>$cutoff, no_nbs=>$no_nbs, no_iterations => $no_iterations, epsilon=> $epsilon, perplexity=> $perplexity, show_som=>$som, searchBaseVocabFirst=>$searchBaseVocabFirst, sort=>$sort, training_args=>$training_args, mergedEnd=> $mergedEnd, haveSProfiles=> $have_sprofiles, dedupe=> $dedupe, marked=>\%marked, lists=> \@lists, collocators=> $res->{syntagmatic});
Marc Kupietzb613b052016-04-28 14:11:59 +0200333 }
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100334} => "paradigmaticAndSyntagmaticNbs";
Marc Kupietzdc22b982015-10-09 09:19:34 +0200335
Marc Kupietz30ca4342017-11-22 21:21:20 +0100336helper(bitvec2window => sub {
337 my ($self, $n) = @_;
338 my $str = unpack("B32", pack("N", $n));
339 $str =~ s/^\d{22}//;
340 $str =~ s/^(\d{5})/$1x/;
341 $str =~ s/0/ยท/g;
342 $str =~ s/1/+/g;
343 return $str;
344 });
345
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100346hook(
347 after_render => sub {
348 my $c = shift;
349
350 # Only track valid routes
351 my $route = $c->current_route or return;
352
353 # This won't forward personalized information
354 my $hash = {
Marc Kupietz251de9f2020-01-14 16:12:05 +0100355 action_url => $c->req->url->to_abs,
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100356 action_name => $route,
Marc Kupietz251de9f2020-01-14 16:12:05 +0100357 ua => $c->req->headers->user_agent,
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100358 urlref => '',
359 send_image => 0,
360 dnt => 0,
Marc Kupietz251de9f2020-01-14 16:12:05 +0100361 cip => $c->remote_addr,
362 lang => $c->req->headers->accept_language,
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100363 uid => $c->random_string('piwik_rand_id')
364 };
Marc Kupietz251de9f2020-01-14 16:12:05 +0100365 # $c->app->log->info("PIWIK: counting " . $hash->{action_url} . "\nremote:" . $c->remote_addr);
366 # $c->app->log->info("PIWIK: tag " . $c->piwik_tag);
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100367
368 # Send track
369 $c->piwik->api_p(Track => $hash)->wait;
Marc Kupietz251de9f2020-01-14 16:12:05 +0100370
371 # $c->app->log->info("PIWIK: counted.");
Marc Kupietz1b856fa2019-12-07 23:01:43 +0100372 }
373);
374
Marc Kupietzbf9bac02022-04-11 21:16:47 +0200375app->renderer->paths([app->home->rel_file('../templates')]);
Marc Kupietze8e3ded2020-07-13 17:53:56 +0200376app->start;
377#$daemon->run;
Marc Kupietz95104512019-12-05 10:13:05 +0100378# app->start;
Marc Kupietzdc22b982015-10-09 09:19:34 +0200379
Marc Kupietz95104512019-12-05 10:13:05 +0100380# exit;