Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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

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- /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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-09-20 18:01 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (160 votes), past polls