in reply to does not write to file anymore

Nothing ever just suddenly stops, there is always a reason. Could your disk be full? Are you writing to a file but $mainpath does not point where you think? Is mainpath a relative path or a full path. Why don't you see what Perl reckons:

use Cwd; open F, ">$mainpath" or die "Open $!\n"; print F "Testing\n" or die "Print $!\n"; close F or die "Close $!\n"; print "CWD: ", cwd(), "\n$mainpath\n"; open F, $mainpath; print while <F>; close F;

cheers

tachyon

Replies are listed 'Best First'.
Re^2: does not write to file anymore
by BzBeauty (Sexton) on Nov 05, 2004 at 01:03 UTC
    Ok,

    I put the code in

    close F or die "Close $!\n";

    And it died at this point. How do I check the $! ???

    thanks

      That statement should print whatever is in $! and $! should be set if the close fails. Have you checked to see if your disk is full? On *nix type df. If you have disk space try (on the command line)

      echo testing > somefile cat somefile

      Does that work?

      As well as checking disk free with df check quotas with quota

      quota your_username quota nobody quota apache
        ok

        I hadn't checked the disk space cause I was able to continue modifing the cgi file, and normally when I'm out of space I can't do that. But I decided to check it just in case. And voila! I'm out of space.

        Thank you oh so very much!