slloyd has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to get the System TEMP Environment Variable but without success.
$ENV{TEMP} returns the User TEMP Environment Variable
So does the Win32 API GetTempPath.
Is there a way to get the System Temp Directory?

Thanks

Replies are listed 'Best First'.
Re: Getting the System Temp Variable
by b10m (Vicar) on Apr 15, 2004 at 15:50 UTC

    I don't know too much about the Win32 stuff, but I "recently" needed something similar. See Win32::GetFolderPath() (e.g. at activestate.com) with the CSIDL_* variables

    --
    b10m

    All code is usually tested, but rarely trusted.
Re: Getting the System Temp Variable
by broquaint (Abbot) on Apr 15, 2004 at 15:33 UTC
    Check out tmpdir() from File::Spec.
    HTH

    _________
    broquaint

      tmpdir() returns the User TEMP setting, not the system TEMP setting.

        perhaps you should be more explicit about what you mean by the "System TEMP Environment Variable" or "the system TEMP setting".

        I, frankly, have no idea what you are talking about.

        There may be a default value of the $TEMP environment variable set on a system, but every OS I can think of lets uesrs override their environment variables.

        My guess is
        E:\>perl -le"$_=qq,$ENV{WINDIR}/temp,; print $_, q, => ,, -e $_;" E:\WINNT/temp => 1
        but it's just a guess, because I too have no clue what a "System Temp" directory is.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.