Hi, The previous post was wrong; I was playing with write tests recently and send an old fragment; the right one is: sub RunFiles { my $currentpath = cwd() ; # test if current path is writable if (! -w "$currentpath") { print " current path readonly : $currentpath\n"; if ($ENV["TEMP"] && -e $ENV["TEMP"]) { $RunPath = $ENV["TEMP"] ; } elsif ($ENV["TMP"] && -e $ENV["TMP"]) { $RunPath = $ENV["TMP"] ; } } # test if we need to change paths if (($RunPath ne "") && (-w "$RunPath")) { print " changing to path : $RunPath\n"; $InpPath = $currentpath ; chdir ($RunPath) ; } # start working if ($PdfArrange) { Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE/POD/CTS Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
* Hans Hagen
if ($ENV["TEMP"] && -e $ENV["TEMP"]) { $RunPath = $ENV["TEMP"] ; } elsif ($ENV["TMP"] && -e $ENV["TMP"]) { $RunPath = $ENV["TMP"] ; }
Just checking, aren't the []'s supposed to be {}'s. $ENV is a hash and this is Perl, so that's the proper way to do it right? I know you use Ruby as well, so my guess is that you transposed Rubyisms onto Perl? nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
At 23:33 01/06/2004, you wrote:
* Hans Hagen
[Jun 01, 2004 21:30]: if ($ENV["TEMP"] && -e $ENV["TEMP"]) { $RunPath = $ENV["TEMP"] ; } elsif ($ENV["TMP"] && -e $ENV["TMP"]) { $RunPath = $ENV["TMP"] ; }
Just checking, aren't the []'s supposed to be {}'s. $ENV is a hash and this is Perl, so that's the proper way to do it right? I know you use Ruby as well, so my guess is that you transposed Rubyisms onto Perl?
indeed -) interestingly perl does not complain, which is one more reason to go ruby thanks Hans
Am Mittwoch, 02.06.04, um 10:09 Uhr (Europe/Zurich) schrieb Hans Hagen:
if ($ENV["TEMP"] && -e $ENV["TEMP"]) { $RunPath = $ENV["TEMP"] ; } elsif ($ENV["TMP"] && -e $ENV["TMP"]) { $RunPath = $ENV["TMP"] ; }
interestingly perl does not complain, which is one more reason to go ruby
Do you use warnings; use strict; ? Grüßlis vom Hraban! -- http://www.fiee.net/texnique/
Hans Hagen wrote:
$RunPath = $ENV["TEMP"] ;
interestingly perl does not complain, which is one more reason to go ruby
Why should it complain? Just because you hadn't set @ENV? :-) (Having $ENV, %ENV, and @ENV be three unrelated variables is a good reason to go from Perl to $otherlanguage, indeed.) regards, Christopher
participants (4)
-
Christopher Creutzig
-
Hans Hagen
-
Henning Hraban Ramm
-
Nikolai Weibull