- or download this
sub new() {
my $class = shift; # get class so constructor can be inhe
+rited
...
print $self->get_age .", ";
print $self->get_color ." dragon awakens from his slumber!\n";
}
- or download this
sub _init {
my $self = shift;
...
}
print "Trogdor::_init got called\n";
}
- or download this
package Dragon;
use strict;
...
print $self->get_color ." dragon awakens from his slumber!\n";
}
1;
- or download this
package Trogdor;
use strict;
...
return $self->get_name ." burninates the land!\n";
}
1;
- or download this
#!/usr/bin/perl
use strict;
...
#my $d = new Dragon("Smaug"); # create a dragon named Smaug
my $d = new Trogdor(); # create Trogdor
print $d->get_color; # confirm Trogdor's color is reset
- or download this
Using perl 5.8.1-RC3 unless otherwise noted.
Apache/1.3.33 (Darwin) unless otherwise noted.
Mac OS X 10.3.9 unless otherwise noted.