my %self = $class->default_opts;
%self = (%self, %$opts);
my $self = bless \%self, $class;
- $self->init;
$self
}
sub call {
my ($self, $env) = @_;
+
+ unless ($self->{init_done}) {
+ $self->init;
+ $self->{init_done} = 1;
+ }
+
my $auth = $env->{HTTP_AUTHORIZATION};
if ($auth && $auth =~ /^Basic (.*)$/i) {
my ($user, $pass) = split /:/, decode_base64($1), 2;
=item B<init>
-Called at the end of the constructor. The default implementation
+Called when the first request is received. The default implementation
connects to the database, calls C<post_connect_cb> and prepares the
SQL statements.