Skip to content

Commit

Permalink
remove dependency of File::Temp
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Oct 22, 2009
1 parent f924152 commit da743bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion Makefile.PL
Expand Up @@ -18,7 +18,6 @@ requires
'File::Find::Rule' => 0.30,
'File::Path' => 2.07,
'File::Spec' => 0,
'File::Temp' => 0,
'Getopt::Long' => 0,
'LWP::UserAgent' => 0,
'LWP::Simple' => 0,
Expand Down
4 changes: 4 additions & 0 deletions lib/Vimana.pm
Expand Up @@ -72,6 +72,10 @@ sub index {
return $INDEX;
}

sub tmpdir {
return "/tmp/vimana-" . join '',map { [ 'a' .. 'z' ]->[ int rand(26) ] } 1 .. 6;
}


=head1 AUTHOR
Expand Down
4 changes: 2 additions & 2 deletions lib/Vimana/AutoInstall.pm
Expand Up @@ -9,7 +9,6 @@ use File::Path qw'mkpath rmtree';
use Archive::Any;
use File::Find::Rule;
use File::Type;
use File::Temp qw(tempdir);
use Vimana::Logger;
use Vimana::Util;
use DateTime;
Expand Down Expand Up @@ -94,6 +93,7 @@ sub install_to {
$ret;
}


=head2 install_from_archive
=cut
Expand All @@ -111,7 +111,7 @@ sub install_from_archive {
}
}

my $out = tempdir( CLEANUP => 1 );
my $out = Vimana::tmpdir();
rmtree [ $out ] if -e $out;
mkpath [ $out ];
$logger->info("Temporary directory created: $out") if $options->{verbose};
Expand Down
3 changes: 1 addition & 2 deletions lib/Vimana/Command/Install.pm
Expand Up @@ -4,7 +4,6 @@ package Vimana::Command::Install;
use base qw(App::CLI::Command);
use URI;
use LWP::Simple qw();
use File::Temp qw(tempdir);

require Vimana::VimOnline;
require Vimana::VimOnline::ScriptPage;
Expand Down Expand Up @@ -37,7 +36,7 @@ sub run {

my $page = Vimana::VimOnline::ScriptPage->fetch( $info->{script_id} );

my $dir = '/tmp' || tempdir( DIR => '/tmp' );
my $dir = '/tmp' || Vimana::tmpdir();

my $url = $page->{download};
my $filename = $page->{filename};
Expand Down

0 comments on commit da743bd

Please sign in to comment.