From 3c27e9235cf6878af216da087e5a6336b4232370 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Mon, 8 Aug 2016 19:55:43 +0200 Subject: [PATCH] Better installer --- install.pl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/install.pl b/install.pl index f3b2d7f..5e2ce95 100755 --- a/install.pl +++ b/install.pl @@ -1,18 +1,20 @@ -#!/usr/bin/perl -w +#!perl -w -use 5.018; +use 5.014; use autodie; use Cwd 'realpath'; -eval { - rename "$ENV{'HOME'}/.vimrc", "$ENV{'HOME'}/.vimrc.old"; +my $old_file = $ENV{'HOME'}.'/.vimrc'; + +if (-e $old_file) { + rename $old_file, "$old_file.old"; say "Old vimrc backuped to ~/.vimrc.old"; -} or do { +} else { say "No file to backup"; -}; +} say "Writing your new config"; -open my $vimrc, '>', "$ENV{'HOME'}/.vimrc"; +open my $vimrc, '>', $old_file; my $script = realpath($0); my $path = $script =~ s#/(\w|\.)+\z##ar;