You down with OOP...
nkuipers
nkuipers at uvic.ca
Sun Oct 20 14:50:59 CDT 2002
...yeah you know me. Hi all. Was messing around with Activestate on my PC
this afternoon and started diddling with OO. Here's what I wrote. Maybe this
will be one of those things that just keeps expanding, that I'll work on when
the fit takes me...a hobby, yeah, that's it... ;)
*yaaawwwwwnnnn* what am I doing awake anyway...
Happy Sunday,
nathanael
-------------- next part --------------
package DNAParser;
use strict;
use warnings;
my $dnaobj = DNAParser->new( DESCRIPTION => 'human telomere repeat',
SEQUENCE => 'TAAGGG' );
my $description = $dnaobj->get_desc();
my $sequence = $dnaobj->get_seq();
print ">$description\n$sequence\n";
sub new {
my $caller = shift;
my $type = ref($caller) || $caller;
my $self = {
DESCRIPTION => 'no value entered',
SEQUENCE => 'no value entered',
@_
};
bless ($self, $type) and return $self
}
sub get_desc {
my $caller = shift;
ref($caller) or die "Invoked instance method on a class: $!";
return $caller->{DESCRIPTION};
}
sub get_seq {
my $caller = shift;
ref($caller) or die "Invoked instance method on a class: $!";
return $caller->{SEQUENCE};
}
More information about the Victoria-pm
mailing list