Mercurial > pub > Impl
comparison Lib/IMPL/Object/Singleton.pm @ 194:4d0e1962161c
Replaced tabs with spaces
IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author | cin |
---|---|
date | Tue, 10 Apr 2012 20:08:29 +0400 |
parents | d1676be8afcc |
children | 0f59b2de72af |
comparison
equal
deleted
inserted
replaced
193:8e8401c0aea4 | 194:4d0e1962161c |
---|---|
3 use warnings; | 3 use warnings; |
4 | 4 |
5 my %instances; | 5 my %instances; |
6 | 6 |
7 sub CTOR { | 7 sub CTOR { |
8 die new IMPL::InvalidOperationException("Only one instance of the singleton can be created",ref $_[0], $instances{ref $_[0]}) if $instances{ref $_[0]}; | 8 die new IMPL::InvalidOperationException("Only one instance of the singleton can be created",ref $_[0], $instances{ref $_[0]}) if $instances{ref $_[0]}; |
9 $instances{ref $_[0]} = $_[0]; | 9 $instances{ref $_[0]} = $_[0]; |
10 } | 10 } |
11 | 11 |
12 sub instance { | 12 sub instance { |
13 $instances{$_[0]} | 13 $instances{$_[0]} |
14 } | 14 } |