line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
1
|
|
|
1
|
|
1581
|
use Applify; |
|
1
|
|
|
|
|
3727
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
option str => listen => 'Listen to a custom URL. Default: http://*:5000', 'http://*:5000'; |
5
|
|
|
|
|
|
|
option bool => stdin => 'Allow standard input from ws', 0; |
6
|
|
|
|
|
|
|
option bool => single => 'Run only one command, and exit at end', 0; |
7
|
|
|
|
|
|
|
option str => conduit => 'pty (default) or pipe', 'pty'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
documentation 'App::screenorama'; |
10
|
|
|
|
|
|
|
version 'App::screenorama'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub server { |
13
|
2
|
|
|
2
|
|
17328
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
796
|
require App::screenorama; |
16
|
2
|
|
|
|
|
15
|
App::screenorama->new( |
17
|
|
|
|
|
|
|
conduit => $self->conduit, |
18
|
|
|
|
|
|
|
single => $self->single, |
19
|
|
|
|
|
|
|
stdin => $self->stdin, |
20
|
|
|
|
|
|
|
@_, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
app { |
25
|
|
|
|
|
|
|
my($self, @args) = @_; |
26
|
|
|
|
|
|
|
my($server, $program, @program_args); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
while(my $arg = shift @args) { |
29
|
|
|
|
|
|
|
push @program_args, $arg if $program; |
30
|
|
|
|
|
|
|
$program = shift @args if $arg eq '--'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$program or die "Usage: screenorama -- [program_args]\n"; |
34
|
|
|
|
|
|
|
$server = $self->server(program => $program, program_args => \@program_args); |
35
|
|
|
|
|
|
|
$server->start('daemon', '-l', $self->listen); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
return 0; |
38
|
|
|
|
|
|
|
}; |