package MyHandler; use strict; use warnings 'all'; use Apache2::RequestRec; use Apache2::RequestUtil; # Declare it here: my $persistent_thing; sub handler : method { my ($class, $r) = @_; # The first time this is executed in a child process, it will be created. # After that, you will just reuse the same one: $persistent_thing ||= make_the_thing(); } 1;