in reply to Re: Using File::Temp Names
in thread Using File::Temp Names

Yes, file handle is still alive in ScriptA. To check I browsed the file using scripts shown below, before and after passing it to ScriptB.
print "\n\n\n"; print "\n".getTempParamFileName()."\n"; open (AAA, "<".getTempParamFileName()); while(my $xxx=<AAA>){ print $xxx; } close AAA; ######### my @pmcmd=("$binDir/runWorkflow.pl", "-c", "$cluster", "-n", "$node", "-f", getWorkFlowFolder($feeder), "-p", getTempParamFileName(), + "-w", getWorkFlow($feeder)); $rc = PB::FileUtils::execute(\@pmcmd, $log); ######### print "\n\n\n"; print "\n".getTempParamFileName()."\n"; open (AAA, "<".getTempParamFileName()); while(my $xxx=<AAA>){ print $xxx; } close AAA;

Replies are listed 'Best First'.
Re^3: Using File::Temp Names
by Sidhekin (Priest) on Aug 01, 2006 at 03:54 UTC

    What's PB::FileUtils? Even google does not seem to know ...

    Does it execute runWorkflow.pl (ScriptB?) immediately and synchronously, on the same machine, under the same chroot, and with the same privileges (user/group)?

    Or, perhaps more easily answered, if you just run it with system {@pmcmd[0]} @pmcmd, does it see the file?

    print "Just another Perl ${\(trickster and hacker)},"
    The Sidhekin proves Sidhe did it!

      PB::FileUtils is our own module.
      ScriptsB is ran through above mentioned package as
      ... $cmd=join(' ', @$args); $output=`$cmd`; ...
      Probably this is opening child process and executing the ScriptB using the temp filename passed as a parameter. What is the solution in this case. How can child process access the temp file?

        If this is happening synchronously in the same process, the child should be able to read the file. So, does it happen synchronously? Is it in the same process?

        Does the child (ScriptB) drop privileges? Does it run under a different chroot? How does it try to open the file?

        Either the child or PB::FileUtils is doing something here to make the file (seem?) inaccessible, but you haven't shown us that particular code, so I cannot say what.

        If you would try running the child with system {@pmcmd[0]} @pmcmd, as I suggested, we might be able to find whether or not the "something" in question is found in PB::FileUtils. But even then, I would have to see the code from the guilty party (be it PB::FileUtils or ScriptB) before I can say what precisely is wrong.

        print "Just another Perl ${\(trickster and hacker)},"
        The Sidhekin proves Sidhe did it!