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

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";


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.

Helgi Briem
hbriem AT simnet DOT is

Replies are listed 'Best First'.
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- /var/log/newlogs/trashed, 32256 main::add_and_trash('/var/log/newlogs/Air- +6PM') called at line 42

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://293558]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2018-05-25 05:43 GMT
Find Nodes?
    Voting Booth?