NAME
Sub::SingletonBuilder - a singleton subroutine builder
SYNOPSIS
use Sub::SingletonBuilder;
# simple example
*dbh = build_singleton(sub {
DBI->connect(...);
});
dbh()->execute(...);
# declare explicit destructor as well
(*dbh, *dbh_disconnect) = build_singleton(
sub {
DBI->connect(...);
},
sub {
my $dbh = shift;
$dbh->disconnect();
},
);
AUTHOR
Kazuho Oku
COPYRIGHT AND LICENSE
Copyright (C) 2008 by Cybozu Labs, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.