Some of you may remember hearing about the logfile pruning/archiving tool I
was working on (with the date parsing from the record and second
calculations etc).
I am wondering about the 'perl way' or using variables. I have created a
class for a generic 'logfile'. I then have a series of instance variables
such as the name of the logfile, the record seperator regular expression, a
series of date formatting values, etc.
Now I have methods that I am calling such as:
$self->read_log();
I do this to access the instance variables. I don't mind this it keeps it
nice and clean. However I start to get into cases like:
$self->prune_log( $num_of_records );
I may decide later on to put all the log manipulators in a seperate
package, for re-usability in other programs. In that case I would have to
change all the log manipulators to accepts parameters for each instance
variable that is now used.
So I guess all this boils down to is the following question:
Is it acceptable practice to use instance methods that access instance
variables (essentially global variables from a pure look of the code) or is
it better to pass in a slew of variables to a function for
ease-of-reusability later on, which in turn makes the code a little uglier
(in my opinion).
thanks one and all
-----------------------------------------
Craig Moynes
[EMAIL PROTECTED]