FAST/Bio/SearchIO.pm untested

filter: Statementstmt 0.0% 0 / 160 Branchbran 0.0% 0 / 70 Conditioncond 0.0% 0 / 41 MC/DCmcdc 0.0% 0 / 26 Subroutinesub 0.0% 0 / 31 Podpod 0.0% 0 / 26 totaltotal 0.0% 0 / 354 CC 36 SCAR 28.8
CC
36
Cov
0%
new
42.0
_guess_format
42.0
write_result
30.0
CRAP 17.8
1 #
2 # BioPerl module for FAST::Bio::SearchIO
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Jason Stajich <jason-at-bioperl.org>
7 #
8 # Copyright Jason Stajich
9 #
10 # You may distribute this module under the same terms as perl itself
11  
12 # POD documentation - main docs before the code
13  
14 =head1 NAME
15  
16 FAST::Bio::SearchIO - Driver for parsing Sequence Database Searches
17 (BLAST, FASTA, ...)
18  
19 =head1 SYNOPSIS
20  
21 use FAST::Bio::SearchIO;
22 # format can be 'fasta', 'blast', 'exonerate', ...
23 my $searchio = FAST::Bio::SearchIO->new( -format => 'blastxml',
24 -file => 'blastout.xml' );
25 while ( my $result = $searchio->next_result() ) {
26 while( my $hit = $result->next_hit ) {
27 # process the FAST::Bio::Search::Hit::HitI object
28 while( my $hsp = $hit->next_hsp ) {
29 # process the FAST::Bio::Search::HSP::HSPI object
30 }
31 }
32 }
33  
34  
35 =head1 DESCRIPTION
36  
37 This is a driver for instantiating a parser for report files from
38 sequence database searches. This object serves as a wrapper for the
39 format parsers in FAST::Bio::SearchIO::* - you should not need to ever
40 use those format parsers directly. (For people used to the SeqIO
41 system it, we are deliberately using the same pattern).
42  
43 Once you get a SearchIO object, calling next_result() gives you back
44 a L<FAST::Bio::Search::Result::ResultI> compliant object, which is an object that
45 represents one Blast/Fasta/HMMER whatever report.
46  
47 A list of module names and formats is below:
48  
49 blast BLAST (WUBLAST, NCBIBLAST,bl2seq)
50 fasta FASTA -m9 and -m0
51 blasttable BLAST -m9 or -m8 output (both NCBI and WUBLAST tabular)
52 megablast MEGABLAST
53 psl UCSC PSL format
54 waba WABA output
55 axt AXT format
56 sim4 Sim4
57 hmmer HMMER2 hmmpfam and hmmsearch or HMMER3 hmmscan and hmmsearch
58 exonerate Exonerate CIGAR and VULGAR format
59 blastxml NCBI BLAST XML
60 wise Genewise -genesf format
61  
62 Also see the SearchIO HOWTO:
63 http://bioperl.open-bio.org/wiki/HOWTO:SearchIO
64  
65 =head1 FEEDBACK
66  
67 =head2 Mailing Lists
68  
69 User feedback is an integral part of the evolution of this and other
70 Bioperl modules. Send your comments and suggestions preferably to
71 the Bioperl mailing list. Your participation is much appreciated.
72  
73 bioperl-l@bioperl.org - General discussion
74 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
75  
76 =head2 Support
77  
78 Please direct usage questions or support issues to the mailing list:
79  
80 I<bioperl-l@bioperl.org>
81  
82 rather than to the module maintainer directly. Many experienced and
83 reponsive experts will be able look at the problem and quickly
84 address it. Please include a thorough description of the problem
85 with code and data examples if at all possible.
86  
87 =head2 Reporting Bugs
88  
89 Report bugs to the Bioperl bug tracking system to help us keep track
90 of the bugs and their resolution. Bug reports can be submitted via the
91 web:
92  
93 https://redmine.open-bio.org/projects/bioperl/
94  
95 =head1 AUTHOR - Jason Stajich & Steve Chervitz
96  
97 Email jason-at-bioperl.org
98 Email sac-at-bioperl.org
99  
100 =head1 APPENDIX
101  
102 The rest of the documentation details each of the object methods.
103 Internal methods are usually preceded with a _
104  
105 =cut
106  
107  
108 # Let the code begin...
109  
110  
111 package FAST::Bio::SearchIO;
112 use strict;
113 use warnings;
114  
115 # Object preamble - inherits from FAST::Bio::Root::IO
116  
117 use FAST::Bio::SearchIO::SearchResultEventBuilder;
118  
119 # Special exception class for exceptions during parsing.
120 # End users should not ever see these.
121 # For an example of usage, see blast.pm.
122 @FAST::Bio::SearchIO::InternalParserError::ISA = qw(FAST::Bio::Root::Exception);
123  
124 use Symbol;
125  
126 use base qw(FAST::Bio::Root::IO FAST::Bio::Event::EventGeneratorI FAST::Bio::AnalysisParserI);
127  
128 =head2 new
129  
130 Title : new
131 Usage : my $obj = FAST::Bio::SearchIO->new();
132 Function: Builds a new FAST::Bio::SearchIO object
133 Returns : FAST::Bio::SearchIO initialized with the correct format
134 Args : -file => $filename
135 -format => format
136 -fh => filehandle to attach to
137 -result_factory => object implementing FAST::Bio::Factory::ObjectFactoryI
138 -hit_factory => object implementing FAST::Bio::Factory::ObjectFactoryI
139 -hsp_factory => object implementing FAST::Bio::Factory::ObjectFactoryI
140 -writer => object implementing FAST::Bio::SearchIO::SearchWriterI
141 -output_format => output format, which will dynamically load writer
142 -inclusion_threshold => e-value threshold for inclusion in the
143 PSI-BLAST score matrix model
144 -signif => float or scientific notation number to be used
145 as a P- or Expect value cutoff
146 -check_all_hits => boolean. Check all hits for significance against
147 significance criteria. Default = false.
148 If false, stops processing hits after the first
149 non-significant hit or the first hit that fails
150 the hit_filter call. This speeds parsing,
151 taking advantage of the fact that the hits are
152 processed in the order they appear in the report.
153 -min_query_len => integer to be used as a minimum for query sequence
154 length. Reports with query sequences below this
155 length will not be processed.
156 default = no minimum length.
157 -best => boolean. Only process the best hit of each report;
158 default = false.
159  
160 See L<FAST::Bio::Factory::ObjectFactoryI>, L<FAST::Bio::SearchIO::SearchWriterI>
161  
162 Any factory objects in the arguments are passed along to the
163 SearchResultEventBuilder object which holds these factories and sets
164 default ones if none are supplied as arguments.
165  
166 =cut
167  
168 # TODO: The below don't seem to be implemented (e.g. in FAST::Bio::SearchIO::blast)
169 #
170 # -score => integer or scientific notation number to be used
171 # as a blast score value cutoff
172 # -bits => integer or scientific notation number to be used
173 # as a bit score value cutoff
174 # -overlap => integer. The amount of overlap to permit between
175 # adjacent HSPs when tiling HSPs. A reasonable value is 2.
176 # default = $FAST::Bio::SearchIO::blast::MAX_HSP_OVERLAP.
177  
178 sub new {
179 my($caller,@args) = @_;
180 my $class = ref($caller) || $caller;
181
182 # or do we want to call SUPER on an object if $caller is an
183 # object?
184 if( $class =~ /FAST::Bio::SearchIO::(\S+)/ ) {
185 my ($self) = $class->SUPER::new(@args);
186 $self->_initialize(@args);
187 return $self;
188 } else {
189 my %param = @args;
190 @param{ map { lc $_ } keys %param } = values %param; # lowercase keys
191 my $format = $param{'-format'} ||
192 $class->_guess_format( $param{'-file'} || $ARGV[0] ) || 'blast';
193  
194 my $output_format = $param{'-output_format'};
195 my $writer = undef;
196  
197 if( defined $output_format ) {
198 if( defined $param{'-writer'} ) {
199 my $dummy = FAST::Bio::Root::Root->new();
200 $dummy->throw("Both writer and output format specified - not good");
201 }
202  
203 if( $output_format =~ /^blast$/i ) {
204 $output_format = 'TextResultWriter';
205 }
206 my $output_module = "FAST::Bio::SearchIO::Writer::".$output_format;
207 $class->_load_module($output_module);
208 $writer = $output_module->new(@args);
209 push(@args,"-writer",$writer);
210 }
211  
212  
213 # normalize capitalization to lower case
214 $format = "\L$format";
215
216 return unless( $class->_load_format_module($format) );
217 return "FAST::Bio::SearchIO::${format}"->new(@args);
218 }
219 }
220  
221 sub _initialize {
222 my($self, @args) = @_;
223 $self->{'_handler'} = undef;
224 # not really necessary unless we put more in RootI
225 #$self->SUPER::_initialize(@args);
226  
227 # initialize the IO part
228 $self->_initialize_io(@args);
229 $self->attach_EventHandler(FAST::Bio::SearchIO::SearchResultEventBuilder->new(@args));
230 $self->{'_reporttype'} = '';
231 $self->{_notfirsttime} = 0;
232 my ($min_qlen, $check_all, $overlap, $best, $it, $writer ) =
233 $self->_rearrange([qw(
234 MIN_LENGTH
235 CHECK_ALL_HITS
236 OVERLAP
237 BEST
238 INCLUSION_THRESHOLD
239 WRITER)], @args); # note: $overlap isn't used for some reason
240  
241 $writer && $self->writer( $writer );
242 defined $it && $self->inclusion_threshold($it);
243 defined $min_qlen && $self->min_query_length($min_qlen);
244 defined $best && $self->best_hit_only($best);
245 defined $check_all && $self->check_all_hits($check_all);
246 }
247  
248 =head2 newFh
249  
250 Title : newFh
251 Usage : $fh = FAST::Bio::SearchIO->newFh(-file=>$filename,
252 -format=>'Format')
253 Function: does a new() followed by an fh()
254 Example : $fh = FAST::Bio::SearchIO->newFh(-file=>$filename,
255 -format=>'Format')
256 $result = <$fh>; # read a ResultI object
257 print $fh $result; # write a ResultI object
258 Returns : filehandle tied to the FAST::Bio::SearchIO::Fh class
259 Args :
260  
261 =cut
262  
263 sub newFh {
264 my $class = shift;
265 return unless my $self = $class->new(@_);
266 return $self->fh;
267 }
268  
269 =head2 fh
270  
271 Title : fh
272 Usage : $obj->fh
273 Function:
274 Example : $fh = $obj->fh; # make a tied filehandle
275 $result = <$fh>; # read a ResultI object
276 print $fh $result; # write a ResultI object
277 Returns : filehandle tied to the FAST::Bio::SearchIO::Fh class
278 Args :
279  
280 =cut
281  
282  
283 sub fh {
284 my $self = shift;
285 my $class = ref($self) || $self;
286 my $s = Symbol::gensym;
287 tie $$s,$class,$self;
288 return $s;
289 }
290  
291 =head2 attach_EventHandler
292  
293 Title : attach_EventHandler
294 Usage : $parser->attatch_EventHandler($handler)
295 Function: Adds an event handler to listen for events
296 Returns : none
297 Args : FAST::Bio::SearchIO::EventHandlerI
298  
299 See L<FAST::Bio::SearchIO::EventHandlerI>
300  
301 =cut
302  
303 sub attach_EventHandler{
304 my ($self,$handler) = @_;
305 return if( ! $handler );
306 if( ! $handler->isa('FAST::Bio::SearchIO::EventHandlerI') ) {
307 $self->warn("Ignoring request to attatch handler ".ref($handler). ' because it is not a FAST::Bio::SearchIO::EventHandlerI');
308 }
309 $self->{'_handler'} = $handler;
310 return;
311 }
312  
313 =head2 _eventHandler
314  
315 Title : _eventHandler
316 Usage : private
317 Function: Get the EventHandler
318 Returns : FAST::Bio::SearchIO::EventHandlerI
319 Args : none
320  
321 See L<FAST::Bio::SearchIO::EventHandlerI>
322  
323 =cut
324  
325 sub _eventHandler{
326 my ($self) = @_;
327 return $self->{'_handler'};
328 }
329  
330 =head2 next_result
331  
332 Title : next_result
333 Usage : $result = stream->next_result
334 Function: Reads the next ResultI object from the stream and returns it.
335  
336 Certain driver modules may encounter entries in the stream that
337 are either misformatted or that use syntax not yet understood
338 by the driver. If such an incident is recoverable, e.g., by
339 dismissing a feature of a feature table or some other non-mandatory
340 part of an entry, the driver will issue a warning. In the case
341 of a non-recoverable situation an exception will be thrown.
342 Do not assume that you can resume parsing the same stream after
343 catching the exception. Note that you can always turn recoverable
344 errors into exceptions by calling $stream->verbose(2) (see
345 FAST::Bio::Root::RootI POD page).
346 Returns : A FAST::Bio::Search::Result::ResultI object
347 Args : n/a
348  
349 See L<FAST::Bio::Root::RootI>
350  
351 =cut
352  
353 sub next_result {
354 my ($self) = @_;
355 $self->throw_not_implemented;
356 }
357  
358 =head2 write_result
359  
360 Title : write_result
361 Usage : $stream->write_result($result_result, @other_args)
362 Function: Writes data from the $result_result object into the stream.
363 : Delegates to the to_string() method of the associated
364 : WriterI object.
365 Returns : 1 for success and 0 for error
366 Args : FAST::Bio::Search:Result::ResultI object,
367 : plus any other arguments for the Writer
368 Throws : FAST::Bio::Root::Exception if a Writer has not been set.
369  
370 See L<FAST::Bio::Root::Exception>
371  
372 =cut
373  
374 sub write_result {
375 my ($self, $result, @args) = @_;
376  
377 if( not ref($self->{'_result_writer'}) ) {
378 $self->throw("ResultWriter not defined.");
379 }
380 @args = $self->{'_notfirsttime'} unless( @args );
381  
382 my $str = $self->writer->to_string( $result, @args);
383 $self->{'_notfirsttime'} = 1;
384 $self->_print( "$str" ) if defined $str;
385
386 $self->flush if $self->_flush_on_write && defined $self->_fh;
387 return 1;
388 }
389  
390 =head2 write_report
391  
392 Title : write_report
393 Usage : $stream->write_report(SearchIO stream, @other_args)
394 Function: Writes data directly from the SearchIO stream object into the
395 : writer. This is mainly useful if one has multiple ResultI objects
396 : in a SearchIO stream and you don't want to reiterate header/footer
397 : between each call.
398 Returns : 1 for success and 0 for error
399 Args : FAST::Bio::SearchIO stream object,
400 : plus any other arguments for the Writer
401 Throws : FAST::Bio::Root::Exception if a Writer has not been set.
402  
403 See L<FAST::Bio::Root::Exception>
404  
405 =cut
406  
407 sub write_report {
408 my ($self, $result, @args) = @_;
409  
410 if( not ref($self->{'_result_writer'}) ) {
411 $self->throw("ResultWriter not defined.");
412 }
413 @args = $self->{'_notfirsttime'} unless( @args );
414  
415 my $str = $self->writer->to_string( $result, @args);
416 $self->{'_notfirsttime'} = 1;
417 $self->_print( "$str" ) if defined $str;
418
419 $self->flush if $self->_flush_on_write && defined $self->_fh;
420 return 1;
421 }
422  
423 =head2 writer
424  
425 Title : writer
426 Usage : $writer = $stream->writer;
427 Function: Sets/Gets a SearchWriterI object to be used for this searchIO.
428 Returns : 1 for success and 0 for error
429 Args : FAST::Bio::SearchIO::SearchWriterI object (when setting)
430 Throws : FAST::Bio::Root::Exception if a non-FAST::Bio::SearchIO::SearchWriterI object
431 is passed in.
432  
433 =cut
434  
435 sub writer {
436 my ($self, $writer) = @_;
437 if( ref($writer) and $writer->isa( 'FAST::Bio::SearchIO::SearchWriterI' )) {
438 $self->{'_result_writer'} = $writer;
439 }
440 elsif( defined $writer ) {
441 $self->throw("Can't set ResultWriter. Not a FAST::Bio::SearchIO::SearchWriterI: $writer");
442 }
443 return $self->{'_result_writer'};
444 }
445  
446 =head2 result_count
447  
448 Title : result_count
449 Usage : $num = $stream->result_count;
450 Function: Gets the number of Blast results that have been successfully parsed
451 at the point of the method call. This is not the total # of results
452 in the file.
453 Returns : integer
454 Args : none
455 Throws : none
456  
457 =cut
458  
459 sub result_count {
460 my $self = shift;
461 $self->throw_not_implemented;
462 }
463  
464 =head2 inclusion_threshold
465  
466 Title : inclusion_threshold
467 Usage : my $incl_thresh = $isreb->inclusion_threshold;
468 : $isreb->inclusion_threshold(1e-5);
469 Function: Get/Set the e-value threshold for inclusion in the PSI-BLAST
470 score matrix model (blastpgp) that was used for generating the reports
471 being parsed.
472 Returns : number (real)
473 Default value: $FAST::Bio::SearchIO::IteratedSearchResultEventBuilder::DEFAULT_INCLUSION_THRESHOLD
474 Args : number (real) (e.g., 0.0001 or 1e-4 )
475  
476 =cut
477  
478 # Delegates to the event handler.
479 sub inclusion_threshold {
480 shift->_eventHandler->inclusion_threshold(@_);
481 }
482  
483 =head2 max_significance
484  
485 Usage : $obj->max_significance();
486 Purpose : Set/Get the P or Expect value used as significance screening cutoff.
487 This is the value of the -signif parameter supplied to new().
488 Hits with P or E-value above this are skipped.
489 Returns : Scientific notation number with this format: 1.0e-05.
490 Argument : Scientific notation number or float (when setting)
491 Comments : Screening of significant hits uses the data provided on the
492 : description line. For NCBI BLAST1 and WU-BLAST, this data
493 : is P-value. for NCBI BLAST2 it is an Expect value.
494  
495 =cut
496  
497 sub max_significance { shift->{'_handler_cache'}->max_significance(@_) }
498  
499 =head2 signif
500  
501 Synonym for L<max_significance()|max_significance>
502  
503 =cut
504  
505 sub signif { shift->max_significance(@_) }
506  
507 =head2 min_score
508  
509 Usage : $obj->min_score();
510 Purpose : Set/Get the Blast score used as screening cutoff.
511 This is the value of the -score parameter supplied to new().
512 Hits with scores below this are skipped.
513 Returns : Integer or scientific notation number.
514 Argument : Integer or scientific notation number (when setting)
515 Comments : Screening of significant hits uses the data provided on the
516 : description line.
517  
518 =cut
519  
520 sub min_score { shift->{'_handler_cache'}->min_score(@_) }
521  
522 =head2 min_query_length
523  
524 Usage : $obj->min_query_length();
525 Purpose : Gets the query sequence length used as screening criteria.
526 This is the value of the -min_query_len parameter supplied to new().
527 Hits with sequence length below this are skipped.
528 Returns : Integer
529 Argument : n/a
530  
531 =cut
532  
533 sub min_query_length {
534 my $self = shift;
535 if (@_) {
536 my $min_qlen = shift;
537 if ( $min_qlen =~ /\D/ or $min_qlen <= 0 ) {
538 $self->throw(
539 -class => 'FAST::Bio::Root::BadParameter',
540 -text => "Invalid minimum query length value: $min_qlen\n"
541 . "Value must be an integer > 0. Value not set.",
542 -value => $min_qlen
543 );
544 }
545 $self->{'_confirm_qlength'} = 1;
546 $self->{'_min_query_length'} = $min_qlen;
547 }
548  
549 return $self->{'_min_query_length'};
550 }
551  
552 =head2 best_hit_only
553  
554 Title : best_hit_only
555 Usage : print "only getting best hit.\n" if $obj->best_hit_only;
556 Purpose : Set/Get the indicator for whether or not to process only
557 : the best BlastHit.
558 Returns : Boolean (1 | 0)
559 Argument : Boolean (1 | 0) (when setting)
560  
561 =cut
562  
563 sub best_hit_only {
564 my $self = shift;
565 if (@_) { $self->{'_best'} = shift; }
566 $self->{'_best'};
567 }
568  
569 =head2 check_all_hits
570  
571 Title : check_all_hits
572 Usage : print "checking all hits.\n" if $obj->check_all_hits;
573 Purpose : Set/Get the indicator for whether or not to process all hits.
574 : If false, the parser will stop processing hits after the
575 : the first non-significance hit or the first hit that fails
576 : any hit filter.
577 Returns : Boolean (1 | 0)
578 Argument : Boolean (1 | 0) (when setting)
579  
580 =cut
581  
582 sub check_all_hits {
583 my $self = shift;
584 if (@_) { $self->{'_check_all'} = shift; }
585 $self->{'_check_all'};
586 }
587  
588 =head2 _load_format_module
589  
590 Title : _load_format_module
591 Usage : *INTERNAL SearchIO stuff*
592 Function: Loads up (like use) a module at run time on demand
593 Example :
594 Returns :
595 Args :
596  
597 =cut
598  
599 sub _load_format_module {
600 my ($self,$format) = @_;
601 my $module = "FAST::Bio::SearchIO::" . $format;
602 my $ok;
603
604 eval {
605 $ok = $self->_load_module($module);
606 };
607 if ( $@ ) {
608 print STDERR <<END;
609 $self: $format cannot be found
610 Exception $@
611 For more information about the SearchIO system please see the SearchIO docs.
612 This includes ways of checking for formats at compile time, not run time
613 END
614 ;
615 }
616 return $ok;
617 }
618  
619 =head2 _get_seq_identifiers
620  
621 Title : _get_seq_identifiers
622 Usage : my ($gi, $acc,$ver) = &_get_seq_identifiers($id)
623 Function: Private function to get the gi, accession, version data
624 for an ID (if it is in NCBI format)
625 Returns : 3-pule of gi, accession, version
626 Args : ID string to process (NCBI format)
627  
628  
629 =cut
630  
631 sub _get_seq_identifiers {
632 my ($self, $id) = @_;
633  
634 return unless defined $id;
635 my ($gi, $acc, $version );
636 if ( $id =~ /^gi\|(\d+)\|/ ) {
637 $gi = $1;
638 }
639 if ( $id =~ /(gb|emb|dbj|sp|pdb|bbs|ref|lcl)\|(.*)\|(.*)/ ) {
640 ( $acc, $version ) = split /\./, $2;
641 }
642 elsif ( $id =~ /(pir|prf|pat|gnl)\|(.*)\|(.*)/ ) {
643 ( $acc, $version ) = split /\./, $3;
644 }
645 else {
646  
647 #punt, not matching the db's at ftp://ftp.ncbi.nih.gov/blast/db/README
648 #Database Name Identifier Syntax
649 #============================ ========================
650 #GenBank gb|accession|locus
651 #EMBL Data Library emb|accession|locus
652 #DDBJ, DNA Database of Japan dbj|accession|locus
653 #NBRF PIR pir||entry
654 #Protein Research Foundation prf||name
655 #SWISS-PROT sp|accession|entry name
656 #Brookhaven Protein Data Bank pdb|entry|chain
657 #Patents pat|country|number
658 #GenInfo Backbone Id bbs|number
659 #General database identifier gnl|database|identifier
660 #NCBI Reference Sequence ref|accession|locus
661 #Local Sequence identifier lcl|identifier
662 $acc = $id;
663 }
664 return ($gi, $acc, $version );
665 }
666  
667 =head2 _guess_format
668  
669 Title : _guess_format
670 Usage : $obj->_guess_format($filename)
671 Function:
672 Example :
673 Returns : guessed format of filename (lower case)
674 Args :
675  
676 =cut
677  
678 sub _guess_format {
679 my $class = shift;
680 return unless $_ = shift;
681 return 'blast' if (/\.(blast|t?bl\w)$/i );
682 return 'fasta' if (/\.
683 (?: t? fas (?:ta)? |
684 m\d+ |
685 (?: t? (?: fa | fx | fy | ff | fs ) ) |
686 (?: (?:ss | os | ps) (?:earch)? ))
687 $/ix );
688 return 'blastxml' if ( /\.(blast)?xml$/i);
689 return 'exonerate' if ( /\.exon(erate)?/i );
690 }
691  
692 sub close {
693 my $self = shift;
694  
695 if( $self->writer ) {
696 $self->_print($self->writer->end_report());
697 $self->{'_result_writer'}= undef;
698 }
699 $self->SUPER::close(@_);
700 }
701  
702 sub DESTROY {
703 my $self = shift;
704 $self->close() if defined $self->_fh;
705 $self->SUPER::DESTROY;
706 }
707  
708 sub TIEHANDLE {
709 my $class = shift;
710 return bless {processor => shift}, $class;
711 }
712  
713 sub READLINE {
714 my $self = shift;
715 return $self->{'processor'}->next_result() unless wantarray;
716 my (@list, $obj);
717 push @list, $obj while $obj = $self->{'processor'}->next_result();
718 return @list;
719 }
720  
721 sub PRINT {
722 my $self = shift;
723 $self->{'processor'}->write_result(@_);
724 }
725  
726  
727 1;
728  
729 __END__