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