in reply to invoke tempdir() failed

You don’t tell us the context in which the request is being attempted.   Is this e.g. a web-server process running as nobody?   Where is the process attempting to create the file, and what are the effective-user’s permissions there?

Replies are listed 'Best First'.
Re^2: invoke tempdir() failed
by marscld (Beadle) on Oct 08, 2011 at 06:47 UTC
    Sure, it is the apache web server who is invoking a section of code to create a temporary directory and copy some zip files into it. The apache server uses the same account as the zip file owner.
Re^2: invoke tempdir() failed
by marscld (Beadle) on Oct 08, 2011 at 08:49 UTC
    The web server account is the same as the one who creates temporary directory in Solaris command line directly. It is weird that the same programme works by running 'perl test.pl',however, when the same code section is invoked in a web-based procedure, I can't find the temporary directory by 'ls -l /tmp/temp_dir_created_by_File_Temp'.
    #!/usr/bin/perl use strict; use warnings; use File::Temp qw/ tempfile tempdir /; my $temp_dir = tempdir(); $temp_dir =~ /\/tmp\/(.*)/; my $temp_dir_name = $1; my $grep_str = "ls -l /tmp | grep $1"; my $res2 = `$grep_str`; print "[$grep_str]grep result [$res2]\n";
      ugh, try this
      #!/usr/bin/perl -- use strict; use warnings; use Cwd; use File::Temp qw/ tempfile tempdir /; print cwd(), "\n"; my $temp_dir = tempdir(); chdir $temp_dir or die "Cannot chdir to '$temp_dir': $!"; print cwd(), "\n"; __END__
        thanks for the advice !