I cant figure out how to get perl to do this I am making a directory and then putting a file in it. I can do that due to much help from a few of you.
But now when I try to make the files and the directories world readable ( because it is for the web ) and let the program write the redirect file this happens
Content-type: text/html
Software error:
Permission denied at validate_school_data.cgi line 307.
For help, please send mail to the webmaster
am I chmod-ing the files and directories to the wrong thing. And if so what should it be set to and is there data on this elsewhere? Below is the culprit code Ln 307 is where it tries to write the redirect file.
#take school name and replace spaces with underlines
$dir =~ s/ /_/g;
mkdir( "$topdir/$dir" ,0 ) or die "Couldn't mkdir $topdir/$dir:
+$!";
$mode = 0755;
chmod( $mode, '$topdir/$dir');
#create redirect page for that directory
my $outputpage;
open(TEMPLATE, "default_redirect.html") or
die "can't open redirect page";
local($/) = undef;
$outputpage = <TEMPLATE>;
close(TEMPLATE);
$outputpage =~ s/\$name/$name/g;
open( REDIRECT, ">$topdir/$dir/index.html" ) or die "$!";
print REDIRECT $outputpage;
close REDIRECT;
chmod $mode, '$topdir/$dir/index.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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.