line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Flower - passive agent |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 VERSION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Version 0.09 |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
start up your elasticsearch |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sudo /etc/init.d/elasticsearch start |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
now ready to go ahead |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
git clone https://github.com/santex/Flower.git; |
19
|
|
|
|
|
|
|
cd Flower; |
20
|
|
|
|
|
|
|
dzil build; |
21
|
|
|
|
|
|
|
dzil test; |
22
|
|
|
|
|
|
|
sudo dzil install; |
23
|
|
|
|
|
|
|
pwd=$(pwd); |
24
|
|
|
|
|
|
|
ip=127.0.0.1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
perl $pwd"/bin/flower" --ip $ip --filepath $pwd"/data/" |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Then visit L in your browser. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package Flower; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
2
|
|
1109
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
35
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
2
|
|
10
|
use Mojo::Base 'Mojolicious'; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
17
|
|
38
|
2
|
|
|
2
|
|
218113
|
use Data::Printer; |
|
2
|
|
|
|
|
69440
|
|
|
2
|
|
|
|
|
16
|
|
39
|
2
|
|
|
2
|
|
260
|
use Mojo::Server::Daemon; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
39
|
|
40
|
2
|
|
|
2
|
|
48
|
use EV; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
41
|
2
|
|
|
2
|
|
3077
|
use AnyEvent; |
|
2
|
|
|
|
|
11389
|
|
|
2
|
|
|
|
|
62
|
|
42
|
2
|
|
|
2
|
|
1472
|
use Data::UUID; |
|
2
|
|
|
|
|
1645
|
|
|
2
|
|
|
|
|
137
|
|
43
|
2
|
|
|
2
|
|
1514
|
use Mojolicious::Plugin::SimpleSession; |
|
2
|
|
|
|
|
15607
|
|
|
2
|
|
|
|
|
24
|
|
44
|
|
|
|
|
|
|
# This method will run once at server start |
45
|
|
|
|
|
|
|
sub startup { |
46
|
2
|
|
|
2
|
1
|
28775
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Routes |
49
|
2
|
|
|
|
|
10
|
my $r = $self->routes; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Normal route to controller |
52
|
2
|
|
|
|
|
29
|
$r->route('/')->to('interface#root',set=>{}); |
53
|
2
|
|
|
|
|
336
|
$r->route('/about')->to('interface#root',set=>{}); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
|
|
433
|
$r->route('/q/:type')->to('rest#query'); |
57
|
|
|
|
|
|
|
#$r->route('/q/:type')->to('rest#query'); |
58
|
|
|
|
|
|
|
# RESTful routes |
59
|
|
|
|
|
|
|
# routes for the remote nodes to hit |
60
|
|
|
|
|
|
|
#$r->route('/REST/1.0/:file')->to('upload#store'); |
61
|
2
|
|
|
|
|
398
|
$r->route('/REST/1.0/ping')->via(qw/POST/)->to('rest#ping'); |
62
|
2
|
|
|
|
|
517
|
$r->route('/REST/1.0/files')->to('rest#file_get_by_uuid'); |
63
|
2
|
|
|
|
|
500
|
$r->route('/REST/1.0/file/:uuid')->to('rest#files'); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# routes for the local interface to use |
66
|
|
|
|
|
|
|
# XXX should check it is the local user! |
67
|
2
|
|
|
|
|
618
|
$r->route('/REST/1.0/files/all')->to('rest#files_all'); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
# ABSTRACT: your passive agent arround the web |
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Hagen Geissler, C<< >> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Copyright 2015 Hagen Geissler |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
85
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
86
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |