refactor web start scripts to be more portable

This commit is contained in:
Oliver Gorwits
2013-03-04 00:19:18 +00:00
parent 8e9466b64f
commit d82fe1e2b0
5 changed files with 39 additions and 20 deletions

View File

@@ -1,9 +1,28 @@
#!/usr/bin/env perl
use FindBin;
use lib "$FindBin::Bin/../lib";
use App::Netdisco;
use strict;
use warnings FATAL => 'all';
BEGIN {
# stuff useful locations into @INC and $PATH
use Config;
use FindBin;
FindBin::again();
use Path::Class 'dir';
my $location = $FindBin::RealBin;
$ENV{PATH} = $location . $Config{path_sep} . $ENV{PATH};
unshift @INC,
dir($location)->parent->subdir('lib')->stringify,
dir($location, 'lib')->stringify;
}
use App::Netdisco;
use Dancer;
debug sprintf "App::Netdisco %s", ($App::Netdisco::VERSION || 'HEAD');
my $home = ($ENV{NETDISCO_HOME} || $ENV{HOME});
set('session_dir', dir($home, 'netdisco-web-sessions'));
use App::Netdisco::Web;
dance;