in reply to Autocreating Classes
If you need to generate these classes dynamically at runtime, then you could use the technique Joost suggested. However, if you have a fixed set of classes which you know at compile time, and are basically just looking to save your wrists from having to type things over and over, then you could use Module::Compile::TT to just expand the code you need at module load time (actually pre compile-time phase).
There is always more than one way to do it ;)package A; # ... code here use tt ( subclasses => [ map { 'B' . $_ } 1 .. 100 ] ); [% FOREACH subclass IN subclasses %] package [% subclass %]; our @ISA = qw(A); [% END %] no tt;
-stvn
|
---|
In Section
Seekers of Perl Wisdom