/usr/share/perl5/App/SD/Server.pm is in sd 0.75-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | package App::SD::Server;
use Any::Moose;
extends 'Prophet::Server';
has with_browser => (
isa => 'Bool',
is => 'rw',
default => 0,
);
=head2 database_bonjour_name
Returns the name this database should use to announce itself via bonjour
=cut
sub database_bonjour_name {
my $self = shift;
my $name = $self->app_handle->setting( label => 'project_name' )->get->[0];
my $uuid = $self->handle->db_uuid;
return "$name ($uuid)";
}
sub css {
return shift->SUPER::css(@_), "/static/sd/css/main.css";
}
sub js {
return shift->SUPER::js(@_);
}
# open up a browser after the server has been started (basically a
# hook for the browser command)
sub after_setup_listener {
my $self = shift;
local $SIG{CHLD}; # allow browser to be run with system()
if ( $self->with_browser ) {
$self->open_browser( url => 'http://localhost:' . $self->port );
}
}
sub open_browser {
my $self = shift;
my %args = (@_);
my $opener = $self->open_url_cmd;
if (!$opener) {
warn "I'm unable to figure out what browser I should open for you.\n";
return;
}
system($opener, $args{url}) && die "Couldn't run $opener: $!";
}
sub open_url_cmd {
my $self = shift;
if ( $^O eq 'darwin' ) {
return 'open';
}
elsif ( $^O eq 'MSWin32' ) {
return 'start';
}
for my $cmd (qw|x-www-browser htmlview
gnome-open gnome-moz-remote
firefox iceweasel opera www-browser w3m lynx|) {
my $cmd_path = `which $cmd`;
chomp($cmd_path);
if ( $cmd_path && -f $cmd_path && -x _ ) {
return $cmd_path;
}
}
}
no Any::Moose;
1;
|