[Bioperl-l] Segmentation fault

Andreas Kahari ak at ebi.ac.uk
Mon Apr 12 04:42:59 EDT 2004

On Sun, Apr 11, 2004 at 09:02:26PM +0200, stephan rosecker wrote:
> Hi list,
> while( my $result = $in->next_result )
>         {
>                 while( my $hit = $result->next_hit )
>                         {
>                         print $result->query_name."\n";
>                         wait;
>                         # $hit->DESTROY();
>                         last;
>                         }
>         }
> exit;

I think you're misunderstanding the wait() function, it does
not "wait" for user input, it waits until all child processes
(created with fork()) has died.  You probably want to do
something like this instead (also note that exit() is not needed
at the end of a Perl program):

while (my $result = $in->next_result()) {
    while (my $hit = $result->next_hit()) {
	print $result->query_name(), "\n";

	print "Press return to continue\n";
	my $dummy = <STDIN>;

You shouldn't [almost] ever have to call the destructor of an
object in Perl, so that's certainly not the correct solution.

In theory, calling wait() without first having called fork()
(which you shouldn't do anyway) should be safe and do nothing.
I'm however not sure about all the quirks of that old version of
Perl on Irix...

Hope this helps.


| () | Andreas Kähäri      EMBL, European Bioinformatics Institute
|()()|                     Wellcome Trust Genome Campus
| () | DAS Project Leader  Hinxton, Cambridgeshire, CB10 1SD
|()()| Ensembl Developer   United Kingdom

More information about the Bioperl-l mailing list