t/SeqFeature/Generic.t: fix typo on required module for testing
[bioperl-live.git] / lib / Bio / Search / Processor.pm
blob5c4c62c673cda7442bd8f910f2477bb13712a965
3 # BioPerl module for Bio::Search::Processor
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Aaron Mackey <amackey@virginia.edu>
9 # Copyright Aaron Mackey
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::Search::Processor - DESCRIPTION of Object
19 =head1 SYNOPSIS
21 Give standard usage here
23 =head1 DESCRIPTION
25 Describe the object here
27 =head1 FEEDBACK
29 =head2 Mailing Lists
31 User feedback is an integral part of the evolution of this and other
32 Bioperl modules. Send your comments and suggestions preferably to one
33 of the Bioperl mailing lists. Your participation is much appreciated.
35 bioperl-l@bioperl.org - General discussion
36 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
38 =head2 Support
40 Please direct usage questions or support issues to the mailing list:
42 I<bioperl-l@bioperl.org>
44 rather than to the module maintainer directly. Many experienced and
45 reponsive experts will be able look at the problem and quickly
46 address it. Please include a thorough description of the problem
47 with code and data examples if at all possible.
49 =head2 Reporting Bugs
51 Report bugs to the Bioperl bug tracking system to help us keep track
52 the bugs and their resolution. Bug reports can be submitted via the
53 web:
55 https://github.com/bioperl/bioperl-live/issues
57 =head1 AUTHOR - Aaron Mackey
59 Email amackey@virginia.edu
61 Describe contact details here
63 =head1 APPENDIX
65 The rest of the documentation details each of the object
66 methods. Internal methods are usually preceded with a _
68 =cut
70 # Let the code begin...
72 package Bio::Search::Processor;
74 use strict;
76 =head2 new
78 Title : new
79 Usage : $proc = Bio::Search::Processor->new -file => $filename,
80 -algorithm => 'Algorithm' ;
81 Function: Used to specify and initialize a data processor of search
82 algorithm results.
83 Returns : A processor specific to the algorithm type, if it exists.
84 Args : -file => filename
85 -algorithm => algorithm specifier
86 -fh => filehandle to attach to (file or fh required)
88 =cut
90 sub new {
92 my $type = shift;
93 my $proc;
94 my ($module, $load, $algorithm);
96 my %args = @_;
98 exists $args{'-algorithm'} or do {
99 print STDERR "Must supply an algorithm!";
100 return;
103 $algorithm = $args{'-algorithm'} || $args{'-ALGORITHM'};
105 $module = "_<Bio/Search/Processor/$algorithm.pm";
106 $load = "Bio/Search/Processor/$algorithm.pm";
108 unless ( $main::{$module} ) {
109 eval { require $load; };
110 if ( $@ ) {
111 print STDERR <<"EOF";
112 $load: $algorithm cannot be found
113 Exception $@
114 For more information about the Search/Processor system please see the
115 Processor docs. This includes ways of checking for processors at
116 compile time, not run time
118 return;
122 $proc = "Bio::Search::Processor::$algorithm"->new(@_);
123 return $proc;