In our discussion last week Re^6: Installing a config file during module operation of how to install a config file during module operation, xdg provided this solution:

> perl -MWin32=CSIDL_LOCAL_APPDATA -le "print Win32::GetFolderPath(CSI +DL_LOCAL_APPDATA)" C:\Documents and Settings\DGolden\Local Settings\Application Data

This works on my system as well, but I'm having trouble translating that to code inside a program. Consider this:

my $realhome; if ($^O eq 'MSWin32') { use Win32 ('CSIDL_LOCAL_APPDATA'); $realhome = Win32::GetFolderPath('CSIDL_LOCAL_APPDATA'); } (defined $realhome) ? print "realhome: $realhome\n" : print "\$realho +me not defined\n";

This is generating a warning, then producing an answer suggesting that the CSIDL_LOCAL_APPDATA constant was not, in reality, imported:

Argument "CSIDL_LOCAL_APPDATA" isn't numeric in subroutine entry at im +port.pl line 9. realhome: C:\Documents and Settings\kbuser\Desktop

I'm puzzled about the "isn't numeric" warning: As I understand it, it's not supposed to be numeric because it'a a path (and I double-check Microsoft's information http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp on this).

What am I not getting? Thanks.

Jim Keenan

Update:Corrected typo in title.


In reply to Win32 CSIDL_LOCAL_APPDATA by jkeenan1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.