Thursday, September 25, 2008

Perl constants with inheritence

package Base;

use strict;

use constant MY_CONST => 'Base Constant';

1;

package Child;

use base qw( Base );

sub printMyConst
{
my $self = shift;
print $self->MY_CONST;
}

1;

Child->printMyConst();

No comments:

About Me

Seattle, Washington, United States