diff --git a/lib/Vimana.pm b/lib/Vimana.pm index 78ff97f..6f39e93 100644 --- a/lib/Vimana.pm +++ b/lib/Vimana.pm @@ -14,11 +14,11 @@ Vimana - Vim script manager. =head1 VERSION -Version 0.082 +Version 0.083 =cut -our $VERSION = '0.082'; +our $VERSION = '0.083'; =head1 DESCRIPTION @@ -72,9 +72,6 @@ sub index { return $INDEX; } -sub tmpdir { - return "/tmp/vimana-" . join '',map { [ 'a' .. 'z' ]->[ int rand(26) ] } 1 .. 6; -} =head1 AUTHOR diff --git a/lib/Vimana/AutoInstall.pm b/lib/Vimana/AutoInstall.pm index 274e5f0..ace83ce 100644 --- a/lib/Vimana/AutoInstall.pm +++ b/lib/Vimana/AutoInstall.pm @@ -111,7 +111,7 @@ sub install_from_archive { } } - my $out = Vimana::tmpdir(); + my $out = Vimana::Util::tempdir(); rmtree [ $out ] if -e $out; mkpath [ $out ]; $logger->info("Temporary directory created: $out") if $options->{verbose}; diff --git a/lib/Vimana/Command/Install.pm b/lib/Vimana/Command/Install.pm index be17dc9..6e384e0 100644 --- a/lib/Vimana/Command/Install.pm +++ b/lib/Vimana/Command/Install.pm @@ -36,7 +36,7 @@ sub run { my $page = Vimana::VimOnline::ScriptPage->fetch( $info->{script_id} ); - my $dir = '/tmp' || Vimana::tmpdir(); + my $dir = '/tmp' || Vimana::Util::tempdir(); my $url = $page->{download}; my $filename = $page->{filename}; diff --git a/lib/Vimana/Util.pm b/lib/Vimana/Util.pm index adf972a..ccc5fdf 100644 --- a/lib/Vimana/Util.pm +++ b/lib/Vimana/Util.pm @@ -14,6 +14,10 @@ sub canonical_script_name { $name; } +sub tempdir { + return "/tmp/vimana-" . join '',map { [ 'a' .. 'z' ]->[ int rand(26) ] } 1 .. 6; +} + sub get_mine_type { my $type = File::Type->new->checktype_filename( $_[ 0 ] ); die "can not found file type from @{[ $_[0] ]}" unless $type;