annotate Lib/IMPL/Object/Singleton.pm @ 45:1b1fb9d54f55

Starting web-application concept
author Sergey
date Fri, 29 Jan 2010 16:19:31 +0300
parents
children 75148ccd732d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
1 package IMPL::Object::Singleton;
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
2 use strict;
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
3 use warnings;
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
4
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
5 my %instances;
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
6
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
7 sub instance {
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
8 my $self = shift;
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
9
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
10 $instances{$self} || ($instances{$self} = $self->new(@_));
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
11 }
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
12
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
13
1b1fb9d54f55 Starting web-application concept
Sergey
parents:
diff changeset
14 1;