George_Sherston has asked for the wisdom of the Perl Monks concerning the following question:
print $q->header; print $q->start_html; while (<*.pl>) { next if $_ eq 'replace.pl'; print "<B>$_</B><BR>"; $old = $_; open GET, $old; print "opening $old<BR>"; $new = substr($old,0,(length $old) -2) . 'bak'; open PUT, ">$new"; print "opening $new<BR>"; print PUT $_ while <GET>; print "writing $old into $new<BR>"; close GET; close PUT; print "closing $old and $new<BR>"; open GET, "$new"; open PUT, ">$old"; print "reopening $old and $new<BR>"; while (<GET>) { $_ =~ s/c:\\perl\\bin\\perl/\/usr\/bin\/perl/; $_ =~ s/\("DBI:mysql:database=foo"\)/("DBI:mysql:database=foo" +,"bar","baz")/; print PUT $_; } print "altering lines in $new and writing to $old<BR>"; close GET; close PUT; print "closing $old and $new<BR>"; $cnt = chmod 0755, $old; if ($cnt) { print "changing file permissions for $old<BR>"; } else { print "cannot change file perms for $old<BR>"; } print "<BR>"; } print "DONE"; print $q->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: can't get chmod to work
by tachyon (Chancellor) on Sep 30, 2001 at 22:25 UTC | |
|
Re: can't get chmod to work
by Zaxo (Archbishop) on Oct 01, 2001 at 02:04 UTC | |
|
Re: can't get chmod to work
by C-Keen (Monk) on Sep 30, 2001 at 22:02 UTC | |
by George_Sherston (Vicar) on Sep 30, 2001 at 22:19 UTC | |
by tachyon (Chancellor) on Sep 30, 2001 at 22:30 UTC | |
|
Re: can't get chmod to work
by mandog (Curate) on Oct 01, 2001 at 06:16 UTC | |
|
Re: can't get chmod to work
by George_Sherston (Vicar) on Oct 02, 2001 at 03:42 UTC |