Mercurial > pub > Impl
view Lib/IMPL/Object/Singleton.pm @ 127:0dce0470a3d8
In the IMPL::Web::ControllerUnit added the ability to notify a form about a wrong data from a transaction
added a relativeUrl function for a usage from a templates
IMPL::Web::TT::Form now fully functional
author | wizard |
---|---|
date | Fri, 11 Jun 2010 20:21:07 +0400 |
parents | 0d2337e203c0 |
children | d9dd3500ead3 |
line wrap: on
line source
package IMPL::Object::Singleton; use strict; use warnings; my %instances; sub instance { my $self = shift; $instances{$self} || ($instances{$self} = $self->new(@_)); } 1; __END__ =pod =head1 SYNOPSIS =begin code package Foo; use base qw(IMPL::Object IMPL::Object::Singleton); #.... Foo->isnatnce->some_work(); Foo->isnatnce->get_result(); =end code =head1 DESCRIPTION Реализует шаблон Singleton =head1 MEMBERS =head2 OPERATORS =list =item C<instance CLASS(@params)> Создает или возвращает экземпляр класса, если экземляр не существует, то он создается с параметрами C<@params>. =over =cut