Bio-MAGE
view release on metacpan or search on metacpan
MAGE/Base.pm view on Meta::CPAN
$method = $slot_name;
}
{
no strict 'refs';
# invoke the setter directly to gain type checking
return $self->$method($slot_val);
}
}
=item $val = $obj->get_slot($name)
The C<get_slot()> method is used to get the values of a number of
slots at the same time.
B<Return value>: a single slot value, or undef if the slot has not been
initialized.
B<Side effects>: none
=cut
sub get_slot {
my ($self, $slot_name) = @_;
my $method = 'get' . ucfirst($slot_name);
unless ($self->can($method)) {
unless ($self->can($slot_name)) {
croak(__PACKAGE__ . "::get_slot: slot $slot_name doesn't exist");
}
# this is a class slot, not an attribute or association. They still
# use the confusing polymorphic setter/getter methods.
$method = $slot_name;
}
{
no strict 'refs';
# invoke the getter directly
return $self->$method();
}
}
sub initialize {
return 1;
}
=item throw
Title : throw
Usage :
Function:
Example :
Returns :
Args :
=cut
sub throw {
my ($self, $msg) = @_;
die(caller().': '.$msg);
}
=item throw_not_implemented
Title : throw_not_implemented
Usage :
Function:
Example :
Returns :
Args :
=cut
sub throw_not_implemented {
my ($self) = @_;
die("Abstract method ".caller()." implementing class did not provide method");
}
=back
=head1 BUGS
Please send bug reports to the project mailing list: ()
=head1 AUTHOR
=head1 SEE ALSO
perl(1).
=cut
# all perl modules must be true...
1;
( run in 2.175 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )