Permalink
Browse files

Update usefultools

  • Loading branch information...
1 parent 0af2566 commit e0a8c16f72d2e4380b0de5017ee4f60873c63e8d @kepbod committed Mar 18, 2012
Showing with 5 additions and 4 deletions.
  1. +2 −1 tools/autopl.pl
  2. +3 −2 tools/autopm.pl
  3. +0 −1 tools/gitupdate.pl
View
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
+use Cwd;
#
# Program Name: autopl.pl
@@ -78,7 +79,7 @@ sub interactive {
while (1) { # input file pathway
print "Please input perl file pathway:\n";
chomp($opts{p} = <STDIN>);
- chomp($opts{p} = `pwd`) if $opts{p} eq '';
+ $opts{p} = getcwd() if $opts{p} eq '';
if (-d $opts{p} and -w $opts{p}) {
last;
}
View
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
+use Cwd;
#
# Program Name: autopm.pl
@@ -67,7 +68,7 @@ sub help {
$opts{a} = '' unless defined $opts{a}; # if no $ENV{USER}
# set and check pathway
-$opts{p} =`pwd` unless exists $opts{p} and $opts{p} ne '';
+$opts{p} = getpwd() unless exists $opts{p} and $opts{p} ne '';
-d $opts{p} and -w $opts{p}
or die "Your pathway is wrong or no write permission! Please check!\n";
$opts{p} =~ s/([^\/]$)/$1\//;
@@ -101,7 +102,7 @@ sub interactive {
while (1) { # input module pathway
print "Please input module pathway:\n";
chomp($opts{p} = <STDIN>);
- chomp($opts{p} = `pwd`) if $opts{p} eq '';
+ $opts{p} = getcwd() if $opts{p} eq '';
if (-d $opts{p} and -w $opts{p}) {
last;
}
View
@@ -62,7 +62,6 @@ sub help {
or die "Can't find 'git'! Please check if it's installed correctly!\n";
# run commands
-my $pwd = `pwd`;
chdir $opts{p} or die "Can't open $opts{p}! Please check!\n";
# git add
system("git add .") == 0

0 comments on commit e0a8c16

Please sign in to comment.