| 1 | # BioPerl module for Bio::Graphics::ConfiguratorI | ||
| 2 | # | ||
| 3 | # Cared for by Robert Hubley <rhubley@systemsbiology.org> | ||
| 4 | # | ||
| 5 | # Copyright Robert Hubley | ||
| 6 | # | ||
| 7 | # You may distribute this module under the same terms as perl itself | ||
| 8 | |||
| 9 | # POD documentation - main docs before the code | ||
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Bio::Graphics::ConfiguratorI - A sectioned map of configuration | ||
| 14 | options (a map of maps), with a default section. Intended to augment | ||
| 15 | existing tag-E<gt>value semantics (ie. of Bio::AnnotationCollectionI) for | ||
| 16 | object-representation information (eg. foreground color), and for | ||
| 17 | general interface preferences (eg. image width in gbrowse). | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | # get a ConfiguratorI somehow | ||
| 22 | my $fg_color = $configurator->get('fgcolor'); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This object contains various configuration parameters. It is divided | ||
| 27 | up into sections and tags. This is essentially a multi-level map | ||
| 28 | (section-E<gt>tag-E<gt>value). There is also the concept of a default | ||
| 29 | section which is referenced when no section is passed to the | ||
| 30 | ConfiguratorI methods. | ||
| 31 | |||
| 32 | =head1 FEEDBACK | ||
| 33 | |||
| 34 | =head2 Mailing Lists | ||
| 35 | |||
| 36 | User feedback is an integral part of the evolution of this and other | ||
| 37 | Bioperl modules. Send your comments and suggestions preferably to | ||
| 38 | the Bioperl mailing list. Your participation is much appreciated. | ||
| 39 | |||
| 40 | bioperl-l@bioperl.org - General discussion | ||
| 41 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 42 | |||
| 43 | =head2 Reporting Bugs | ||
| 44 | |||
| 45 | Report bugs to the Bioperl bug tracking system to help us keep track | ||
| 46 | of the bugs and their resolution. Bug reports can be submitted via the | ||
| 47 | web: | ||
| 48 | |||
| 49 | http://bugzilla.open-bio.org/ | ||
| 50 | |||
| 51 | =head1 AUTHOR - Robert Hubley | ||
| 52 | |||
| 53 | Email rhubley@systemsbiology.org | ||
| 54 | |||
| 55 | =head1 CONTRIBUTORS | ||
| 56 | |||
| 57 | Paul Edlefsen, pedlefsen@systemsbiology.org | ||
| 58 | Lincoln Stein, lstein@cshl.org | ||
| 59 | Heikki Lehvaslaiho, heikki-at-bioperl-dot-org | ||
| 60 | |||
| 61 | =head1 APPENDIX | ||
| 62 | |||
| 63 | The rest of the documentation details each of the object methods. | ||
| 64 | Internal methods are usually preceded with a _ | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | # Let the code begin... | ||
| 69 | |||
| 70 | package Bio::Graphics::ConfiguratorI; | ||
| 71 | use strict; | ||
| 72 | use Carp; | ||
| 73 | |||
| 74 | use base qw(Bio::Root::RootI); | ||
| 75 | |||
| 76 | =head2 get_sections | ||
| 77 | |||
| 78 | Title : get_sections | ||
| 79 | Usage : my @values = $configurator->get_sections(); | ||
| 80 | Function: Returns a list of the valid sections except | ||
| 81 | the default or undef. | ||
| 82 | Returns : A list of the sections which can be queried. | ||
| 83 | Args : (optional section as string, tag as string) | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | sub get_sections { | ||
| 88 | my ($self) = @_; | ||
| 89 | $self->throw_not_implemented(); | ||
| 90 | } | ||
| 91 | |||
| 92 | =head2 get_tags | ||
| 93 | |||
| 94 | Title : get_tags | ||
| 95 | Usage : my @values = $configurator->get_tags(); | ||
| 96 | or | ||
| 97 | my @values = $configurator->get_tags('dna'); | ||
| 98 | Function: Returns a list of tags for a given section | ||
| 99 | or only the default tags section if no section | ||
| 100 | is given. | ||
| 101 | Returns : A scalar list of tags | ||
| 102 | Args : | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | sub get_tags { | ||
| 107 | my ($self) = @_; | ||
| 108 | $self->throw_not_implemented(); | ||
| 109 | } | ||
| 110 | |||
| 111 | =head2 get | ||
| 112 | |||
| 113 | Title : get | ||
| 114 | Usage : my $value = $configurator->get('height'); | ||
| 115 | or | ||
| 116 | my $value = $configurator->get('dna','height'); | ||
| 117 | Function: Returns a tag value from a configurator from the | ||
| 118 | either the default "_general" section or from | ||
| 119 | a specified section or undef. | ||
| 120 | Returns : A scalar value for the tag | ||
| 121 | Args : (optional section as string, tag as string) | ||
| 122 | |||
| 123 | =cut | ||
| 124 | |||
| 125 | sub get { | ||
| 126 | my ($self) = @_; | ||
| 127 | $self->throw_not_implemented(); | ||
| 128 | } | ||
| 129 | |||
| 130 | =head2 set | ||
| 131 | |||
| 132 | Title : set | ||
| 133 | Usage : $configurator->set('fgcolor','chartreuse'); | ||
| 134 | or | ||
| 135 | $configurator->set('EST','fgcolor','chartreuse'); | ||
| 136 | Function: Set a value for a tag | ||
| 137 | Returns : The old value of the tag | ||
| 138 | Args : (optional section as string, tag as string, value as scalar) | ||
| 139 | |||
| 140 | =cut | ||
| 141 | |||
| 142 | sub set { | ||
| 143 | my ($self) = @_; | ||
| 144 | $self->throw_not_implemented(); | ||
| 145 | } | ||
| 146 | |||
| 147 | |||
| 148 | =head2 get_and_eval | ||
| 149 | |||
| 150 | Title : get_and_eval | ||
| 151 | Usage : my $value = $configurator->get_and_eval('height'); | ||
| 152 | or | ||
| 153 | my $value = $configurator->get_and_eval('dna','height'); | ||
| 154 | Function: This works like get() except that it is | ||
| 155 | also able to evaluate code references. These are | ||
| 156 | options whose values begin with the characters | ||
| 157 | "sub {". In this case the value will be passed to | ||
| 158 | an eval() and the resulting codereference returned. | ||
| 159 | Returns : A value of the tag or undef. | ||
| 160 | Args : (optional section as string, tag as string) | ||
| 161 | |||
| 162 | =cut | ||
| 163 | |||
| 164 | sub get_and_eval { | ||
| 165 | my ($self) = @_; | ||
| 166 | $self->throw_not_implemented(); | ||
| 167 | } | ||
| 168 | |||
| 169 | 1; |