How do I control a C programme from perl?

2010-05-13 Thread robert Key
Hi, I want to capture UNBUFFERED output from a C programme and then control it depending on its output. Problem is nothing seems to unbufferd the output from the C programme. Only when the child has finished executing do I get all the output which is too late. The C programe is just like

Re: Can we perform substitution to the matched pattern inside a regular expression so that the modified pattern gets returned instead of earlier matched one ?

2010-05-13 Thread C.DeRykus
On May 5, 7:02 am, learn.tech...@gmail.com (Amit Saxena) wrote: On Fri, Apr 30, 2010 at 10:40 PM, C.DeRykus dery...@gmail.com wrote: On Apr 30, 3:55 am, learn.tech...@gmail.com (Amit Saxena) wrote: Hello everybody, Can we perform substitution to the matched pattern inside a regular

Re: fork, read from child process and timeout

2010-05-13 Thread C.DeRykus
On May 11, 9:29 pm, dery...@gmail.com (C.DeRykus) wrote: On May 11, 12:56 am, weizhong@gmail.com (Weizhong Dai) wrote: ... $pid = open(my $readme, program arguments |)                   or die Couldn't fork: $!\n; my $timeout = 5; eval {     local $SIG{ALRM} = sub { die timeout; };  

Re: Perl general questions

2010-05-13 Thread Akhthar Parvez K
Hi Uri, Not sure if it was because I've been dealing with mainly web servers for the past few years, but I always read your name as U-R-I instead of Uri. :-) It looks like you've got a name that's relevant to your profession, most of us didn't have that fortune! On Thursday 13 May 2010, Uri

Re: regex to add trailing slash if doesn't end in html

2010-05-13 Thread C.DeRykus
On May 12, 1:15 pm, fulls...@me.com (Brian) wrote: Hi all. I think this should be relatively simple but i just can't figure it out. I have a list of files and directories. The files will all end in .html. All the remaining elements in the list are assumed to be directories. I'm looking for

Re: Perl general questions

2010-05-13 Thread Shlomi Fish
On Thursday 13 May 2010 11:59:36 Akhthar Parvez K wrote: Hi Uri, APK 3) Also, am I correct in guessing that the memory that's used to APK allocate a variable defined with 'my' will be freed up once the APK current lexical scope is exited? true but with a file lexical (or global)

Re: fork, parallel and global values

2010-05-13 Thread raphael()
On Tue, May 11, 2010 at 1:23 AM, C.DeRykus dery...@gmail.com wrote: On May 10, 7:07 am, raphael.j...@gmail.com (raphael()) wrote: Hello, -- CODE -- #!/usr/bin/env perl use strict; use warnings; use Parallel::ForkManager; # Parallel::ForkManager my $pfm =

Re: regex to add trailing slash if doesn't end in html

2010-05-13 Thread Shlomi Fish
On Thursday 13 May 2010 07:05:31 C.DeRykus wrote: On May 12, 1:15 pm, fulls...@me.com (Brian) wrote: Hi all. I think this should be relatively simple but i just can't figure it out. I have a list of files and directories. The files will all end in .html. All the remaining elements in the

Re: Perl general questions

2010-05-13 Thread Akhthar Parvez K
On Thursday 13 May 2010, Shlomi Fish wrote: Then it is very likely that the memory allocated to the mem pointer will not be returned to the kernel due to the nature of malloc() and how it is an abstraction above sbrk(): http://linux.die.net/man/2/sbrk perl 5 makes use of sbrk

Re: Perl general questions

2010-05-13 Thread Akhthar Parvez K
On Thursday 13 May 2010, Akhthar Parvez K wrote: On Thursday 13 May 2010, Shlomi Fish wrote: Then it is very likely that the memory allocated to the mem pointer will not be returned to the kernel due to the nature of malloc() and how it is an abstraction above sbrk():

Re: How do I control a C programme from perl?

2010-05-13 Thread Robert Wohlfarth
On Thu, May 13, 2010 at 1:21 AM, robert Key robertgordon...@yahoo.comwrote: Hi, I want to capture UNBUFFERED output from a C programme and then control it depending on its output. Problem is nothing seems to unbufferd the output from the C programme. Only when the child has finished

RE: How do I control a C programme from perl?

2010-05-13 Thread Bob McConnell
From: robert Key I want to capture UNBUFFERED output from a C programme and then control it depending on its output. Problem is nothing seems to unbufferd the output from the C programme. Only when the child has finished executing do I get all the output which is too late. The C

Re: Can we perform substitution to the matched pattern inside a regular expression so that the modified pattern gets returned instead of earlier matched one ?

2010-05-13 Thread C.DeRykus
On May 5, 7:02 am, learn.tech...@gmail.com (Amit Saxena) wrote: On Fri, Apr 30, 2010 at 10:40 PM, C.DeRykus dery...@gmail.com wrote: On Apr 30, 3:55 am, learn.tech...@gmail.com (Amit Saxena) wrote: Hello everybody, Can we perform substitution to the matched pattern inside a regular

Re: Perl general questions

2010-05-13 Thread Shlomi Fish
On Thursday 13 May 2010 14:56:37 Akhthar Parvez K wrote: On Thursday 13 May 2010, Akhthar Parvez K wrote: On Thursday 13 May 2010, Shlomi Fish wrote: Then it is very likely that the memory allocated to the mem pointer will not be returned to the kernel due to the nature of malloc() and

Re: How do I control a C programme from perl?

2010-05-13 Thread robert Key
On 13/05/2010 14:16, Bob McConnell wrote: From: robert Key I want to capture UNBUFFERED output from a C programme and then control it depending on its output. Problem is nothing seems to unbufferd the output from the C programme. Only when the child has finished executing do I get all the

Re: Perl general questions

2010-05-13 Thread Uri Guttman
APK == Akhthar Parvez K akht...@sysadminguide.com writes: APK Yes, I think the memory space allocated by a process using APK malloc() can't be really freed up until the calling process is APK terminated. And processes that uses mmap() can unmap those chunk APK size of memory when it's

perl in Makefile

2010-05-13 Thread Patrick Dupre
Hello, How can I execute the following command in a Makefile ? CORE_INC=`perl -MConfig -MFile::Spec::Functions -le 'print catfile($Config{archlib},CORE)')` The problem is with the $Config ! thank -- --- == Patrick

Re: How do I control a C programme from perl?

2010-05-13 Thread Eitan Adler
The C programme looks like this (very simple) #include stdio.h int main() {        int i;        char s[20] = hello from c;        for (i = 0; i 15; i++) {                sleep(1);                printf(%s %d\n, s, i);        }        return 0; } and yet I only get the output to perl