You need to go into a bit more detail than "fail to work". What error message(s) are you getting? Does what gets run fork off any persistent children (i.e. could you possibly be hitting up against either a per-user or machine wide process limit)? Are you running this in a non-shell environment (e.g. from cron or as a CGI)?
See also How (Not) To Ask A Question.
| [reply] |
I don't think it forks off any persistent children. I've my main script, it executes a child process, and regains control after the process is done executing. So, there should only one active child process at a time.
I'm running this in tcsh.
I don't get any error messages. The script just continues on, but I know there's a problem because the file the system() command was supposed to generate doesn't appear.
Anyway I can capture the errors? Sorry, I'm way noob. Please be patient with me
| [reply] |
I think you'll need to post your code, if that's possible. Otherwise, there are so many reasons it could be failing. Is it small enough of a program that you can post it here? If not, can you trim it down in size to the point that you can?
In the absence of seeing what you've written, there are a few things which come to mind:
- Are you running out of processes somehow? Check with ps
- Is the system command failing at some point? Check by printing out the exit value from the system call; it's saved to the special variable $?. In fact, if you haven't done so already, try reading about the system function with: perldoc -i system.
- Are you able to "run the string outside of the perl script" even after it has started failing from within Perl?
But these are just thoughts ... I think once you post an actual example of the code, and especially if it's something that can be duplicated by one of the others here, you'll likely be pleased with how quickly we can help you detect the problem.
@ARGV=split//,"/:L";
map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"
| [reply] |
Liverpole,
I forgot about perldoc, as I usually use the o'reilly book. Learned about the $! variable that way.
It turns out my problem was a memory allocation error. I'm using one of my company's proprietary modules. Turns out every version except the latest release had a bug in it that would act as a memory sink. Finally tracked down one of the developers and he let me in on the joke.
Thanks for your help. I mainly work on IC's, and software's not my forte. Was stuck for a while and just had no idea how to proceed. I appreciate your assistance
| [reply] |
To expand on what [id://Fletch] and [id://liverpole] have said, you should try to post the offending code here. However, before you do that, you really need to read How (Not) To Ask A Question, as it will help you avoid common mistakes that could result in unhelpful answers. Avoid painful lumps and bruises. Read How (Not) To Ask A Question.
I suggest that you pare down your code until it is the shortest possible script, yet still shows the error. If you haven't seen the answer then, go ahead and post the code here. In my experience (and many others here), the simple act of digging out the wayward code is enough to show you the error. Often it's obvious, but lost among all the other stuff going on.
And when you do post the code, use code tags: '<c>' and '</c>'. This will allow you to format the code so that it displays well, something your fellow monks will appreciate.
| [reply] |
Maybe I wasn't clear, but $! solved the problem for me. Again, it was a memory allocation error.
I would have posted the code if I thought it would've helped. But I was essentially looping on a print `$foo` command where $foo was a command execute proprietary software. Furthermore, that command worked for 12 cycles and also worked when I ran it outside of the script so I didn't think it was a syntax problem. I was just looking for more info on the nuances of running system() and commands through backticks. I did read How (Not) To Ask a Question, too.
Anyways, it's been fun. Back to the world of hardware for me.
| [reply] |