annotate Lib/IMPL/Object/Singleton.pm @ 74:84aa8c395fce

doc minor fixes
author wizard
date Mon, 29 Mar 2010 17:40:06 +0400
parents 16ada169ca75
children 0d2337e203c0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
1 package IMPL::Object::Singleton;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
5 my %instances;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
6
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
7 sub instance {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
8 my $self = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
10 $instances{$self} || ($instances{$self} = $self->new(@_));
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
11 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
13 1;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
15 __END__
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
16
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
17 =pod
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
18
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
19 =head1 SYNOPSIS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
20
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
21 package Foo;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
23 use base qw(IMPL::Object IMPL::Object::Singleton);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
24
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
25 #....
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
27 Foo->isnatnce->some_work();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
28
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
29 Foo->isnatnce->get_result();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
30
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
31 =head1 DESCRIPTION
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
32
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
33 Реализует шаблон Singleton
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
34
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
35 =head1 MEMBERS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
36
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
37 =head2 OPERATORS
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
39 =list
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
41 =item C<instance CLASS(@params)>
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
43 Создает или возвращает экземпляр класса, если экземляр не существует, то он создается с параметрами C<@params>.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
45 =over
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
46
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 46
diff changeset
47 =cut