package Bio::DB::Das::Chado::Segment; use strict; use Bio::Root::Root; use vars '@ISA'; @ISA = qw(Bio::Root::Root); sub new { my $self = shift; my ($name,$dbadaptor,$start,$end) = @_; #$dbadaptor is 'Bio::DB::Das::Chado' # now do all kinds of work validating and obtaining info my $cvterm_id = $dbadaptor->{cvterm_id}; # so $cvterm_id should be a reference to the same # hash referenced in the first package, right? return bless {dbadaptor => $dbadaptor, start => $start, end => $end, length => $length, srcfeature_id => $srcfeature_id, cvterm_id => $cvterm_id, name => $name }, ref $self ||$self; } sub features { my $self = shift; # do lots more stuff, mostly to build a sql query my %termhash = %{$self->{cvterm_id}}; # shouldn't this be a reference to the hash ref in this #package's constructor, that in turn is a ref to the # hash ref in the first package? my @keys = grep(/\sgene/i , keys %termhash ); # this fails because %termhash isn't a hash. return; } 1;