gym class heroes
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 2642
Class::Interfaces 0.04
Class::Interfaces is a Per module for defining interface classes inline. more>>
Class::Interfaces is a Per module for defining interface classes inline.
SYNOPSIS
# define some simple interfaces
use Class::Interfaces (
Serializable => [ pack, unpack ],
Printable => [ toString ],
Iterable => [ iterator ],
Iterator => [ hasNext, next ]
);
# or some more complex ones ...
# interface can also inherit from
# other interfaces using this form
use Class::Interfaces (
BiDirectionalIterator => {
isa => Iterator,
methods => [ hasPrev, prev ]
},
ResetableIterator => {
isa => Iterator,
methods => [ reset ]
},
# we even support multiple inheritance
ResetableBiDirectionalIterator => {
isa => [ ResetableIterator, BiDirectionalIterator ]
}
);
# it is also possible to create an
# empty interface, sometimes called
# a marker interface
use Class::Interfaces (
JustAMarker => undef
);
This module provides a simple means to define abstract class interfaces, which can be used to program using the concepts of interface polymorphism.
<<lessSYNOPSIS
# define some simple interfaces
use Class::Interfaces (
Serializable => [ pack, unpack ],
Printable => [ toString ],
Iterable => [ iterator ],
Iterator => [ hasNext, next ]
);
# or some more complex ones ...
# interface can also inherit from
# other interfaces using this form
use Class::Interfaces (
BiDirectionalIterator => {
isa => Iterator,
methods => [ hasPrev, prev ]
},
ResetableIterator => {
isa => Iterator,
methods => [ reset ]
},
# we even support multiple inheritance
ResetableBiDirectionalIterator => {
isa => [ ResetableIterator, BiDirectionalIterator ]
}
);
# it is also possible to create an
# empty interface, sometimes called
# a marker interface
use Class::Interfaces (
JustAMarker => undef
);
This module provides a simple means to define abstract class interfaces, which can be used to program using the concepts of interface polymorphism.
Download (0.006MB)
Added: 2006-10-05 License: Perl Artistic License Price:
1115 downloads
Class::ArrayObjects 1.02
Class::ArrayObjects is a Perl utility class for array based objects. more>>
Class::ArrayObjects is a Perl utility class for array based objects.
SYNOPSIS
package Some::Class;
use Class::ArrayObjects define => {
fields => [qw(_foo_ _bar_ BAZ)],
};
or
package Other::Class;
use base Some::Class;
use Class::ArrayObjects extend => {
class => Some::Class,
with => [qw(_zorg_ _fnord_ BEZ)],
import => 1,
};
This module is little more than a cute way of defining constant subs in your own package. Constant subs are very useful when dealing with array based objects because they allow one to access array slots by name instead of by index.
<<lessSYNOPSIS
package Some::Class;
use Class::ArrayObjects define => {
fields => [qw(_foo_ _bar_ BAZ)],
};
or
package Other::Class;
use base Some::Class;
use Class::ArrayObjects extend => {
class => Some::Class,
with => [qw(_zorg_ _fnord_ BEZ)],
import => 1,
};
This module is little more than a cute way of defining constant subs in your own package. Constant subs are very useful when dealing with array based objects because they allow one to access array slots by name instead of by index.
Download (0.006MB)
Added: 2006-10-06 License: Perl Artistic License Price:
1113 downloads
Heroes 0.21
Heroes project is a Nibbles-like game, just better. more>>
Heroes project is a Nibbles-like game, just better.
Heroes is similar to the "Tron" and "Nibbles" games of yore, but includes many graphical improvements and new game features.
In it, you must maneuver a small vehicle around a world and collect powerups while avoiding obstacles, your opponents trails, and even your own trail.
There are five game modes available. Quest is the classical Nibbles, in Death Match you start with very long tails and must kill your opponents, in Killem All you must run over lemmings moving on the ground, in Time Cash or Color modes you must collect money or pyramids of color. Heroes features 12 original sound tracks, 94 levels (in 10 different tile sets) plus a level editor.
Heroes source code (distributed under the GNU General Public Licence version 2) originates from an original MS-DOS game but has been heavily modified to enhance the portability. Some new features have been added and MS-DOS support has been lost by the meantime. The original MS-DOS version can still be found on the Internet but is unmaintained and should be considered obsolete.
The current development concentrates on cleaning the code and porting the game to the various operating systems available. Our objective is to release the version 1.0 as a clean and portable base that would allow significant additions such as network support or programmable vehicles.
Enhancements:
- Support for the heroes-hq-sound-tracks package.
Bug fixes:
- soundconf: failed to override aliases.
- Heroes GGI driver failed to report an error if no two-frame mode was available.
- Various code nits.
<<lessHeroes is similar to the "Tron" and "Nibbles" games of yore, but includes many graphical improvements and new game features.
In it, you must maneuver a small vehicle around a world and collect powerups while avoiding obstacles, your opponents trails, and even your own trail.
There are five game modes available. Quest is the classical Nibbles, in Death Match you start with very long tails and must kill your opponents, in Killem All you must run over lemmings moving on the ground, in Time Cash or Color modes you must collect money or pyramids of color. Heroes features 12 original sound tracks, 94 levels (in 10 different tile sets) plus a level editor.
Heroes source code (distributed under the GNU General Public Licence version 2) originates from an original MS-DOS game but has been heavily modified to enhance the portability. Some new features have been added and MS-DOS support has been lost by the meantime. The original MS-DOS version can still be found on the Internet but is unmaintained and should be considered obsolete.
The current development concentrates on cleaning the code and porting the game to the various operating systems available. Our objective is to release the version 1.0 as a clean and portable base that would allow significant additions such as network support or programmable vehicles.
Enhancements:
- Support for the heroes-hq-sound-tracks package.
Bug fixes:
- soundconf: failed to override aliases.
- Heroes GGI driver failed to report an error if no two-frame mode was available.
- Various code nits.
Download (MB)
Added: 2006-12-05 License: GPL (GNU General Public License) Price:
1058 downloads
Class::Generate 1.09
Class::Generate is a Perl module that can generate Perl class hierarchies. more>>
Class::Generate is a Perl module that can generate Perl class hierarchies.
SYNOPSIS
use Class::Generate qw(class subclass delete_class);
# Declare class Class_Name, with the following types of members:
class
Class_Name => [
s => $, # scalar
a => @, # array
h => %, # hash
c => Class, # Class
c_a => @Class, # array of Class
c_h => %Class, # hash of Class
&m => body, # method
];
# Allocate an instance of class_name, with members initialized to the
# given values (pass arrays and hashes using references).
$obj = Class_Name->new ( s => scalar,
a => [ values ],
h => { key1 => v1, ... },
c => Class->new,
c_a => [ Class->new, ... ],
c_h => [ key1 => Class->new, ... ] );
# Scalar type accessor:
$obj->s($value); # Assign $value to member s.
$member_value = $obj->s; # Access members value.
# (Class) Array type accessor:
$obj->a([value1, value2, ...]); # Assign whole array to member.
$obj->a(2, $value); # Assign $value to array member 2.
$obj->add_a($value); # Append $value to end of array.
@a = $obj->a; # Access whole array.
$ary_member_value = $obj->a(2); # Access array member 2.
$s = $obj->a_size; # Return size of array.
$value = $obj->last_a; # Return last element of array.
# (Class) Hash type accessor:
$obj->h({ k_1=>v1, ..., k_n=>v_n }) # Assign whole hash to member.
$obj->h($key, $value); # Assign $value to hash member $key.
%hash = $obj->h; # Access whole hash.
$hash_member_value = $obj->h($key); # Access hash member value $key.
$obj->delete_h($key); # Delete slot occupied by $key.
@keys = $obj->h_keys; # Access keys of member h.
@values = $obj->h_values; # Access values of member h.
$another = $obj->copy; # Copy an object.
if ( $obj->equals($another) ) { ... } # Test equality.
subclass s => [ ], -parent => class_name;
The Class::Generate package exports functions that take as arguments a class specification and create from these specifications a Perl 5 class. The specification language allows many object-oriented constructs: typed members, inheritance, private members, required members, default values, object methods, class methods, class variables, and more.
CPAN contains similar packages. Why another? Because object-oriented programming, especially in a dynamic language like Perl, is a complicated endeavor. I wanted a package that would work very hard to catch the errors you (well, I anyway) commonly make. I wanted a package that could help me enforce the contract of object-oriented programming. I also wanted it to get out of my way when I asked.
<<lessSYNOPSIS
use Class::Generate qw(class subclass delete_class);
# Declare class Class_Name, with the following types of members:
class
Class_Name => [
s => $, # scalar
a => @, # array
h => %, # hash
c => Class, # Class
c_a => @Class, # array of Class
c_h => %Class, # hash of Class
&m => body, # method
];
# Allocate an instance of class_name, with members initialized to the
# given values (pass arrays and hashes using references).
$obj = Class_Name->new ( s => scalar,
a => [ values ],
h => { key1 => v1, ... },
c => Class->new,
c_a => [ Class->new, ... ],
c_h => [ key1 => Class->new, ... ] );
# Scalar type accessor:
$obj->s($value); # Assign $value to member s.
$member_value = $obj->s; # Access members value.
# (Class) Array type accessor:
$obj->a([value1, value2, ...]); # Assign whole array to member.
$obj->a(2, $value); # Assign $value to array member 2.
$obj->add_a($value); # Append $value to end of array.
@a = $obj->a; # Access whole array.
$ary_member_value = $obj->a(2); # Access array member 2.
$s = $obj->a_size; # Return size of array.
$value = $obj->last_a; # Return last element of array.
# (Class) Hash type accessor:
$obj->h({ k_1=>v1, ..., k_n=>v_n }) # Assign whole hash to member.
$obj->h($key, $value); # Assign $value to hash member $key.
%hash = $obj->h; # Access whole hash.
$hash_member_value = $obj->h($key); # Access hash member value $key.
$obj->delete_h($key); # Delete slot occupied by $key.
@keys = $obj->h_keys; # Access keys of member h.
@values = $obj->h_values; # Access values of member h.
$another = $obj->copy; # Copy an object.
if ( $obj->equals($another) ) { ... } # Test equality.
subclass s => [ ], -parent => class_name;
The Class::Generate package exports functions that take as arguments a class specification and create from these specifications a Perl 5 class. The specification language allows many object-oriented constructs: typed members, inheritance, private members, required members, default values, object methods, class methods, class variables, and more.
CPAN contains similar packages. Why another? Because object-oriented programming, especially in a dynamic language like Perl, is a complicated endeavor. I wanted a package that would work very hard to catch the errors you (well, I anyway) commonly make. I wanted a package that could help me enforce the contract of object-oriented programming. I also wanted it to get out of my way when I asked.
Download (0.052MB)
Added: 2007-07-31 License: Perl Artistic License Price:
815 downloads
Class::Meta::Express 0.04
Class::Meta::Express is a Perl module for concise, expressive creation of Class::Meta classes. more>>
Class::Meta::Express is a Perl module for concise, expressive creation of Class::Meta classes.
Synopsis
package My::Contact;
use Class::Meta::Express;
class {
meta contact => ( default_type => string );
has name;
has contact => ( required => 1 );
}
This module provides an interface to concisely yet expressively create classes with Class::Meta. Although I am of course fond of Class::Meta, Ive never been overly thrilled with its interface for creating classes:
package My::Thingy;
use Class::Meta;
BEGIN {
# Create a Class::Meta object for this class.
my $cm = Class::Meta->new( key => thingy );
# Add a constructor.
$cm->add_constructor( name => new );
# Add a couple of attributes with generated accessors.
$cm->add_attribute(
name => id,
is => integer,
required => 1,
);
$cm->add_attribute(
name => name,
is => string,
required => 1,
);
$cm->add_attribute(
name => age,
is => integer,
);
# Add a custom method.
$cm->add_method(
name => chk_pass,
code => sub { return code },
);
$cm->build;
}
This example is relatively simple; it can get a lot more verbose. But even still, all of the method calls were annoying. I mean, whoever thought of using an object oriented interface for declaring a class? (Oh yeah: I did.) I wasnt alone in wanting a more declarative interface; Curtis Poe, with my blessing, created Class::Meta::Declare, which would use this syntax to create the same class:
package My::Thingy;
use Class::Meta::Declare :all;
Class::Meta::Declare->new(
# Create a Class::Meta object for this class.
meta => [
key => thingy,
],
# Add a constructor.
constructors => [
new => { }
],
# Add a couple of attributes with generated accessors.
attributes => [
id => {
type => $TYPE_INTEGER,
required => 1,
},
name => {
required => 1,
type => $TYPE_STRING,
},
age => { type => $TYPE_INTEGER, },
],
# Add a custom method.
methods => [
chk_pass => {
code => sub { return code },
}
]
);
This approach has the advantage of being a bit more concise, and it is declarative, but I find all of the indentation levels annoying; its hard for me to figure out where I am, especially if I have to define a lot of attributes. And finally, everything is a string with this syntax, except for those ugly read-only scalars such as $TYPE_INTEGER. So I cant easily tell where one attribute ends and the next one starts. Bleh.
<<lessSynopsis
package My::Contact;
use Class::Meta::Express;
class {
meta contact => ( default_type => string );
has name;
has contact => ( required => 1 );
}
This module provides an interface to concisely yet expressively create classes with Class::Meta. Although I am of course fond of Class::Meta, Ive never been overly thrilled with its interface for creating classes:
package My::Thingy;
use Class::Meta;
BEGIN {
# Create a Class::Meta object for this class.
my $cm = Class::Meta->new( key => thingy );
# Add a constructor.
$cm->add_constructor( name => new );
# Add a couple of attributes with generated accessors.
$cm->add_attribute(
name => id,
is => integer,
required => 1,
);
$cm->add_attribute(
name => name,
is => string,
required => 1,
);
$cm->add_attribute(
name => age,
is => integer,
);
# Add a custom method.
$cm->add_method(
name => chk_pass,
code => sub { return code },
);
$cm->build;
}
This example is relatively simple; it can get a lot more verbose. But even still, all of the method calls were annoying. I mean, whoever thought of using an object oriented interface for declaring a class? (Oh yeah: I did.) I wasnt alone in wanting a more declarative interface; Curtis Poe, with my blessing, created Class::Meta::Declare, which would use this syntax to create the same class:
package My::Thingy;
use Class::Meta::Declare :all;
Class::Meta::Declare->new(
# Create a Class::Meta object for this class.
meta => [
key => thingy,
],
# Add a constructor.
constructors => [
new => { }
],
# Add a couple of attributes with generated accessors.
attributes => [
id => {
type => $TYPE_INTEGER,
required => 1,
},
name => {
required => 1,
type => $TYPE_STRING,
},
age => { type => $TYPE_INTEGER, },
],
# Add a custom method.
methods => [
chk_pass => {
code => sub { return code },
}
]
);
This approach has the advantage of being a bit more concise, and it is declarative, but I find all of the indentation levels annoying; its hard for me to figure out where I am, especially if I have to define a lot of attributes. And finally, everything is a string with this syntax, except for those ugly read-only scalars such as $TYPE_INTEGER. So I cant easily tell where one attribute ends and the next one starts. Bleh.
Download (0.009MB)
Added: 2006-10-19 License: Perl Artistic License Price:
1105 downloads
Class::Inner 0.1
Class::Inner is a perlish implementation of Java like inner classes. more>>
Class::Inner is a perlish implementation of Java like inner classes.
SYNOPSIS
use Class::Inner;
my $object = Class::Inner->new(
parent => ParentClass,
methods => { method => sub { ... } }, },
constructor => new,
args => [@constructor_args],
);
Yet another implementation of an anonymous class with per object overrideable methods, but with the added attraction of sort of working dispatch to the parent classs method.
METHODS
new HASH
Takes a hash like argument list with the following keys.
parent
The name of the parent class. Note that you can only get single inheritance with this or SUPER wont work.
methods
A hash, keys are method names, values are CODEREFs.
constructor
The name of the constructor method. Defaults to new.
args
An anonymous array of arguments to pass to the constructor. Defaults to an empty list.
Returns an object in an anonymous class which inherits from the parent class. This anonymous class has a couple of extra methods:
SUPER
If you were to pass something like
$obj = Class::Inner->new(
parent => Parent,
methods => { method => sub { ...; $self->SUPER::method(@_) } },
);
then $self-gtSUPER::method almost certainly wouldnt do what you expect, so we provide the SUPER method which dispatches to the parent implementation of the current method. There seems to be no good way of getting the full SUPER:: functionality, but Im working on it.
DESTROY
Because Class::Inner works by creating a whole new class name for your object, it could potentially leak memory if you create a lot of them. So we add a DESTROY method that removes the class from the symbol table once its finished with.
If you need to override a parents DESTROY method, adding a call to Class::Inner::clean_symbol_table(ref $self) to it. Do it at the end of the method or your other method calls wont work.
clean_symbol_table
The helper subroutine that DESTROY uses to remove the class from the symbol table.
new_classname
Returns a name for the next anonymous class.
<<lessSYNOPSIS
use Class::Inner;
my $object = Class::Inner->new(
parent => ParentClass,
methods => { method => sub { ... } }, },
constructor => new,
args => [@constructor_args],
);
Yet another implementation of an anonymous class with per object overrideable methods, but with the added attraction of sort of working dispatch to the parent classs method.
METHODS
new HASH
Takes a hash like argument list with the following keys.
parent
The name of the parent class. Note that you can only get single inheritance with this or SUPER wont work.
methods
A hash, keys are method names, values are CODEREFs.
constructor
The name of the constructor method. Defaults to new.
args
An anonymous array of arguments to pass to the constructor. Defaults to an empty list.
Returns an object in an anonymous class which inherits from the parent class. This anonymous class has a couple of extra methods:
SUPER
If you were to pass something like
$obj = Class::Inner->new(
parent => Parent,
methods => { method => sub { ...; $self->SUPER::method(@_) } },
);
then $self-gtSUPER::method almost certainly wouldnt do what you expect, so we provide the SUPER method which dispatches to the parent implementation of the current method. There seems to be no good way of getting the full SUPER:: functionality, but Im working on it.
DESTROY
Because Class::Inner works by creating a whole new class name for your object, it could potentially leak memory if you create a lot of them. So we add a DESTROY method that removes the class from the symbol table once its finished with.
If you need to override a parents DESTROY method, adding a call to Class::Inner::clean_symbol_table(ref $self) to it. Do it at the end of the method or your other method calls wont work.
clean_symbol_table
The helper subroutine that DESTROY uses to remove the class from the symbol table.
new_classname
Returns a name for the next anonymous class.
Download (0.003MB)
Added: 2007-06-06 License: Perl Artistic License Price:
871 downloads
Class::HPLOO 0.23
Class::HPLOO is an easier way to declare classes on Perl, based in the popular class {...} style and ePod. more>>
Class::HPLOO is an easier way to declare classes on Perl, based in the popular class {...} style and ePod.
USAGE
use Class::HPLOO ;
class Foo extends Bar , Baz {
use LWP::Simple qw(get) ; ## import the method get() to this package.
attr ( array foo_list , int age , string name , foo ) ## define attributes.
vars ($GLOBAL_VAR) ; ## same as: use vars qw($GLOBAL_VAR);
my ($local_var) ;
## constructor/initializer:
sub Foo {
$this->{attr} = $_[0] ;
}
## methods with input variables declared:
sub get_pages ($base , @pages , %options) {
my @htmls ;
if ( $options{proxy} ) { ... }
foreach my $pages_i ( @pages ) {
my $url = "$base/$pages_i" ;
my $html = get($url) ;
push(@htmls , $html) ;
$this->cache($url , $html) ;
}
return @htmls ;
}
## methos like a normal Perl sub:
sub cache {
my ( $url , $html ) = @_ ;
$this->{CACHE}{$url} = $html ;
}
sub attributes_example {
$this->set_foo_list(qw(a b c d e f)) ;
my @l = $this->get_foo_list ;
$this->set_age(30) ;
$this->set_name("Joe") ;
$this->set_foo( time() ) ;
print "NAME: ". $this->get_name ."n" ;
print "AGE: ". $this->get_age ."n" ;
print "FOO: ". $this->get_foo ."n" ;
}
}
## Example of use of the class:
package main ;
my $foo = new Foo(123) ;
$foo->get_pages(http://www.perlmonks.com/, [/index.pl,/foo] , {proxy => localhost:8080}) ;
<<lessUSAGE
use Class::HPLOO ;
class Foo extends Bar , Baz {
use LWP::Simple qw(get) ; ## import the method get() to this package.
attr ( array foo_list , int age , string name , foo ) ## define attributes.
vars ($GLOBAL_VAR) ; ## same as: use vars qw($GLOBAL_VAR);
my ($local_var) ;
## constructor/initializer:
sub Foo {
$this->{attr} = $_[0] ;
}
## methods with input variables declared:
sub get_pages ($base , @pages , %options) {
my @htmls ;
if ( $options{proxy} ) { ... }
foreach my $pages_i ( @pages ) {
my $url = "$base/$pages_i" ;
my $html = get($url) ;
push(@htmls , $html) ;
$this->cache($url , $html) ;
}
return @htmls ;
}
## methos like a normal Perl sub:
sub cache {
my ( $url , $html ) = @_ ;
$this->{CACHE}{$url} = $html ;
}
sub attributes_example {
$this->set_foo_list(qw(a b c d e f)) ;
my @l = $this->get_foo_list ;
$this->set_age(30) ;
$this->set_name("Joe") ;
$this->set_foo( time() ) ;
print "NAME: ". $this->get_name ."n" ;
print "AGE: ". $this->get_age ."n" ;
print "FOO: ". $this->get_foo ."n" ;
}
}
## Example of use of the class:
package main ;
my $foo = new Foo(123) ;
$foo->get_pages(http://www.perlmonks.com/, [/index.pl,/foo] , {proxy => localhost:8080}) ;
Download (0.027MB)
Added: 2007-06-09 License: Perl Artistic License Price:
867 downloads
Class::Phrasebook 0.88
Class::Phrasebook is a Perl module that implements the Phrasebook pattern. more>>
Class::Phrasebook is a Perl module that implements the Phrasebook pattern.
SYNOPSIS
use Class::Phrasebook;
my $pb = new Class::Phrasebook($log, "test.xml");
$pb->load("NL"); # using Dutch as the language
$phrase = $pb->get("ADDRESS",
{ street => "Chaim Levanon",
number => 88,
city => "Tel Aviv" } );
This class implements the Phrasebook pattern. It lets us create dictionaries of phrases. Each phrase can be accessed by a unique key. Each phrase may have placeholders. Group of phrases are kept in a dictionary. The first dictionary is the default one - which means that it will always be read. One of the dictionaries might be used to override the default one. The phrases are kept in an XML document.
<<lessSYNOPSIS
use Class::Phrasebook;
my $pb = new Class::Phrasebook($log, "test.xml");
$pb->load("NL"); # using Dutch as the language
$phrase = $pb->get("ADDRESS",
{ street => "Chaim Levanon",
number => 88,
city => "Tel Aviv" } );
This class implements the Phrasebook pattern. It lets us create dictionaries of phrases. Each phrase can be accessed by a unique key. Each phrase may have placeholders. Group of phrases are kept in a dictionary. The first dictionary is the default one - which means that it will always be read. One of the dictionaries might be used to override the default one. The phrases are kept in an XML document.
Download (0.018MB)
Added: 2006-09-19 License: Perl Artistic License Price:
1131 downloads
Class::Observable 1.04
Class::Observable is a Perl module that allows other classes and objects to respond to events in yours. more>>
Class::Observable is a Perl module that allows other classes and objects to respond to events in yours.
SYNOPSIS
# Define an observable class
package My::Object;
use base qw( Class::Observable );
# Tell all classes/objects observing this object that a state-change
# has occurred
sub create {
my ( $self ) = @_;
eval { $self->_perform_create() };
if ( $@ ) {
My::Exception->throw( "Error saving: $@" );
}
$self->notify_observers();
}
# Same thing, except make the type of change explicit and pass
# arguments.
sub edit {
my ( $self ) = @_;
my %old_values = $self->extract_values;
eval { $self->_perform_edit() };
if ( $@ ) {
My::Exception->throw( "Error saving: $@" );
}
$self->notify_observers( edit, old_values => %old_values );
}
# Define an observer
package My::Observer;
sub update {
my ( $class, $object, $action ) = @_;
unless ( $action ) {
warn "Cannot operation on [", $object->id, "] without action";
return;
}
$class->_on_save( $object ) if ( $action eq save );
$class->_on_update( $object ) if ( $action eq update );
}
# Register the observer class with all instances of the observable
# class
My::Object->add_observer( My::Observer );
# Register the observer class with a single instance of the
# observable class
my $object = My::Object->new( foo );
$object->add_observer( My::Observer );
# Register an observer object the same way
my $observer = My::Observer->new( bar );
My::Object->add_observer( $observer );
my $object = My::Object->new( foo );
$object->add_observer( $observer );
# Register an observer using a subroutine
sub catch_observation { ... }
My::Object->add_observer( &catch_observation );
my $object = My::Object->new( foo );
$object->add_observer( &catch_observation );
# Define the observable class as a parent and allow the observers to
# be used by the child
package My::Parent;
use strict;
use base qw( Class::Observable );
sub prepare_for_bed {
my ( $self ) = @_;
$self->notify_observers( prepare_for_bed );
}
sub brush_teeth {
my ( $self ) = @_;
$self->_brush_teeth( time => 45 );
$self->_floss_teeth( time => 30 );
$self->_gargle( time => 30 );
}
sub wash_face { ... }
package My::Child;
use strict;
use base qw( My::Parent );
sub brush_teeth {
my ( $self ) = @_;
$self->_wet_toothbrush();
}
sub wash_face { return }
# Create a class-based observer
package My::ParentRules;
sub update {
my ( $item, $action ) = @_;
if ( $action eq prepare_for_bed ) {
$item->brush_teeth;
$item->wash_face;
}
}
My::Parent->add_observer( __PACKAGE__ );
$parent->prepare_for_bed # brush, floss, gargle, and wash face
$child->prepare_for_bed # pretend to brush, pretend to wash face
<<lessSYNOPSIS
# Define an observable class
package My::Object;
use base qw( Class::Observable );
# Tell all classes/objects observing this object that a state-change
# has occurred
sub create {
my ( $self ) = @_;
eval { $self->_perform_create() };
if ( $@ ) {
My::Exception->throw( "Error saving: $@" );
}
$self->notify_observers();
}
# Same thing, except make the type of change explicit and pass
# arguments.
sub edit {
my ( $self ) = @_;
my %old_values = $self->extract_values;
eval { $self->_perform_edit() };
if ( $@ ) {
My::Exception->throw( "Error saving: $@" );
}
$self->notify_observers( edit, old_values => %old_values );
}
# Define an observer
package My::Observer;
sub update {
my ( $class, $object, $action ) = @_;
unless ( $action ) {
warn "Cannot operation on [", $object->id, "] without action";
return;
}
$class->_on_save( $object ) if ( $action eq save );
$class->_on_update( $object ) if ( $action eq update );
}
# Register the observer class with all instances of the observable
# class
My::Object->add_observer( My::Observer );
# Register the observer class with a single instance of the
# observable class
my $object = My::Object->new( foo );
$object->add_observer( My::Observer );
# Register an observer object the same way
my $observer = My::Observer->new( bar );
My::Object->add_observer( $observer );
my $object = My::Object->new( foo );
$object->add_observer( $observer );
# Register an observer using a subroutine
sub catch_observation { ... }
My::Object->add_observer( &catch_observation );
my $object = My::Object->new( foo );
$object->add_observer( &catch_observation );
# Define the observable class as a parent and allow the observers to
# be used by the child
package My::Parent;
use strict;
use base qw( Class::Observable );
sub prepare_for_bed {
my ( $self ) = @_;
$self->notify_observers( prepare_for_bed );
}
sub brush_teeth {
my ( $self ) = @_;
$self->_brush_teeth( time => 45 );
$self->_floss_teeth( time => 30 );
$self->_gargle( time => 30 );
}
sub wash_face { ... }
package My::Child;
use strict;
use base qw( My::Parent );
sub brush_teeth {
my ( $self ) = @_;
$self->_wet_toothbrush();
}
sub wash_face { return }
# Create a class-based observer
package My::ParentRules;
sub update {
my ( $item, $action ) = @_;
if ( $action eq prepare_for_bed ) {
$item->brush_teeth;
$item->wash_face;
}
}
My::Parent->add_observer( __PACKAGE__ );
$parent->prepare_for_bed # brush, floss, gargle, and wash face
$child->prepare_for_bed # pretend to brush, pretend to wash face
Download (0.010MB)
Added: 2007-06-06 License: Perl Artistic License Price:
870 downloads
DB_cart Class 1.13
DB_cart Class is a MySQL shopping cart script that can be used with third party product catalogues and membership systems. more>>
DB_cart Class is a MySQL shopping cart script that can be used with third party product catalogues and membership systems. The MySQL database structure is neutral to existing systems.
DB_cart Class can handle the shopping cart (add, update, and empty) and checkout process (set the shipment address and email the order).
For existing cart users, the shopping cart is still available upon the users next visit and is visible by checkout. The last option is configurable togther with a time period.
Enhancements:
- There are modifications and improvements inside the main class file, several examples, and the table structure has been extended.
- There two additional fields for the shipment values (name2 and address2).
- All messages are available in German, English, and Dutch.
- The standard text inside the email messages is in external files now; this content is parsed inside the improved email method.
<<lessDB_cart Class can handle the shopping cart (add, update, and empty) and checkout process (set the shipment address and email the order).
For existing cart users, the shopping cart is still available upon the users next visit and is visible by checkout. The last option is configurable togther with a time period.
Enhancements:
- There are modifications and improvements inside the main class file, several examples, and the table structure has been extended.
- There two additional fields for the shipment values (name2 and address2).
- All messages are available in German, English, and Dutch.
- The standard text inside the email messages is in external files now; this content is parsed inside the improved email method.
Download (0.035MB)
Added: 2006-06-16 License: BSD License Price:
1227 downloads
Dynamic Probe Class Library 3.4.3
Dynamic Probe Class Library (DPCL) is an object-based C++ class library. more>>
Dynamic Probe Class Library (DPCL) is an object-based C++ class library that provides the necessary infrastructure to allow tool developers and sophisticated tool users to build parallel and serial tools through technology called dynamic instrumentation.
Dynamic Probe Class Library takes the basic components needed by tool developers and encapsulates them into C++ classes. Each of these classes provide the member functions necessary to interact and dynamically instrument a running application with software patches called probes.
Dynamic instrumentation provides the flexibility for tools to insert probes into applications as the application is running and only where it is needed.
Enhancements:
- This version is a minor update to DPCL that fixes a couple problems that have been reported since the v3.4.2 release
<<lessDynamic Probe Class Library takes the basic components needed by tool developers and encapsulates them into C++ classes. Each of these classes provide the member functions necessary to interact and dynamically instrument a running application with software patches called probes.
Dynamic instrumentation provides the flexibility for tools to insert probes into applications as the application is running and only where it is needed.
Enhancements:
- This version is a minor update to DPCL that fixes a couple problems that have been reported since the v3.4.2 release
Download (2.5MB)
Added: 2006-07-28 License: GPL (GNU General Public License) Price:
1185 downloads
Class::Driver 0.005
Class::Driver is a Perl module to generate driver (composite) class hierarchies on-the-fly. more>>
EXAMPLE
# This is a really long synopsis, but hopefully it will give you an idea...
package MyPackage;
use Class::Driver;
use base q(Class::Driver);
our %drivers;
return 1;
sub new {
my($class, %args) = @_;
die "mime_type is required" unless($args{mime_type});
die "no driver to handle type $args{mime_type}"
unless($drivers{$args{mime_type}});
return $class->driver_load($drivers{$args{mime_type}}, %args);
}
sub driver_new {
my($class, %args) = @_;
return bless %args, $class;
}
sub driver_required { 1; }
sub driver_requied_here { 0; }
package MyPackage::avi;
use MyPackage;
use base q(MyPackage);
use Video::Info;
$MyPackage::drivers{video/x-msvideo} = avi;
return 1;
sub driver { "avi"; }
sub driver_new {
my($class, %args) = @_;
die "file is a required parameter for $args{mime_type} files"
unless($args{file});
$args{info} = Video::Info->new(-file => $args{file})
or die "Failed to create a Video::Info object for $args{file}";
return $class->SUPER::driver_new(%args);
}
sub duration {
my $self = shift;
return $args{info}->duration;
}
package MyPackage::mp3;
use base q(MyPackage);
use MP3::Info;
$MyPackage::drivers{audio/mpeg} = mp3;
## (etc...)
package main;
my $foo = MyPackage->new(file => foobar.mp3, mime_type => audio/mpeg);
print "foobar.mp3 is ", $foo->duration, " seconds long.n";
Download (0.011MB)
Added: 2006-11-14 License: Perl Artistic License Price:
1075 downloads
Class::Adapter 1.02
Class::Adapter is a Perl implementation of the Adapter Design Pattern. more>>
Class::Adapter is a Perl implementation of the "Adapter" Design Pattern.
The Class::Adapter class is intended as an abstract base class for creating any sort of class or object that follows the Adapter pattern.
What is an Adapter?
The term Adapter refers to a "Design Pattern" of the same name, from the famous "Gang of Four" book "Design Patterns". Although their original implementation was designed for Java and similar single-inheritance strictly-typed langauge, the situation for which it applies is still valid.
An Adapter in this Perl sense of the term is when a class is created to achieve by composition (objects containing other object) something that cant be achieved by inheritance (sub-classing).
This is similar to the Decorator pattern, but is intended to be applied on a class-by-class basis, as opposed to being able to be applied one object at a time, as is the case with the Decorator pattern.
The Class::Adapter object holds a parent object that it "wraps", and when a method is called on the Class::Adapter, it manually calls the same (or different) method with the same (or different) parameters on the parent object contained within it.
Instead of these custom methods being hooked in on an object-by-object basis, they are defined at the class level.
Basically, a Class::Adapter is one of your fall-back positions when Perls inheritance model fails you, or is no longer good enough, and you need to do something twisty in order to make several APIs play nicely with each other.
What can I do with the actual Class::Adapter class
Well... nothing really. It exist to provide some extremely low level fundamental methods, and to provide a common base for inheritance of Adapter classes.
The base Class::Adapter class doesnt even implement a way to push method calls through to the underlying object, since the way in which that happens is the bit that changes from case to case.
To actually DO something, you probably want to go take a look at Class::Adapter::Builder, which makes the creation of Adapter classes relatively quick and easy.
<<lessThe Class::Adapter class is intended as an abstract base class for creating any sort of class or object that follows the Adapter pattern.
What is an Adapter?
The term Adapter refers to a "Design Pattern" of the same name, from the famous "Gang of Four" book "Design Patterns". Although their original implementation was designed for Java and similar single-inheritance strictly-typed langauge, the situation for which it applies is still valid.
An Adapter in this Perl sense of the term is when a class is created to achieve by composition (objects containing other object) something that cant be achieved by inheritance (sub-classing).
This is similar to the Decorator pattern, but is intended to be applied on a class-by-class basis, as opposed to being able to be applied one object at a time, as is the case with the Decorator pattern.
The Class::Adapter object holds a parent object that it "wraps", and when a method is called on the Class::Adapter, it manually calls the same (or different) method with the same (or different) parameters on the parent object contained within it.
Instead of these custom methods being hooked in on an object-by-object basis, they are defined at the class level.
Basically, a Class::Adapter is one of your fall-back positions when Perls inheritance model fails you, or is no longer good enough, and you need to do something twisty in order to make several APIs play nicely with each other.
What can I do with the actual Class::Adapter class
Well... nothing really. It exist to provide some extremely low level fundamental methods, and to provide a common base for inheritance of Adapter classes.
The base Class::Adapter class doesnt even implement a way to push method calls through to the underlying object, since the way in which that happens is the bit that changes from case to case.
To actually DO something, you probably want to go take a look at Class::Adapter::Builder, which makes the creation of Adapter classes relatively quick and easy.
Download (0.024MB)
Added: 2007-06-20 License: Perl Artistic License Price:
856 downloads
Class::Method::hash 2.08
Class::Method::hash is a Perl module that helps you create methods for handling a hash value. more>>
Class::Method::hash is a Perl module that helps you create methods for handling a hash value.
SYNOPSIS
use Class::MethodMaker
[ hash => [qw/ x /] ];
$instance->x; # empty
$instance->x(a => 1, b => 2, c => 3);
$instance->x_count == 3; # true
$instance->x = (b => 5, d => 8); # Note this *replaces* the hash,
# not adds to it
$instance->x_index(b) == 5; # true
$instance->x_exists(c); # false
$instance->x_exists(d); # true
Creates methods to handle hash values in an object. For a component named x, by default creates methods x, x_reset, x_clear, x_isset, x_count, x_index, x_keys, x_values, x_each, x_exists, x_delete, x_set, x_get.
<<lessSYNOPSIS
use Class::MethodMaker
[ hash => [qw/ x /] ];
$instance->x; # empty
$instance->x(a => 1, b => 2, c => 3);
$instance->x_count == 3; # true
$instance->x = (b => 5, d => 8); # Note this *replaces* the hash,
# not adds to it
$instance->x_index(b) == 5; # true
$instance->x_exists(c); # false
$instance->x_exists(d); # true
Creates methods to handle hash values in an object. For a component named x, by default creates methods x, x_reset, x_clear, x_isset, x_count, x_index, x_keys, x_values, x_each, x_exists, x_delete, x_set, x_get.
Download (0.087MB)
Added: 2007-07-05 License: Perl Artistic License Price:
841 downloads
PHP HTML Graph Class 1.0
PHP HTML Graph Class is a class for drawing vertical bar graphs using only HTML and CSS. more>>
PHP HTML Graph Class is a class for drawing vertical bar graphs using only HTML and CSS. Simple and grouped bars can be created. You can change everything regarding the looks as the output is template-driven.
On the fly, you can change the size of graph, the color of all or individual bars, add labels, a title, and footnotes, or customize the CSS style of all elements. The width and height of bars can be specified in pixels or percentages. The code is heavily documented.
Enhancements:
- In some PHP versions, there were some issues regarding passing variables by reference.
- The class would produce no output (nor errors) in PHP versions lower than 5 due to the different implementations of PHPs get_class() function in these versions.
<<lessOn the fly, you can change the size of graph, the color of all or individual bars, add labels, a title, and footnotes, or customize the CSS style of all elements. The width and height of bars can be specified in pixels or percentages. The code is heavily documented.
Enhancements:
- In some PHP versions, there were some issues regarding passing variables by reference.
- The class would produce no output (nor errors) in PHP versions lower than 5 due to the different implementations of PHPs get_class() function in these versions.
Download (MB)
Added: 2006-11-14 License: Free for non-commercial use Price:
1077 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above gym class heroes search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed