Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

access pref. and temp dir on windows

0 views
Skip to first unread message

Larry

unread,
Nov 22, 2009, 10:10:11 AM11/22/09
to
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�rgen Exner

unread,
Nov 22, 2009, 1:43:28 PM11/22/09
to
"Larry" <dontme...@got.it> wrote:
> 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

Sherm Pendley

unread,
Nov 22, 2009, 3:37:57 PM11/22/09
to
"Larry" <dontme...@got.it> writes:

> 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?

Yes.

sherm--

Larry

unread,
Nov 22, 2009, 6:32:40 PM11/22/09
to

"J�rgen Exner" <jurg...@hotmail.com> ha scritto nel messaggio
news:0d1jg59ufj7g35so5...@4ax.com...

> "Larry" <dontme...@got.it> wrote:
>> 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

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

Ben Morrow

unread,
Nov 22, 2009, 7:40:29 PM11/22/09
to

Quoth "Larry" <dontme...@got.it>:

What do you mean by 'preferences'?

You may want File::HomeDir.

Ben

Tad McClellan

unread,
Nov 22, 2009, 10:24:03 PM11/22/09
to
Larry <dontme...@got.it> wrote:

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


If you were programming in Python or Visual Basic, would
it be different directories?


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"

J�rgen Exner

unread,
Nov 23, 2009, 12:39:52 AM11/23/09
to
"Larry" <dontme...@got.it> wrote:
>
>"J�rgen Exner" <jurg...@hotmail.com> ha scritto nel messaggio
>news:0d1jg59ufj7g35so5...@4ax.com...
>> "Larry" <dontme...@got.it> wrote:
>>> 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
>
>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

Larry

unread,
Nov 23, 2009, 4:52:59 AM11/23/09
to

"Ben Morrow" <b...@morrow.me.uk> ha scritto nel messaggio
news:t82pt6-...@osiris.mauzo.dyndns.org...

>
> Quoth "Larry" <dontme...@got.it>:
>>
>> "J�rgen Exner" <jurg...@hotmail.com> ha scritto nel messaggio
>> news:0d1jg59ufj7g35so5...@4ax.com...
>> > "Larry" <dontme...@got.it> wrote:
>> >> I'm coding a little script for windows. I'd like to know how to save
>> >> some

> 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)

Ron Bergin

unread,
Nov 23, 2009, 10:51:53 AM11/23/09
to
On Nov 23, 1:52 am, "Larry" <dontmewit...@got.it> wrote:
> "Ben Morrow" <b...@morrow.me.uk> ha scritto nel messaggionews:t82pt6-...@osiris.mauzo.dyndns.org...
>
>
>
> > Quoth "Larry" <dontmewit...@got.it>:
>
> >> "Jürgen Exner" <jurge...@hotmail.com> ha scritto nel messaggio
> >>news:0d1jg59ufj7g35so5...@4ax.com...

> >> > "Larry" <dontmewit...@got.it> wrote:
> >> >>   I'm coding a little script for windows. I'd like to know how to save
> >> >> some
> > 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)

Have you tried:

my $tmpdir = $ENV{TEMP};

Ben Morrow

unread,
Nov 23, 2009, 1:31:47 PM11/23/09
to

Quoth "Larry" <dontme...@got.it>:

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

Win32::GetFolderPath(Win32::CSIDL_APPDATA())

Ben


Larry

unread,
Nov 23, 2009, 6:32:25 PM11/23/09
to

"Ben Morrow" <b...@morrow.me.uk> ha scritto nel messaggio
news:j11rt6-...@osiris.mauzo.dyndns.org...
>

> 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

Bart Lateur

unread,
Nov 24, 2009, 5:15:35 AM11/24/09
to
Larry wrote:

>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).

--
Bart.

0 new messages