Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: system( 'mv ...' ) not working?

by helgi (Hermit)
on Sep 23, 2003 at 16:20 UTC ( #293558=note: print w/ replies, xml ) Need Help??


in reply to system( 'mv ...' ) not working?

Replace the system ($cmd) bits with

system ($cmd1) == 0 or die "Cannot $cmd1:$?\n";

and

system ($cmd2) == 0 or die "Cannot $cmd2:$?\n";

As you well know Bob, the error from child processes is contained in the $? variable, also known as $CHILD_ERROR.


--
Regards,
Helgi Briem
hbriem AT simnet DOT is


Comment on Re: system( 'mv ...' ) not working?
Select or Download Code
Re: Re: system( 'mv ...' ) not working?
by Grygonos (Chaplain) on Sep 23, 2003 at 16:55 UTC
    re: the comment about the CGI user not having permissions

    I ran into this problem executing a move on a file that was uploaded via CGI. I was running apache and the file was being moved by user Apache. So I put Apache in my group and gave 775 permission to the directory. I don't know how good of a thing that is to do, but it did fix my problem.

    Additionally, when this happened to me, the system call didn't gen any error,but of course I didn't have fatals to Browser turned on. Have it upload to a 777 directory and see who owns the file, ala ls -l.

Re: Re: system( 'mv ...' ) not working?
by ramses0 (Initiate) on Sep 23, 2003 at 18:40 UTC
    This will teach me to look in the error logs... I tried the system() == 0 or die, and that helped... looks like the move target is not getting properly passed to the system call (ooh! or there is an extra embedded newline that the browser strips out of the "mv" command when copying!!!). I'll try to fix that. What's the "carp to browser" stanza? I'll try to look that up as well so it'll be easier to spot these next time. Thanks for the confessional debugging! --Robert
    mv: missing file argument Try `mv --help' for more information. sh: /var/log/newlogs/trashed: is a directory Uncaught exception from user code: Cannot: mv /var/log/qarun-newlogs/Static-Air-10.16.79.90 /var/log/newlogs/trashed, 32256 main::add_and_trash('/var/log/newlogs/Air-10.16.79.90-0922_125 +6PM') called at logloader.pl line 42

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://293558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (20)
As of 2014-07-28 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (206 votes), past polls