Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: work around for static vars and singleton constructors not inheriting properly?

by thcsoft (Monk)
on May 27, 2005 at 01:29 UTC ( #460921=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: work around for static vars and singleton constructors not inheriting properly?
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://460921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-09-21 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls