Class::DefaultClass::Default - static calls apply to a default instantiation. | |
Download |
Class::Default Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Adam Kennedy
- Publisher web site:
- http://search.cpan.org/~adamk/
Class::Default Tags
Class::Default Description
Class::Default - static calls apply to a default instantiation. Class::Default - static calls apply to a default instantiation.SYNOPSIS # Create the defaulted class package Foo::Base; use base 'Class::Default'; sub new { bless {}, $_ } sub show { my $self = shift->_self; "$self"; } # Do something to the default object package main; print Foo::Bar->show; # Prints 'Foo::Bar=HASH(0x80d22f8)'Class::Default provides a mechanism to allow your class to take static method calls and apply it to a default instantiation of an object. It provides a flexibility to an API that allows it to be used more confortably in different situations.A good example of this technique in use is CGI.pm. When you use a static method, like CGI-header>, your call is being applied to a default instantiation of a CGI object.This technique appears to be especially usefull when writing modules that you want to be used in either a single use or a persistant environment. In a CGI like environment, you want the simplicity of a static interface. You can call Class-method> directly, without having to pass an instantiation around constantly. Requirements: · Perl
Class::Default Related Software