|Welcome to the Monastery|
File::Inplace module is altering file permissions/ownershipby mojodaddy (Pilgrim)
|on Mar 04, 2007 at 03:44 UTC||Need Help??|
mojodaddy has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings o wise ones,
I have script that uses the File::Inplace and WWW::Mechanize modules. Inplace.pm opens and edits an html file and saves it as /var/www/mypage.html (i.e. Apache's server root), whereupon Mechanize browses to it and attempts to interact with it. Instead, it gets a 403 Forbidden error.
Upon investigating I find that the file permissions on mypage.html are set to 600. If I chmod it to 777 and then just have Mechanize browse to it (without Inplace.pm editing it first) it loads fine. But after Inplace is finished with it, the permissions are back to 600 again and Mechanize gets the 403 error. So, what is Inplace doing and how and why is it changing permissions? And how can I stop it?
(By the way, if I chown the file to any UID I want, even root, the file still comes back chmoded to 600 and owned by mojodaddy.)
Hey -- just thought of this: maybe I could somehow have the script change the permissions on the file before Mechanize browses to it... (but this seems kind of like putting "use warnings" in your script but then commenting it out when you get warnings...), and I'm sure I could do this without Inplace.pm, but I'd really rather understand what's going on and see if there's an easier fix before rewriting the whole script.
My thanks, wise ones, for any assistance you may be willing to bestow.