use strict; use warnings; use Module; BEGIN { my $handle; sub get_handle { # Simplified for clarity. # If handle defined, return it. # Otherwise create it and return it. defined($handle)|| defined($handle=Module->new())|| die("Failed to instantiate a Module object\n"); $handle; } } get_handle()->method_a('parameter'); get_handle()->method_b('parameter'); exit;