I have two Windows questions:
  1. Is there a simple file test I can use on Win32 for read, write, execute, etc.? I'm doing this as a check that the dependent scripts are executable before trying to run them. If I were on unix, I'd just use (-x $filename) to see if a file is executable. However, I tried that with the following code, and it didn't work -
    my $filename = 'ShowPerm.pl'; if ( -x $filename ) { print "Filename $filename is executable \n"; }
    ShowPerm.pl is a script that I know works, and is in the same directory as the script. It seems like I may have to read in the ACL of the file and see if I'm in a group that has the appropriate level of access to that file. However, it can be a catch-22, as if I don't even have the ability to list the file, I wouldn't be able to check the ACLs on it, either. Besides, it just seems like a clumsy process with a lot of overhead. What would you all suggest?

  2. It seems that in all the Win32 modules I've looked at, all the pathnames have an escaped backslash, i.e. \\\\servername\\sharename if the actual path is \\servername\sharename. I understand that is to have it work within quotes, but it makes the code harder to read, and makes the configuration files a little confusing. Since I'm aiming this to be used by users who don't know perl who can just edit the config file, I'd prefer not to have duplicate slashes. Has anybody ran into this and have suggestions?

-- Burvil


In reply to Win32 File tests, pathnames by bowei_99

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.