[Chicago-talk] constants and base pragma
Joshua McAdams
joshua.mcadams at gmail.com
Thu Mar 16 13:48:39 PST 2006
> If I do this in a non-OO manner everything works as expected. Is it not possible to
> export constants from a base class?
> Is there a better way?
If you can live without constant and with Readonly, this might be better:
package Dog;
use strict;
use base 'Exporter';
our @EXPORT = qw/BARK/;
use Readonly;
Readonly my $BARK => 1000;
sub new {
bless {}, $_[0];
}
1;
package Rover;
use strict;
use base 'Dog';
sub getBark {
return $BARK;
}
1;
More information about the Chicago-talk
mailing list