Hi

I have an application base class that is inherited by all classes within an application. It has a couple of globals that are also accessible to the subclasses - namely a database handle and a Log4perl logger. For example, the db handle code looks something like:

our $DBH;

sub dbh {
        my $self = shift;

        unless ($DBH) {
              $DBH = DBI->connect(...);
        }

       return $DBH;
}

How would I go about achieving this functionality using a Moose idiom?

Dan

Reply via email to