3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
41 -NAME =>
'My Attribute',
42 -DESCRIPTION =>
'This is my attribute description.',
45 print $attrib->
name(),
"\n";
46 print $attrib->code(),
"\n";
47 print $attrib->description(),
"\n";
48 print $attrib->value(),
"\n";
52 This is a
generic attribute
class used to represent attributes
53 associated with seq_regions (and their Slices) and MiscFeatures.
63 package Bio::EnsEMBL::Attribute;
69 use Scalar::Util qw(weaken isweak);
73 Arg [-CODE] :
string - the code
for this attribute
74 Arg [-NAME] :
string - a human readable name
for this attribute
75 Arg [-DESCRIPTION] :
string - a description
for this attribute
76 Arg [-VALUE] : value - the value of
this attribute
79 -NAME =>
'My Attribute',
80 -DESCRIPTION =>
'This is my attribute description.',
94 # allow to be called as class or object method
95 my $class = ref($caller) || $caller;
97 my ($code, $name, $desc, $value) =
98 rearrange([qw(CODE NAME DESCRIPTION VALUE)], @_);
100 return bless {
'code' => $code,
102 'description' => $desc,
103 'value' => $value}, $class;
108 Arg [1] : hashref to be blessed
112 Caller : general, subclass constructors
121 my $self = bless $hashref, $class;
122 weaken($self->{adaptor})
if ( ! isweak($self->{adaptor}) );
129 Arg [1] :
string $code (optional)
130 Example : $code = $attribute->code();
131 Description: Getter/Setter
for code attribute
141 $self->{
'code'} = shift
if(@_);
142 return $self->{
'code'};
148 Arg [1] :
string $name (optional)
149 Example : $name = $attribute->name();
150 Description: Getter/Setter
for name attribute
160 $self->{
'name'} = shift
if(@_);
161 return $self->{
'name'};
166 Arg [1] :
string $description (optional)
167 Example : $description = $attribute->description();
168 Description: Getter/Setter
for description attribute
178 $self->{
'description'} = shift
if(@_);
179 return $self->{
'description'};
185 Arg [1] :
string $value (optional)
186 Example : $value = $attribute->value();
187 Description: Getter/Setter
for value attribute
197 $self->{
'value'} = shift
if(@_);
198 return $self->{
'value'};