On Monday 01 Mar 2004 4:40 pm, James Edward Gray II wrote: [snip]
I'm not too found of mixing subroutines and methods, especially in the
same file. Why don't you turn them into class methods, instead. This
especially makes sense for things like debug(), which the other
classes
can then call with Trainset->debug().
Wouldn't that confuse things regarding the %_DEBUG? I don't see the problem with using subroutines within the class itself, although I could understand it if the subs were used outside the class it was in.
I doubt it, no. In fact, I suspect it would be an improvement. If you
have a:
my %_DEBUG; # lexical scoping makes this a class variable
in Trainset.pm that is setup will the needed information and provide a
class method interface to it, it's a 100% solution that needs now other
hashes or methods. That seems ideal to me.
I must be missing something here, cos I can't see how it'll work. If I create
Trainset/Utils.pm to hold the debug and validate routines, how can it access
%_DEBUG which is defined as a 'my' scoped hash in the Trainset package?
I was writing this before Trainset::Utils existed. Put it in there instead and provide the access routines there too.
How would it know to use the %_DEBUG from Trainset::Track when called from
there?
You call Trainset::Utils->set_debug() to change it and Trainset::Utils->debug() to use it.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>