Main > Free Download Search >

Free object software for linux

object

Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 3130
Ace::Object 1.89

Ace::Object 1.89


Ace::Object is a Perl module to manipulate Ace Data Objects. more>>
Ace::Object is a Perl module to manipulate Ace Data Objects.

SYNOPSIS

# open database connection and get an object
use Ace;
$db = Ace->connect(-host => beta.crbm.cnrs-mop.fr,
-port => 20000100);
$sequence = $db->fetch(Sequence => D12345);

# Inspect the object
$r = $sequence->at(Visible.Overlap_Right);
@row = $sequence->row;
@col = $sequence->col;
@tags = $sequence->tags;

# Explore object substructure
@more_tags = $sequence->at(Visible)->tags;
@col = $sequence->at("Visible.$more_tags[1]")->col;

# Follow a pointer into database
$r = $sequence->at(Visible.Overlap_Right)->fetch;
$next = $r->at(Visible.Overlap_left)->fetch;

# Classy way to do the same thing
$r = $sequence->Overlap_right;
$next = $sequence->Overlap_left;

# Pretty-print object
print $sequence->asString;
print $sequence->asTabs;
print $sequence->asHTML;

# Update object
$sequence->replace(Visible.Overlap_Right,$r,M55555);
$sequence->add(Visible.Homology,GR91198);
$sequence->delete(Source.Clone,MBR122);
$sequence->commit();

# Rollback changes
$sequence->rollback()

# Get errors
print $sequence->error;

Ace::Object is the base class for objects returned from ACEDB databases. Currently there is only one type of Ace::Object, but this may change in the future to support more interesting object-specific behaviors.

Using the Ace::Object interface, you can explore the internal structure of an Ace::Object, retrieve its content, and convert it into various types of text representation. You can also fetch a representation of any object as a GIF image.

If you have write access to the databases, add new data to an object, replace existing data, or kill it entirely. You can also create a new object de novo and write it into the database.

<<less
Download (0.29MB)
Added: 2006-10-12 License: Perl Artistic License Price:
1108 downloads
Rose::Object 0.84

Rose::Object 0.84


Rose::Object is a simple object base class. more>>
Rose::Object is a simple object base class.

SYNOPSIS

package MyObject;

use Rose::Object;
our @ISA = qw(Rose::Object);

sub foo { ... }
sub bar { ... }
...

my $o = MyObject->new(foo => abc, bar => 5);
...

Rose::Object is a generic object base class. It provides very little functionality, but a healthy dose of convention.

METHODS

new PARAMS

Constructs a new, empty, hash-based object based on PARAMS, where PARAMS are name/value pairs, and then calls init (see below), passing PARAMS to it unmodified.

init PARAMS

Given a list of name/value pairs in PARAMS, calls the object method of each name, passing the corresponding value as an argument. The methods are called in the order that they appear in PARAMS. For example:

$o->init(foo => 1, bar => 2);

is equivalent to the sequence:

$o->foo(1);
$o->bar(2);

<<less
Download (0.028MB)
Added: 2007-05-21 License: Perl Artistic License Price:
886 downloads
Games::Object 0.11

Games::Object 0.11


Games::Object is a Perl module to provide a base class for game objects. more>>
Games::Object is a Perl module to provide a base class for game objects.

SYNOPSIS

package MyGameObject;
use Games::Object;
use vars qw(@ISA);
@ISA = qw(Games::Object);

sub new {
# Create object
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new(@_);
bless $self, $class;

# Add attributes
$self->new_attr(-name => "hit_points",
-type => int,
-value => 20,
-tend_to_rate => 1);
$self->new_attr(-name => "strength",
-type => int,
-value => 12,
-minimum => 3,
-maximum => 18);
...

return $self;
}

package MyObjectManager;
use Games::Object::Manager;
use vars qw(@ISA);
@ISA = qw(Games::Object::Manager);

sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = $class->SUPER::new( , @_);
bless $self, $class;
...
return $self;
}


my $world = new MyObjectManager;
my $object = new MyGameObject;
$world->add($object);

ABSTRACT

The purpose of this module is to allow a programmer to write a game in Perl easily by providing a basic framework in the form of a module that can be either subclassed to a module of your own or used directly as its own object class. The most important items in this framework are:

Attributes

You can define arbitrary attributes on objects with rules on how they may be updated, as well as set up automatic update of attributes whenever the objects process() method is invoked. For example, you could set an attribute on an object such that:

It ranges from 0 to 100.

Internally it tracks fractional changes to the value but accessing the attribute will always round the result to an integer.

It will automatically tend towards the maximum by 1 every time process() is called on the object.

A method in your subclass will be invoked automatically if the value falls to 0.
This is just one example of what you can do with attributes.

Flags

You can define any number of arbitrarily-named flags on an object. A flag is a little like a boolean attribute, in that it can have a value of either true or false. Like attributes, flags can be created independently on different objects. No "global" flag list is imposed.

Load/Save functionality

Basic functionality is provided for saving data from an object to a file, and for loading data back into an object. This handles the bulk of load game / save game processing, freeing the programmer to worry about the mechanics of the game itself.

The load functionality can also be used to create objects from object templates. An object template would be a save file that contains a single object.

Object Managers

New to version 0.10 of this module is object managers. An object manager is a Perl object that allows you to manage groups of related game objects. The object manager allows you to relate objects together (for example, you could define a relationship that allows certain objects to act as containers for other objects). In effect, the object manager acts as your world or universe.
Like the game object class, the manager class can be subclassed, allowing you augment its functionality. An object manager can be loaded and saved, which in turn performs a load or save of the objects being managed by it.

<<less
Download (0.083MB)
Added: 2006-09-30 License: Perl Artistic License Price:
1119 downloads
Basset::Object 1.04

Basset::Object 1.04


Basset::Object is a Perl module used to create objects. more>>
Basset::Object is a Perl module used to create objects.

This is my ultimate object creation toolset to date. It has roots in Mail::Bulkmail, Text::Flowchart, and the unreleased abstract object constructors that Ive tooled around with in the past.

If you want an object to be compatible with anything else Ive written, then subclass it off of here.

Of course, you dont have to use this to create subclasses, but youll run the risk of making something with an inconsistent interface vs. the rest of the system. Thatll confuse people and make them unhappy. So I recommend subclassing off of here to be consistent. Of course, you may not like these objects, but they do work well and are consistent. Consistency is very important in interface design, IMHO.

<<less
Download (0.14MB)
Added: 2007-06-20 License: GPL (GNU General Public License) Price:
856 downloads
Perlbug::Object 2.93

Perlbug::Object 2.93


Perlbug::Object is a object handler for Perlbug database. more>>
Perlbug::Object is a object handler for Perlbug database.

Handles Perlbug database objects, typically bug, group, message, patch, note, test, user, and severity, status etc....

Methods included to recognise objects by their id or by their also unique name.

SYNOPSIS

my $o_obj = Perlbug::Object->new(%init); # see L

$o_obj = $o_obj->read($oid); # data

my $name = $o_obj->data(name); # Bug

# ALL bugids (optionally) constrained by sql where clause
my @ids = $o_obj->ids($where); # where

# Relation ids
my @patchids = $o_obj->rel_ids(patch); # relids

print = $o_obj->format(h);

<<less
Download (0.49MB)
Added: 2007-07-08 License: Perl Artistic License Price:
841 downloads
HTML Objects 1.2.4

HTML Objects 1.2.4


HTML Objects is a Perl module library for turning HTML tags into Perl objects. more>>
HTML Objects is a Perl module library for turning HTML tags into Perl objects. HTML Objects allows Web pages to be manipulated as a data structure rather than text.

Once manipulation is done, the entire page is generated via depth-first recursion.

<<less
Download (0.025MB)
Added: 2006-05-09 License: GPL (GNU General Public License) Price:
1263 downloads
Object::Declare 0.13

Object::Declare 0.13


Object::Declare is a Perl module for declarative object constructor. more>>
Object::Declare is a Perl module for declarative object constructor.

SYNOPSIS

use Object::Declare [MyApp::Column, MyApp::Param];

my %objects = declare {

param foo =>
!is global,
is immutable,
valid_values are qw( more values );

column bar =>
field1 is value,
field2 is some_other_value;

};

print $objects{foo}; # a MyApp::Param object
print $objects{bar}; # a MyApp::Column object

This module exports one function, declare, for building named objects with a declarative syntax, similar to how Jifty::DBI::Schema defines its columns.

In list context, declare returns a list of name/object pairs in the order of declaration (allowing duplicates), suitable for putting into a hash. In scalar context, declare returns a hash reference.
Using a flexible import interface, one can change exported helper functions names (declarator), words to link labels and values together (copula), and the table of named classes to declare (mapping):

use Object::Declare
declarator => [declare], # list of declarators
copula => { # list of words, or a map
is => , # from copula to prefixes for
are => , # labels built with that copula
}
aliases => { # list of label aliases:
more => less, # turns "is more" into "is less"
# and "more is 1" into "less is 1"
},
mapping => {
column => MyApp::Column, # class name to call ->new to
param => sub { # arbitrary coderef also works
bless(@_, MyApp::Param);
},
};

After the declarator block finishes execution, all helper functions are removed from the package. Same-named functions (such as &is and &are) that existed before the declarators execution are restored correctly.

<<less
Download (0.027MB)
Added: 2006-10-18 License: Perl Artistic License Price:
1101 downloads
Math Objects 0.1.3

Math Objects 0.1.3


Math Objects is a math template library for C++ using generic programming techniques. more>>
Math Objects is a math template library written in C++ using generic programming techniques. In order to use the "Math Objects" library, the user only has to include the header files he needs (e.g. Matrix.h, Polynomial.h etc.).
In order to compile the library the user needs an ISO/IEC 14882:1998 standard compliant C++ compiler (e.g. one that supports partial template specializations).
The math library has math objects like matrices, polynomials, rational functions, extended precision numbers, complex numbers etc. that can be handled in a similar way like basic numerical types (e.g. integers or floating point numbers).
One can access properties of a mathematical type through a (partial) specialization of a traits class for that type (AlgebraicTraits). Having the traits classes to expose properties of mathematical objects, one can define for example matrices of polynomials having extended precision complex coefficients and apply to them basic linear algebra algorithms using normal C++ syntax.
This library also implements two functions using two deterministic algorithms that compute the Smith form for polynomial matrices, and the Smith-McMillan form of a transfer functions matrix also keeping track of the transformation matrices.
These algorithms can be used to describe a MIMO (multi input-multi output) system by means of its zeros and poles and also give the MFD (matrix fraction description) of the system.
Enhancements:
- Recoded the LongInt class aiming for better runtime efficiency.
<<less
Download (0.28MB)
Added: 2006-02-21 License: GPL (GNU General Public License) Price:
1343 downloads
Color::Object 0.1_02

Color::Object 0.1_02


Color::Object is a OO-Color Module. more>>
Color::Object is a OO-Color Module.

A module for manipulation Colors within RGB, HSV and HSL color-spaces for usage within PDF-Documents especially with the Text::PDF::API modules.

SYNOPSIS

use Color::Object;

$cl = Color::Object->new;
$cl = Color::Object->newRGB($r,$g,$b);
$cl = Color::Object->newHSV($h,$s,$v);
$cl = Color::Object->newHSL($h,$s,$l);

$cl->setRGB($r,$g,$b);
$cl->addBrightness($br);
($h,$s,$l) = $cl->asHSL;

METHODS

Color::Object->new
Color::Object->newRGB $r, $g, $b
Color::Object->newHSV $h, $s, $v
Color::Object->newHSL $h, $s, $l
Color::Object->newGrey $grey
( $r, $g, $b ) = $cl->asRGB
Returns $cls rgb values. Range [0 .. 1].
( $h, $s, $v ) = $cl->asHSV
Returns $cls hsv values. Ranges h [0 .. 360], s/v [0 .. 1].
( $h, $s, $l ) = $cl->asHSL
Returns $cls hsl values. Ranges h [0 .. 360], s/l [0 .. 1].
$grey = $cl->asGrey
$grey = $cl->asGrey2
Returns $cls grey value. Range [0 .. 1]. Functions 2 returns the geometric mean of the corresponding RGB values.
( $c, $m, $y )= $cl->asCMY
Returns $cls cmy values. Range [0 .. 1].
( $c, $m, $y, $k )= $cl->asCMYK
( $c, $m, $y, $k )= $cl->asCMYK2
( $c, $m, $y, $k )= $cl->asCMYK3
Returns $cls cmyk values. Range [0 .. 1]. Function 2 returns a 25% lighter color-equivalent. Function 3 returns a 25% lighter color-equivalent.
$hex = $cl->asHex
Returns $cls rgb values as 6 hex-digits.
$cl->setRGB $r, $g, $b
Sets the $cls rgb values. Valid range [0 .. 1].
$cl->setHSV $h, $s, $v
Sets the $cls hsv values. Valid ranges: h [0..360], s/v [0..1].
$cl->setHSL $h, $s, $l
Sets the $cls hsl values. Valid ranges: h [0..360], s/l [0..1].
$cl->setGrey $grey
Sets the $cls grey value. Valid range [0 .. 1].
$cl->setHex $hex
Sets the $cls rgb values using 6 hex-nibbles.
$cl->addSaturation $saturation
Adds to the $cls saturation in the HSV model. Valid range [-1 .. 1].
$cl->setSaturation $saturation
Sets the $cls saturation in the HSV model. Valid range [0 .. 1].
$cl->rotHue $degrees
Rotates the $cls hue in the HSV/L model. Valid range [-360 .. 360].
$cl->setHue $hue
Sets the $cls hue in the HSV/L model. Valid range [0 .. 360].
$cl->addBrightness $brightness
Adds to the $cls brightness in the HSV model. Valid range [-1 .. 1].
$cl->setBrightness $brightness
Sets the $cls brightness in the HSV model. Valid range [0 .. 1].
$cl->addLightness $lightness
Adds to the $cls lightness in the HSL model. Valid range [-1 .. 1].
$cl->setLightness $lightness
Sets the $cls lightness in the HSL model. Valid range [0 .. 1].

<<less
Download (0.003MB)
Added: 2007-07-31 License: Perl Artistic License Price:
815 downloads
Open Object Rexx 8.0

Open Object Rexx 8.0


Open Object Rexx is a curses widget set for Tcl. more>>
This is an excellent widget set for Tcl which retains much of the Tk syntax, but uses curses to render the widgets in a character-cell terminal instead of X and a graphical display.

Installation

1. Type "./configure". This runs a configuration script made by GNU autoconf, which configures Ck for your system and creates a Makefile. The configure script allows you to customize the configuration to your local needs; for details how to do this, type "./configure --help" or refer to the autoconf documentation (not included here).

The following special switches are supported by "configure":

--enable-shared If this switch is specified Ck will compile itself as a shared library if configure can figure out how to do this on this platform.

--with-tcl Specifies the directory containing the Tcl binaries and Tcls platform-dependent configuration information. By default the Tcl distribution is assumed to be in "../../tcl8.0".

2. Type "make". This will create a library called "libck.a" or "libck8.0.so" and an interpreter application called "cwsh" that allows you to type Tcl commands interactively or execute scripts.

3. Type "make install" to install Cks binaries, script files, and man pages in standard places. Youll need write permission on the install directories to do this. If you plan to install the libraries, executables, and script files whitout documentation, use "make install-binaries" and "make install-libraries".

4. Now you should be able to execute "cwsh". However, if you havent installed Ck then youll need to set the CK_LIBRARY environment variable to hold the full path name of the "library" subdirectory. If Ck has been built as shared library, you have to set the LD_LIBRARY_PATH to include the directory where "libck8.0.so" resides.

So far, Ck8.0 has been successfully tested on various Linux distributions, on FreeBSD 3.3 with manually adapted Makefile, and on Windows NT 4.0 with a modified PDCURSES library. The Ck8.0 source tree should be able to be combined with Tcl7.4, 7.5, 7.6, and 8.0. Older version of Ck (which use Tcl7.4 or Tcl7.5) are in use for several years on HP-UX, AIX, and DEC Unix.
<<less
Download (0.39MB)
Added: 2005-04-14 License: BSD License Price:
1654 downloads
Object::Mediator 0.02

Object::Mediator 0.02


Object::Mediator is a generic object persistence framework. more>>
Object::Mediator is a generic object persistence framework.

SYNOPSIS

package Persistent;

use base qw( Object::Mediator );

__PACKAGE__->mk_attr ( qw(foo bar) );

sub _set_id {
my $self = shift;

my $id = generate_identity();

$self->identity( $id );
}

sub _insert {
my $self = shift;

$db_handle->insert ( $self->id, $self->foo, $self->bar );
}

sub _update {
my $self = shift;

$db_handle->update ( $self );
}

sub _delete {
my $self = shift;

$db_handle->delete ( $self->id );
}

sub _select {
my $self = shift;

my ( $foo, $bar ) = $db_handle->select ( $self->id );

$self->foo ( $foo );
$self->bar ( $bar );
}

Object::Mediator attempts to be simple and fairly minimalistic object mapping framework. Main aims of development were: usage simplicity, end user transparency, database independency and minimization of database interaction with some kind of in-memory object state control system.

<<less
Download (0.006MB)
Added: 2007-05-18 License: Perl Artistic License Price:
890 downloads
Object::InsideOut 3.17

Object::InsideOut 3.17


Object::InsideOut is a comprehensive inside-out object support module. more>>
Object::InsideOut is a comprehensive inside-out object support module.

SYNOPSIS

package My::Class; {
use Object::InsideOut;

# Numeric field
# With combined get+set accessor
my @data
:Field
:Type(numeric)
:Accessor(data);

# Takes INPUT (or input, etc.) as a mandatory parameter to ->new()
my %init_args :InitArgs = (
INPUT => {
Regex => qr/^input$/i,
Mandatory => 1,
Type => numeriC,
},
);

# Handle class-specific args as part of ->new()
sub init :Init
{
my ($self, $args) = @_;

# Put input parameter into data field
$self->set(@data, $args->{INPUT});
}
}

package My::Class::Sub; {
use Object::InsideOut qw(My::Class);

# List field
# With standard get_X and set_X accessors
# Takes INFO as an optional list parameter to ->new()
# Value automatically added to @info array
# Defaults to [ empty ]
my @info
:Field
:Type(list)
:Standard(info)
:Arg(Name => INFO, Default => empty);
}

package Foo; {
use Object::InsideOut;

# Field containing My::Class objects
# With combined accessor
# Plus automatic parameter processing on object creation
my @foo
:Field
:Type(My::Class)
:All(foo);
}

package main;

my $obj = My::Class::Sub->new(Input => 69);
my $info = $obj->get_info(); # [ empty ]
my $data = $obj->data(); # 69
$obj->data(42);
$data = $obj->data(); # 42

$obj = My::Class::Sub->new(INFO => help, INPUT => 86);
$data = $obj->data(); # 86
$info = $obj->get_info(); # [ help ]
$obj->set_info(qw(foo bar baz));
$info = $obj->get_info(); # [ foo, bar, baz ]

my $foo_obj = Foo->new(foo => $obj);
$foo_obj->foo()->data(); # 86

<<less
Download (0.010MB)
Added: 2007-05-18 License: Perl Artistic License Price:
889 downloads
Bio::Root::Object 1.4

Bio::Root::Object 1.4


Bio::Root::Object is a core Perl 5 object. more>>
Bio::Root::Object is a core Perl 5 object.

SYNOPSIS

# Use this module as the root of your inheritance tree.
Object Creation
require Bio::Root::Object;

$dad = new Bio::Root::Object();
$son = new Bio::Root::Object(-name => Junior,
-parent => $dad,
-make => full);
See the new() method for a complete description of parameters. See also the USAGE section .

Bio::Root::Object attempts to encapsulate the "core" Perl5 object: What are the key data and behaviors ALL (or at least most) Perl5 objects should have?
Rationale

Use of Bio::Root::Object.pm within the Bioperl framework facilitates operational consistency across the different modules defined within the Bio:: namespace. Not all objects need to derive from Bio::Root::Object.pm. However, when generating lots of different types of potentially complex objects which should all conform to a set of basic expectations, this module may be handy.

At the very least, this module saves you from re-writing the new() method for each module you develop. It also permits consistent and robust handling of -tag => value method arguments via the Bio::Root::RootI::_rearrange() method and provides a object-oriented way handle exceptions and warnings via the Bio::Root::Root::throw() and Bio::Root::Root::warn() methods.

See the APPENDIX section for some other handy methods.

Fault-Tolerant Objects

A major motivation for this module was to promote the creation of robust, fault-tolerant Perl5 objects. The Bio::Root::Root::throw() method relies on Perls built-in eval{}/die exception mechanism to generate fatal exceptions. The data comprising an exception is managed by the Bio::Root::Err.pm module, which essentially allows the data thrown by a die() event to be wrapped into an object that can be easily examined and possibly re-thrown.

The intent here is three-fold:

1 Detailed error reporting.
Allow objects to report detailed information about the error condition (who, what, where, why, how).
2 Handle complex errors in objects.
The goal is to make it relatively painless to detect and handle the wide variety of errors possible with a complex Perl object. Perls error handling mechanism is a might clunky when it comes to handling complex errors within complex objects, but it is improving.
3 Efficient & easy exception handling.
To enable robust exception handling without incurring a significant performance penalty in the resulting code. Ideally, exception handling code should be transparent to the cpu until and unless an exception arises.

These goals may at times be at odds and we are not claiming to have achieved the perfect balance. Ultimately, we want self- sufficient object-oriented systems able to deal with their own errors. This area should improve as the module, and Perl, evolve. One possible modification might be to utilize Graham Barrs Error.pm module or Torsten Ekedahls Experimental::Exception.pm module (see "Other Exception Modules").

Technologies such as these may eventually be incorporated into future releases of Perl. The exception handling used by Bio::Root::Object.pm can be expected to change as Perls exception handling mechanism evolves.

TERMINOLOGY NOTE: In this discussion and elsewhere in this module, the terms "Exception" and "Error" are used interchangeably to mean "something unexpected occurred" either as a result of incorrect user input or faulty internal processing.

<<less
Download (4.7MB)
Added: 2006-06-16 License: Perl Artistic License Price:
1225 downloads
Object::LocalVars 0.16

Object::LocalVars 0.16


Object::LocalVars is a Perl module with outside-in objects with local aliasing of $self and object variables. more>>
Object::LocalVars is a Perl module with outside-in objects with local aliasing of $self and object variables.
SYNOPSIS
package My::Object;
use strict;
use Object::LocalVars;
give_methods our $self; # this exact line is required
our $field1 : Prop;
our $field2 : Prop;
sub as_string : Method {
return "$self has properties $field1 and $field2";
}
This is a development release. The API may change slightly. Do not use for production purposes. Comments appreciated.
This module helps developers create "outside-in" objects. Properties (and $self) are declared as package globals. Method calls are wrapped such that these globals take on a local value that is correct for the specific calling object and the duration of the method call. I.e. $self is locally aliased to the calling object and properties are locally aliased to the values of the properties for that object. The package globals themselves only declare properties in the package and hold no data themselves. Data are stored in a separate namespace for each property, keyed off the reference memory addresses of the objects.
Outside-in objects are similar to "inside-out" objects, which store data in a single lexical hash (or closure) for each property, which is keyed off the reference memory addresses of the objects. Both differ from classic Perl objects, which hold data for the object directly using a blessed reference or closure to a data structure, typically a hash. For both outside-in and inside-out objects, data are stored centrally and the blessed reference is simply a key to look up the right data in the central data store.
The use of package variables for outside-in objects allows for the use of dynamic symbol table manipulation and aliasing. As a result, Object::LocalVars delivers a variety of features -- though with some corresponding drawbacks.
Main features:
- Provides $self automatically to methods without my $self = shift and the like
- Provides dynamic aliasing of properties within methods -- methods can access properties directly as variables without the overhead of calls to accessors or mutators, eliminating the overhead of these calls in methods
- Array and hash properties may be accessed via direct dereference of simple variables, allowing developers to push, pop, splice, etc. without the usual tortured syntax to dereference an accessor call
- Properties no longer require accessors to have compile time syntax checking under strictures (i.e. use strict); public properties have accessors automatically provided as needed
- Uses attributes to mark properties and methods, but only in the BEGIN phase so should be mod_perl friendly (though this has not been tested yet)
- Provides attributes for public, protected and private properties, class properties, and methods
- Orthogonality -- can subclass just about any other class, regardless of implementation.
- Multiple inheritance supported in initializers and destructors (though only one superclass can be of a special, orthogonal type)
- Minimally thread-safe under Perl 5.8 or greater -- objects are safely cloned across thread boundaries (or a pseudo-fork on Win32)
- Achieves these features without source filtering
<<less
Download (0.040MB)
Added: 2007-06-22 License: Perl Artistic License Price:
854 downloads
Object::Trampoline 1.25

Object::Trampoline 1.25


Object::Trampoline is a Perl module for delay object construction. more>>
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.

<<less
Download (0.009MB)
Added: 2007-05-19 License: Perl Artistic License Price:
888 downloads
Secleted [ 0 ] software to compare
  • Page: 1 of 5
  • 1
  • 2
  • 3
  • 4
  • 5