Mercurial > pub > Impl
comparison Lib/IMPL/Object/Singleton.pm @ 46:75148ccd732d
Upgrading resources
author | Sergey |
---|---|
date | Tue, 02 Feb 2010 17:09:49 +0300 |
parents | 1b1fb9d54f55 |
children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
45:1b1fb9d54f55 | 46:75148ccd732d |
---|---|
8 my $self = shift; | 8 my $self = shift; |
9 | 9 |
10 $instances{$self} || ($instances{$self} = $self->new(@_)); | 10 $instances{$self} || ($instances{$self} = $self->new(@_)); |
11 } | 11 } |
12 | 12 |
13 1; | |
13 | 14 |
14 1; | 15 __END__ |
16 | |
17 =pod | |
18 | |
19 =head1 SYNOPSIS | |
20 | |
21 package Foo; | |
22 | |
23 use base qw(IMPL::Object IMPL::Object::Singleton); | |
24 | |
25 #.... | |
26 | |
27 Foo->isnatnce->some_work(); | |
28 | |
29 Foo->isnatnce->get_result(); | |
30 | |
31 =head1 DESCRIPTION | |
32 | |
33 Реализует шаблон Singleton | |
34 | |
35 =head1 MEMBERS | |
36 | |
37 =head2 OPERATORS | |
38 | |
39 =list | |
40 | |
41 =item C<instance CLASS(@params)> | |
42 | |
43 Создает или возвращает экземпляр класса, если экземляр не существует, то он создается с параметрами C<@params>. | |
44 | |
45 =over | |
46 | |
47 =cut |