Think about Loose Coupling | |
PerlMonks |
Win32::FileSecurity weirdnessby keymon (Beadle) |
on Oct 03, 2005 at 05:53 UTC ( [id://496824]=perlquestion: print w/replies, xml ) | Need Help?? |
keymon has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks, I am trying to do a simple thing: change the permissions on a directory tree under WinXP to a standard value. So I started with Win32::FileSecurity module, and the idea was simple: I'll read in the permissions from 2 files (for directories and files), and using File::Find, just traverse the tree and if the permissions don't match, just Set() them to the wanted ones. Easy, right? But no..... The script is pasted below. Here's the weird thing. The hash %dhash contains key-value pairs, like these: BUILTIN\Administrators => 270467583 NT AUTHORITY\SYSTEM => 270467583 Everyone => 1245631I copy these values into a separate hash, called %hash (sorry about the naming). After the call to Set, the keys in all of my hashes get changed from something like this "BUILTIN\Administrators" to "BUILTIN Administrators". Naturally, the Set() fails in the next iteration. But I am really confused as to why strings that are not even a part of the manipulation (keys in %dhash and %fhash) are being modified? -- confused in win32land
Code is below. It isn't a shining beacon of good coding, but I've lost half of my hair today, so my head indeed is shining right now...
Back to
Seekers of Perl Wisdom
|
|