5 Dec 03:18
two alternate approaches to mixin functionality
Terrence Brannon <bauhaus <at> metaperl.com>
2004-12-05 02:18:13 GMT
2004-12-05 02:18:13 GMT
NAME
Class::MixinFactory::alternatives - approaches to the same functionality
DESCRIPTION
A recent contribution to CPAN is Class::MixinFactory by Simon Cavaletto.
Here we show two more ways to do the same thing in addition to the ones
that Simon lists in the SEE ALSO section.
One method relies on Leon Brocard's Language::Functional. The other
relies on Toby Ovod-Everett's Class::Prototyped.
ALTERNATIVE IMPLMENTATIONS
I include here a file, which when run, produces output similar to the
output from factory_class.t in the Class::MixinFactory distribution.
It shows two new ways of doing this, the Language::Functional approach
and the Class::Prototyped approach.
#
# lf.pl
#
use strict;
use Language::Functional ':all';
sub _uc { uc shift } ;
sub bold { sprintf "<b>%s</b>", shift } ;
sub italics { sprintf "<i>%s</i>", shift } ;
(Continue reading)
RSS Feed