Gossamer Forum
Home : General : Perl Programming :

Adding in code to chmod built files

Quote Reply
Adding in code to chmod built files
I hope I`m in the right forum for this.
I have a problem with the html pages built by Links2.0, they end up with the permissions rw------- which makes them unavailable to the web, I cant seem to find the answer and so after consulting my perl book I have added in code to chmod built pages, can some kind person let me know if this is correct, it runs fine on my win98 machine but permissions don`t have any effect on it anyway, but I`d like to know if its okay before I upload to my server (Unix, Apache), thanks for any help.P.S if anyone knows why my built pages are ending up with the above permissions (could it be a default set by my ISP) that would be great, built directories are fine. Unfortunately my isp is very unhelpful. This code comes from nph-build.cgi and builds the whats new pages.
line after # ADDED # is my code.
Code:
# Crete the new page, and do a bit of HTML work for the main page.
if ($build_span_pages) {
open (NEW, ">$build_new_path/$date$build_extension") or cgierr ("unable to open what's new page: $build_new_path/$build_index. Reason: $!");
$use_html ?
print qq|\tNew Links for <a href="$build_new_url/$date$build_extension" TARGET="_blank">$date</a>: $total\n| :
print qq|\tNew Links for $date: $total\n|;
print NEW &site_html_new;
close NEW;
# ADDED # to get permissions #
chmod(0666, "$build_new_path/$date$build_extension") or cgierr ("unable to chmod what's new page: $build_new_path/$date$build_extension. Reason: $!");

$main_link_results .= qq|<li><a href="$build_new_url/$date$build_extension">$long_date</a> ($total).|;
$main_total += $total;
}
else {
$link_results .= "</blockquote>";
}
}

if ($build_span_pages) {
$link_results = "<ul>$main_link_results</ul>";
$total = $main_total;
}
$title_linked = &build_linked_title ("New");

# Build the main What's New page.
open (NEW, ">$build_new_path/$build_index") or cgierr ("unable to open what's new page: $build_new_path/$build_index. Reason: $!");
print "\tTotal New Links: $total\n";
print NEW &site_html_new(@new_links);
close NEW;
# ADDED # to get permissions #
chmod(0666, "$build_new_path/$build_index") or cgierr ("unable to chmod what's new page: $build_new_path/$build_index. Reason: $!");

}
Thanks
chmod (yeah, what a coincidence!:-))