Mercurial > pub > Impl
changeset 45:1b1fb9d54f55
Starting web-application concept
author | Sergey |
---|---|
date | Fri, 29 Jan 2010 16:19:31 +0300 |
parents | 32d2350fccf9 |
children | 75148ccd732d |
files | Lib/IMPL/Object/Singleton.pm Lib/IMPL/Web/Application.pm |
diffstat | 2 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/IMPL/Object/Singleton.pm Fri Jan 29 16:19:31 2010 +0300 @@ -0,0 +1,14 @@ +package IMPL::Object::Singleton; +use strict; +use warnings; + +my %instances; + +sub instance { + my $self = shift; + + $instances{$self} || ($instances{$self} = $self->new(@_)); +} + + +1;