sub BUILD { my $self = shift; my $properties = $self->cfg; foreach my $prop (keys %$properties) { # check that the property doesn't already exist as a method croak "Server config file property '$prop' clashes with existing method. Aborting." if ($self->can($prop)); # create new method $self->add_singleton_method( $prop => sub { $properties->{$prop}; } ); } }