Skip to content

Commit

Permalink
just use abs_path again
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 7, 2015
1 parent 01659dd commit 693a3cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Server.pm
Expand Up @@ -2,7 +2,7 @@ package Mojo::Server;
use Mojo::Base 'Mojo::EventEmitter';

use Carp 'croak';
use File::Spec::Functions 'rel2abs';
use Cwd 'abs_path';
use Mojo::Loader 'load_class';
use Mojo::Util 'md5_sum';
use POSIX;
Expand Down Expand Up @@ -44,7 +44,7 @@ sub load_app {

# Clean environment (reset FindBin defensively)
{
local $0 = $path = rel2abs $path;
local $0 = $path = abs_path $path;
require FindBin;
FindBin->again;
local $ENV{MOJO_APP_LOADER} = 1;
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -3,8 +3,9 @@ use Mojo::Base -base;

# "Bender: I was God once.
# God: Yes, I saw. You were doing well, until everyone died."
use Cwd 'abs_path';
use File::Basename 'dirname';
use File::Spec::Functions qw(catfile rel2abs);
use File::Spec::Functions 'catfile';
use Mojo::Server::Prefork;
use Mojo::Util qw(steady_time);
use Scalar::Util 'weaken';
Expand Down Expand Up @@ -39,7 +40,7 @@ sub run {

# Remember executable and application for later
$ENV{HYPNOTOAD_EXE} ||= $0;
$0 = $ENV{HYPNOTOAD_APP} ||= rel2abs $app;
$0 = $ENV{HYPNOTOAD_APP} ||= abs_path $app;

# This is a production server
$ENV{MOJO_MODE} ||= 'production';
Expand Down
5 changes: 3 additions & 2 deletions t/mojo/daemon.t
Expand Up @@ -3,7 +3,8 @@ use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }

use Test::More;
use File::Spec::Functions qw(catdir rel2abs);
use Cwd 'abs_path';
use File::Spec::Functions 'catdir';
use FindBin;
use Mojo;
use Mojo::IOLoop;
Expand Down Expand Up @@ -81,7 +82,7 @@ is_deeply $app->config, {foo => 'bar', baz => 'yada', test => 23},
# Script name
my $path = "$FindBin::Bin/lib/../lib/myapp.pl";
is(Mojo::Server::Daemon->new->load_app($path)->config('script'),
rel2abs($path), 'right script name');
abs_path($path), 'right script name');

# Load broken app
eval {
Expand Down

0 comments on commit 693a3cf

Please sign in to comment.