access pref. and temp dir on windows

L

Larry

Hi,

I'm coding a little script for windows. I'd like to know how to save some
data on a given preference file and some other data on a temp file. Can it
actually be done?

thanks ever so much
 
J

Jürgen Exner

Larry said:
I'm coding a little script for windows. I'd like to know how to save some
data on a given preference file and some other data on a temp file. Can it
actually be done?

Maybe I don't see the forest for the trees, but what is the problem?

perldoc -f open
perldoc -f print
should have all you need. Maybe also have a look at
perldoc -q temp: "How do I make a temporary file name?"

jue
 
L

Larry

Jürgen Exner said:
Maybe I don't see the forest for the trees, but what is the problem?

perldoc -f open
perldoc -f print

I am so sorry...I meant to say: where are those directories on windows?

I tried accessing temp dir on win by usinf File::Spec

where the dir for preferences?

thanks
 
J

Jürgen Exner

Larry said:
I am so sorry...I meant to say: where are those directories on windows?

Same place as when programming in any other programming language. Why
would they change location just because you are using Perl?
I tried accessing temp dir on win by usinf File::Spec

where the dir for preferences?

Try "set" from the command line. Usually there are some environment
variables for those values.

jue
 
L

Larry

What do you mean by 'preferences'?

You may want File::HomeDir.

I guess on windows vista it should be: C:\Users\<user>\AppData\... (AppData
supposed to be hidden)
 
L

Larry

File::HomeDir->my_data returns what on a default XP install would be
called

C:\Documents and Settings\<user>\Local Settings\Application Data

and you can retrieve the non-Local Settings path with

great! that's what I was looking for
 
B

Bart Lateur

Larry said:
I am so sorry...I meant to say: where are those directories on windows?

See File::Temp and File::HomeDir on CPAN.

Less portable, it might not even work on somebody else's PC, is to use
some data available in the environment variables, see %ENV (perlvar).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top