--- nfo/perl/libs/shortcuts.pm 2003/02/11 05:14:28 1.2 +++ nfo/perl/libs/shortcuts.pm 2003/02/22 17:26:13 1.5 @@ -1,7 +1,16 @@ ## --------------------------------------------------------------------------- -## $Id: shortcuts.pm,v 1.2 2003/02/11 05:14:28 joko Exp $ +## $Id: shortcuts.pm,v 1.5 2003/02/22 17:26:13 joko Exp $ ## --------------------------------------------------------------------------- ## $Log: shortcuts.pm,v $ +## Revision 1.5 2003/02/22 17:26:13 joko +## + enhanced unix compatibility fix +## +## Revision 1.4 2003/02/22 17:19:36 joko +## + unix compatibility fix +## +## Revision 1.3 2003/02/14 14:17:04 joko +## - shortened seperator +## ## Revision 1.2 2003/02/11 05:14:28 joko ## + refactored code from libp.pm ## @@ -51,11 +60,24 @@ my $cmd = shift; my $caption = shift; #$cmd = 'perl ' . $cmd; - my $sep = "-" x 90; + my $sep = "-" x 60; print $sep, "\n"; print " ", $cmd, "\n"; print " ", $caption, "\n" if $caption; print $sep, "\n"; + + # strip name of executable from full command string + $cmd =~ m/(.+?)\s/; + my $executable = $1; + + # for unix: check if executable is in local directory, if so - prefix with './' + if (!RUNNING_IN_HELL()) { + #if ($cmd !~ m/\//) { + if (-e $executable) { + $cmd = "./$cmd"; + } + } + system($cmd); #`$cmd`; print "ready.", "\n"; @@ -78,4 +100,7 @@ return ($bool ? 'ok' : 'failed'); } +sub RUNNING_IN_HELL () { $^O eq 'MSWin32' } + + 1;