in reply to work around for static vars and singleton constructors not inheriting properly?

to me Class::MethodMaker looks like an overhead. the really easiest and most efficient way to create a class and instantiate it is by using and inheriting from Exporter;
package MyClass; use strict; use vars qw/@ISA/; use Exporter; @ISA = qw/Exporter/; sub new { my $class = shift; my $self = {}; bless $self, $class; }
and later, in a script:
#!/usr/bin/perl -w use strict; use MyClass; my ($d1, $d2) = (MyClass->new, MyClass->new); ...
for more information take a look at
perldoc perlbot perldoc perltoot perldoc -f bless


language is a virus from outer space.

Replies are listed 'Best First'.
Re^2: work around for static vars and singleton constructors not inheriting properly?
by simonm (Vicar) on Jul 18, 2005 at 16:00 UTC
    This is misleading; Exporter is not being used here and can be omitted entirely.