in reply to Perl Permissions

If you're not allowed to open that file, it's very likely you're also not allowed to change the permissions. Check the return code of chmod:
chmod(0777,$currentlog) or die "Can't change permissions: $!"
As noted above there is almost no reason to do the chmod at all: unless you've got a very strange system administrator, you won't be able to change what you can't read.

Replies are listed 'Best First'.
Re^2: Perl Permissions
by blundell (Novice) on Dec 03, 2006 at 13:52 UTC
    I put that line in mycode but it just goes past it and gives' me the same error:
    Permission denied at temp.pl line 20
    Does this mean i do have permission do change its permissions. I dont see how i have to contact the admin as this is MY computer nobody uses it except me :/ so i'm really confused why i dont just have permission to do everything with everything.
      Permission denied at temp.pl line 20
      You know, it would be very helpful if you provided a complete program (as short as possible!) that does only the chmod & open of one file and nothing else. Also provide the list of owners & permissions for the file in question and the directory it's in.

      i'm really confused why i dont just have permission to do everything with everything.
      Probably because the sysadmin doesn't have the time to fix all those installations that get completely scrambled when users are allowed to do anything and everything to it.

        #!/usr/bin/perl use Win32::Process::Info; #Requests to use the +Win32 Mod use Date::EzDate; #Requests to use the +date mod use File::Copy; my $printinfo = Win32::Process::Info->new(); #Gets the system proc +ess info my @info = $printinfo->GetProcInfo(); #Stored to an array my $currentdate = Date::EzDate->new(); #Loads the current Da +te an Time # #Manageing Log Files Chronologically # $hour = 2; until ($hour > 26) #Loop to r +ead all log files { opendir(LOGS, "/perl/ass/")|| die "dir not found"; #Opens the + folder containing the days log files @logfiles = readdir(LOGS); #Puts the +name of all files into an array closedir(LOGS); $currentlog = "/perl/ass/@logfiles[$hour]"; chmod (0777, $currentlog) or die "Can't change permissions: $!"; + #Gives everyone all permissions on all fi +les in the folder open(CURRENTLOG, $currentlog)|| die "file not found: $!"; $firstline = <CURRENTLOG>; $date = substr($firstline,0 ,2); $hour++; }
        I can't give you a list of owner's and permissions as i'm working in windows and do not know the commands sorry.
        http://img.photobucket.com/albums/v230/blundell/errorperl.jpg