Skip to content

Commit

Permalink
fixed tmpdir detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 2, 2010
1 parent a717b83 commit 4a7360a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Removed bundled RFCs.
- Fixed IRI handling. (sharifulin)
- Fixed mixed IRI/IDNA handling.
- Fixed tmpdir detection.
- Fixed typos.

0.999922 2010-02-11 00:00:00
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojo/Asset/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ use base 'Mojo::Asset';
use Carp 'croak';
use File::Copy ();
use File::Spec;
use File::Temp;
use IO::File;
use Mojo::ByteStream 'b';

__PACKAGE__->attr([qw/cleanup path end_range/]);
__PACKAGE__->attr(start_range => 0);
__PACKAGE__->attr(tmpdir => sub { $ENV{MOJO_TMPDIR} || File::Spec->tmpdir });
__PACKAGE__->attr(tmpdir => sub { $ENV{MOJO_TMPDIR} || File::Temp::tempdir });
__PACKAGE__->attr(
handle => sub {
my $self = shift;
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojo/Server/Daemon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use base 'Mojo::Server';
use Carp 'croak';
use Fcntl ':flock';
use File::Spec;
use File::Temp;
use IO::File;
use Mojo::Command;
use Mojo::IOLoop;
Expand All @@ -22,7 +23,7 @@ __PACKAGE__->attr(keep_alive_timeout => 15);
__PACKAGE__->attr(
lock_file => sub {
my $self = shift;
return File::Spec->catfile(File::Spec->splitdir(File::Spec->tmpdir),
return File::Spec->catfile(File::Spec->splitdir(File::Temp::tempdir),
Mojo::Command->class_to_file(ref $self->app) . '.lock');
}
);
Expand All @@ -31,7 +32,7 @@ __PACKAGE__->attr(max_keep_alive_requests => 100);
__PACKAGE__->attr(
pid_file => sub {
my $self = shift;
return File::Spec->catfile(File::Spec->splitdir(File::Spec->tmpdir),
return File::Spec->catfile(File::Spec->splitdir(File::Temp::tempdir),
Mojo::Command->class_to_file(ref $self->app) . '.pid');
}
);
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/apache_cgi.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use_ok('Mojo::Server::CGI');
# Apache setup
my $server = Test::Mojo::Server->new;
my $port = $server->generate_port_ok;
my $dir = File::Temp::tempdir();
my $dir = File::Temp::tempdir;
my $config = File::Spec->catfile($dir, 'cgi.config');
my $mt = Mojo::Template->new;

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/apache_fastcgi.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use_ok('Mojo::Server::FastCGI');
# Setup
my $server = Test::Mojo::Server->new;
my $port = $server->generate_port_ok;
my $dir = File::Temp::tempdir();
my $dir = File::Temp::tempdir;
my $config = File::Spec->catfile($dir, 'fcgi.config');
my $mt = Mojo::Template->new;

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/loader.t
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ok(LoaderTest::C->can('new'));

# Reload
my $file = IO::File->new;
my $dir = File::Temp::tempdir();
my $dir = File::Temp::tempdir;
my $path = File::Spec->catfile($dir, 'MojoTestReloader.pm');
$file->open("> $path");
$file->syswrite("package MojoTestReloader;\nsub test { 23 }\n1;");
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/message.t
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ is($req->upload('upload')->filename, 'hello.pl');
is(ref $req->upload('upload')->asset, 'Mojo::Asset::File');
is($req->upload('upload')->asset->size, 69);
my $file =
File::Spec->catfile(File::Temp::tempdir(), ("MOJO_TMP." . time . ".txt"));
File::Spec->catfile(File::Temp::tempdir, ("MOJO_TMP." . time . ".txt"));
ok($req->upload('upload')->move_to($file));
is((unlink $file), 1);

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/template.t
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ like($output, qr/23Hello World!/);
$mt = Mojo::Template->new;
$mt->tag_start('[$-');
$mt->tag_end('-$]');
my $dir = File::Temp::tempdir();
my $dir = File::Temp::tempdir;
$file = File::Spec->catfile($dir, 'test.mt');
is($mt->render_to_file(<<"EOF", $file), undef);
<% my \$i = 23; %> foo bar
Expand Down

0 comments on commit 4a7360a

Please sign in to comment.