Bio::GMOD::Adaptor::generic - A generic adaptor for working with multiple MODs simultaneously


Bio-GMOD documentation Contained in the Bio-GMOD distribution.

Index


Code Index:

NAME

Top

Bio::GMOD::Adaptor::generic - A generic adaptor for working with multiple MODs simultaneously

SYNPOSIS

Top

  my $adaptor = Bio::GMOD::Adaptor::generic->new();

DESCRIPTION

Top

Bio::GMOD::Adaptor::generic objects are created internally by the new() method provided by Bio::GMOD::Adaptor. This adaptor is typically used when a script needs to work with multiple MODs within the same session.

BUGS

Top

None reported.

SEE ALSO

Top

Bio::GMOD, Bio::GMOD::Adaptor

AUTHOR

Top

Todd W. Harris <harris@cshl.edu>.

Copyright (c) 2003-2005 Cold Spring Harbor Laboratory.

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


Bio-GMOD documentation Contained in the Bio-GMOD distribution.

package Bio::GMOD::Adaptor::generic;

use strict;
use vars qw/@ISA $AUTOLOAD/;
use Bio::GMOD::Adaptor;
use Bio::GMOD::Util::Rearrange;

@ISA = qw/Bio::GMOD::Adaptor/;

my %DEFAULTS;

sub defaults {
  my $self = shift;
  return (keys %DEFAULTS);
}


# Automatically create lc data accessor methods
# for each configuration variable
sub AUTOLOAD {
  my $self = shift;
  my $attr = $AUTOLOAD;
  $attr =~ s/.*:://;
  return unless $attr =~ /[^A-Z]/;  # skip DESTROY and all-cap methods
  return if $attr eq 'new'; # Provided by superclass
  #  die "invalid attribute method: ->$attr()" unless $DEFAULTS{uc($attr)};
  $self->{uc($attr)} = shift if @_;
  my $val = $self->{defaults}->{lc($attr)};  # Get what is already there
  $val ||= $DEFAULTS{uc($attr)};  # Perhaps it hasn't been defined yet.
  return $val;
}

__END__



1;