Object::Trampoline 1.25
Sponsored Links
Object::Trampoline 1.25 Ranking & Summary
File size:
0.009 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
888
Date added:
2007-05-19
Publisher:
Steven Lembark
Object::Trampoline 1.25 description
Object::Trampoline is a Perl module for delay object construction, and optionally using the class module, until a method is actually dispatched, simplifies runtime definition of handler classes.
SYNOPSIS
# adding "use_class" will perform an "eval use $class"
# at the point where the object is first accessed.
use Object::Trampoline;
# the real class name is added to the normal constructor
# and Object::Trampoline used instead. the destination
# class constructor is called when object is actually
# used for something.
my $dbh = Object::Trampoline->connect( DBI, $dsn, $user, $pass, $conf );
my $sth = $dbh->prepare( select foo from bar );
# or specify the package and args from a config file
# or via inherited data.
#
# the constructor lives in the destination class
# and has nothing to do with Object::Trampoline.
my %config = Config->read( $config_file_path );
my ( $class, $const, @argz )
= @config{ qw( class const args ) };
my $handle = Object::Trampoline->$const( $class, @argz );
# at this point ref $handle is Object::Trampoline::Bounce.
$handle->frobnicate( @stuff );
# at this point ref $handle is $class
# there are times when it is helpful to delay using
# the objects class module until the object is
# instantiated. O::T::U adds the callers package
# and a "use $class" before the constructor.
my $lazy = Object::Trampoline::Use->frobnicate( $class, @stuff );
my $result = $lazy->susan( dessert );
There are times when constructing an object is expensive or has to be delayed -- database handles in heavily forked apache servers are one example. This module creates a "trampoline" object: when called it replaces the object you have with the object you want. The module itself consists only of two AUTOLOADS: one with captures the constructor call, the other the first method call. The first class blesses a closure which creates the necessary object into the second class, which replces $_[0] with a new object and re-dispatches the call into the proper class.
Using an autoload as the constructor allows Object::Trampoline to use whatever constructor name the "real" class uses without having to pass it as another argument.
SYNOPSIS
# adding "use_class" will perform an "eval use $class"
# at the point where the object is first accessed.
use Object::Trampoline;
# the real class name is added to the normal constructor
# and Object::Trampoline used instead. the destination
# class constructor is called when object is actually
# used for something.
my $dbh = Object::Trampoline->connect( DBI, $dsn, $user, $pass, $conf );
my $sth = $dbh->prepare( select foo from bar );
# or specify the package and args from a config file
# or via inherited data.
#
# the constructor lives in the destination class
# and has nothing to do with Object::Trampoline.
my %config = Config->read( $config_file_path );
my ( $class, $const, @argz )
= @config{ qw( class const args ) };
my $handle = Object::Trampoline->$const( $class, @argz );
# at this point ref $handle is Object::Trampoline::Bounce.
$handle->frobnicate( @stuff );
# at this point ref $handle is $class
# there are times when it is helpful to delay using
# the objects class module until the object is
# instantiated. O::T::U adds the callers package
# and a "use $class" before the constructor.
my $lazy = Object::Trampoline::Use->frobnicate( $class, @stuff );
my $result = $lazy->susan( dessert );
There are times when constructing an object is expensive or has to be delayed -- database handles in heavily forked apache servers are one example. This module creates a "trampoline" object: when called it replaces the object you have with the object you want. The module itself consists only of two AUTOLOADS: one with captures the constructor call, the other the first method call. The first class blesses a closure which creates the necessary object into the second class, which replces $_[0] with a new object and re-dispatches the call into the proper class.
Using an autoload as the constructor allows Object::Trampoline to use whatever constructor name the "real" class uses without having to pass it as another argument.
Object::Trampoline 1.25 Screenshot
Object::Trampoline 1.25 Keywords
Trampoline 1.25
Perl module
object construction
class
object
module
constructor
delay
Perl
Object::Trampoline
ObjectTrampoline
Object::Trampoline 1.25
Libraries
Programming
Bookmark Object::Trampoline 1.25
Object::Trampoline 1.25 Copyright
WareSeeker periodically updates pricing and software information of Object::Trampoline 1.25 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Object::Trampoline 1.25 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Object::Realize::Later is a Perl module with delayed creation of objects. Free Download
Object::InsideOut is a comprehensive inside-out object support module. Free Download
Object::Declare is a Perl module for declarative object constructor. Free Download
Ace::Object is a Perl module to manipulate Ace Data Objects. Free Download
Object::AutoAccessor is an accessor class by using AUTOLOAD. Free Download
Class::Observable is a Perl module that allows other classes and objects to respond to events in yours. Free Download
Color::Object is a OO-Color Module. Free Download
Class::InsideOut is a Perl module with a safe, simple inside-out object construction kit. Free Download
Latest Software
Popular Software
Favourite Software