[Bioperl-l] general perl question

Smithies, Russell Russell.Smithies at agresearch.co.nz
Wed Jun 2 05:00:33 UTC 2010


It's not really a BioPerl question, more one of reading the Perl documentation.


There's several ways of executing commands from Perl:
*  The exec() function executes a system command and never returns
*  system() exactly the same thing as exec(), except that a fork is done first, and the parent process waits for the child process to exit
*  backticks
   Eg. $date=`/usr/bin/date`;
* open() and parse
   Eg. open PS, "/usr/bin/ps -ef |";

Up to you which you use,

--Russell

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Dimitar Kenanov
> Sent: Wednesday, 2 June 2010 4:34 p.m.
> To: 'bioperl-l at bioperl.org'
> Subject: [Bioperl-l] general perl question
> 
> Hi guys,
> firstly i am sorry ive sent this email first to the wrong
> email(bioperl-l-request at lists.open-bio.org).
> 
> Secondly, i am sorry to bother you with such problem but i do not know
> how to google that one :)
> Here is the problem. I want to start several simultaneous processes
> through my script but i found i cant do that unless i start them as
> background processes because otherwise 'system' waits for the process to
> exit. Now i use something like this:
> 
>      my @args=("$program $seqinput $$specname $eval &");
>      system(@args) == 0 or die "system @args failed: $!";
> 
> But that is a bit weird when i want to terminate the program then all
> the processes are still running and i have to kill them manually.
> 
> Is there a way to start several simultaneous processes without '&'?
> 
> Thank you for your patience and help
> 
> Greetings
> Dimitar
> 
> --
> Dimitar Kenanov
> Postdoctoral research fellow
> Protein Sequence Analysis Group
> Bioinformatics Institute
> A*STAR, Singapore
> tel: +65 6478 8514
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================




More information about the Bioperl-l mailing list