Bio::Tools::StateMachine::IOStateMachine - IO-based implementation of AbstractStateMachine


    use Bio::Tools::IOStateMachine;

    # A state machine that reads input from a file
    my $sm = Bio::Tools::IOStateMachine->new( -file => 'data.txt' );

    # A state machine that reads input from a STDIN
    my $sm = Bio::Tools::IOStateMachine->new();

    # A state machine that reads input from a STDIN
    # and times out if input doesn't arrive within 30 seconds.
    my $sm = Bio::Tools::IOStateMachine->new( -timeout_sec => 30 );


An implementation of AbstractStateMachine that samples an input stream to determine whether a state change has occurred.


To get a feel for how to use this, have look at Bio::SearchIO::psiblast which subclasses IOStateMachine.


Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.              - General discussion  - About the mailing lists

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web:                         


Steve Chervitz, <>

See the FEEDBACK section for where to send bug reports and comments.


Copyright (c) 2001 Steve Chervitz. All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


This software is provided "as is" without warranty of any kind.


The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


 Argument : Named parameter -TIMEOUT_SEC => seconds,
            to specify the number of seconds to allow before throwing
            an exception if input fails to arrive within that amount of time. 


 Purpose  : Obtains data from the input stream to be checked 
            for the existence of a new state.
 Usage    : check_for_new_state( [$ignore_blank_lines] );
 Argument : boolean: true if you want to ignore blank lines
 Returns  : the next chunk of input ($/ is not altered)
            If there is no more input, returns undef.

Subclasses should override this method and call it to obtain the chunk of data for new state testing.


 Argument : n/a
 Returns  : The next chunk of input data from the IO stream
            To be used in determining what state the machine should be in.