Query: aspect::library::singleton
OS: debian
Section: 3pm
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Aspect::Library::Singleton(3pm) User Contributed Perl Documentation Aspect::Library::Singleton(3pm)NAMEAspect::Library::Singleton - A singleton aspectSYNOPSISuse Aspect; use Aspect::Singleton; aspect Singleton => 'Foo::new'; my $f1 = Foo->new; my $f2 = Foo->new; # Both $f1 and $f2 refer to the same objectDESCRIPTIONA reusable aspect that forces singleton behavior on a constructor. The constructor is defined by a pointcut spec: a string. regexp, or code ref. It is slightly different from "Class::Singleton" (http://search.cpan.org/~abw/Class-Singleton/Singleton.pm <http://search.cpan.org/~abw/Class-Singleton/Singleton.pm>): o No specific name requirement on the constructor for the external interface, or for the implementation ("Class::Singleton" requires clients use "instance()", and that subclasses override "_new_instance()"). With aspects, you can change the cardinality of your objects without changing the clients, or the objects themselves. o No need to inherit from anything- use pointcuts to specify the constructors you want to memoize. Instead of pulling singleton behavior from a base class, you are pushing it in, using the aspect. o No package variable or method is added to the callers namespace Note that this is just a special case of memoizing.AUTHORSAdam Kennedy <adamk@cpan.org> Marcel Gruenauer <marcel@cpan.org> Ran Eilam <eilara@cpan.org>COPYRIGHTCopyright 2001 by Marcel Gruenauer Some parts copyright 2009 - 2012 Adam Kennedy. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-02-01 Aspect::Library::Singleton(3pm)
Related Man Pages |
---|
moosex::singleton(3) - mojave |
apache::singleton(3pm) - debian |
aspect::modular(3pm) - debian |
class::makemethods::emulator(3pm) - debian |
class::singleton(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
What is singleton class ? |