Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 19:16, punit jain wrote: for my $step ( @steps ) { last if $STOP; I would think the issue here is if the list is 30K long and we are still at 2K why would be really like to process whole list ? We can die or handle exit of the script gracefully in my understanding. Is my und

Re: Time based processes

2012-07-21 Thread punit jain
> > > for my $step ( @steps ) { >last if $STOP; > > > I would think the issue here is if the list is 30K long and we are still > at 2K why would be really like to process whole list ? > We can die or handle exit of the script gracefully in my understanding. > > Is my understanding correct here

Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 16:20, Dr.Ruud wrote: On 2012-07-21 15:41, punit jain wrote: You can let the ALRM-sub simply set a global variable, like $STOP. Your process should check this before starting a next iteration. I suppose this needs to be set in parent process which means Signal needs to be invok

Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 15:41, punit jain wrote: You can let the ALRM-sub simply set a global variable, like $STOP. Your process should check this before starting a next iteration. I suppose this needs to be set in parent process which means Signal needs to be invoked in parent. Is my understanding corr

Re: Time based processes

2012-07-21 Thread punit jain
Also for :- > for my $step ( @steps ) { last if $STOP; I would think the issue here is if the list is 30K long and we are still at 2K why would be really like to process whole list ? We can die or handle exit of the script gracefully in my understanding.

Re: Time based processes

2012-07-21 Thread punit jain
For the case which you mentioned :- >You can let the ALRM-sub simply set a global variable, like $STOP. Your process should check this before starting a next iteration. I suppose this needs to be set in parent process which means Signal needs to be invoked in parent. Is my understanding correct ?

Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 15:30, Dr.Ruud wrote: On 2012-07-21 14:50, punit jain wrote: *(B) How do I stop the script graceful without killing the processes and stop from other sunbprocesses being spanned ?* Just let $SIG{INT} and $SIG{TRM} also set $STOP. s/TRM/TERM/ See `kill -l` for the names. Pe

Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 14:50, punit jain wrote: *(B) How do I stop the script graceful without killing the processes and stop from other sunbprocesses being spanned ?* Just let $SIG{INT} and $SIG{TRM} also set $STOP. Per child you can update $0, to be able to watch the status of the process in ps.

Re: Time based processes

2012-07-21 Thread Dr.Ruud
On 2012-07-21 14:50, punit jain wrote: I have a requirement where I need to run my perl script for x hours You can let the ALRM-sub simply set a global variable, like $STOP. Your process should check this before starting a next iteration. Beware that each child needs its own alarm. The parent

Time based processes

2012-07-21 Thread punit jain
Hi, I have a requirement where I need to run my perl script for x hours ( which should be configurable ). Since the script processes thousand's of accounts, it will definitely take more than x hrs. There are 2 parts of question : - *(A) How to stop after x hours. I cannot run under crontab as X

Re: Storage using Storable

2012-07-21 Thread punit jain
Thanks!!! really helpful

Re: Storage using Storable

2012-07-21 Thread Dr.Ruud
On 2012-07-20 13:05, punit jain wrote: I have a multiple processes which are modifying hash of hash of array. For multiprocessing I am using Parallel::ForkManager The requirement is I set Max processes to say 5. Each process is fired by the script and max 5 parallel process runs and it performs

Re: Concatenation in Perl

2012-07-21 Thread Dr.Ruud
On 2012-07-19 12:37, punit jain wrote: if( @folders ) { map {$query .= "not in:$_ and"; } @folders; print "\n $query \n"; } 'if' is not a function, so put a white space after it. But in this case you don't need the 'if' at all. Don't use map in void context. Alternative code

Re: Can't delete row with DBI.pm

2012-07-21 Thread Dr.Ruud
On 2012-07-18 01:18, Tessio F. wrote: Hello, I have an database with a two column primary key: create database contacts( username char(20) not null, contact char(20) not null, primary key (username, contact) ); I'm trying to delete a row with the command: (connect to db..) my $sth = $dbh->prepa