Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

File created with system command does not exist

by RuntimeError (Acolyte)
on Feb 07, 2014 at 09:24 UTC ( [id://1073838]=perlquestion: print w/replies, xml ) Need Help??

RuntimeError has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys, I hope to find some help here. My problem: I used the system command to run an external program which itself writes some other files according to given parameters. However the files that the external program writes are non existant if you try to use them (vi filename, chmod xxx filename, etc.) however the ls command clearly displays them in the directory. If the external program is run by itself not from Perl then the files are useable. What exactly might go wrong? Are the files wrongly linked or what do you suggest to help myself? Thank you very much. Runtime
  • Comment on File created with system command does not exist

Replies are listed 'Best First'.
Re: File created with system command does not exist
by baxy77bax (Deacon) on Feb 07, 2014 at 09:31 UTC
    Is it possible that it is a permission issue?? though wrong path seams more likely. If you can see them with ls then the path shouldn't be the problem. could you give us ls -al printout.
      Argh... I am sorry to bother you guys... Whitespace beeing the problem. If you run the program with ... -o output ... it works fine but if I need to run it with Perls system command then it has to be ... '-o', $name, ... and not ... "-o $name" ... else it would introduce whitespace before the name of the file.
Re: File created with system command does not exist (pwd/cwd)
by Anonymous Monk on Feb 07, 2014 at 09:29 UTC

    What you think your pwd/cwd is different from what your program thinks are its pwd/cwd; your files are probably in a different folder

Re: File created with system command does not exist
by sundialsvc4 (Abbot) on Feb 07, 2014 at 15:32 UTC

    This may sound silly, but it works:   print STDERR the actual string that you intend to execute, then copy/paste that literal string to a new terminal session and try it.   Inevitably, you will right-away discover one of two things:   that the string isn’t as you thought it would be, or that when run by an actual shell it produces a syntax error of some kind.   So, avoid guessing ... try it.   (No one will see you say, “d’oh!”)

Re: File created with system command does not exist
by 2teez (Vicar) on Feb 07, 2014 at 16:30 UTC

    Hi RuntimeError,
    ..I used the system command to run an external program which itself writes some other files according to given parameters..

    Am only wondering, why can't perl do the writing of the files? Why use another program called within perl? If the job is simple enough for perl to handle, why all the troubles? Just thinking though!

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1073838]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-16 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found