On Wednesday, June 26, 2002, at 07:38 , Kipp, James wrote:
> so which is better? to make a lib file with functions or a modular/OOP pm
> file ?
technically this is a false dichotomy. you can not tell
if the file BAR.pm is an OO style Perl Module, or merely
a Functional/Proceduralist style Perl Module.
But skipping over that detail - the correct and only answer is:
Which is easier for you to maintain and Manage?
If you are planning to use 'sub_classes' of a base class - then
clearly the OO Approach Rocks.
> so far all my libs (well there ain't much ) are all OO pm files.
There is what I would call the 'dataLess' OO solution,
what is known as a 'utility class' - where one has only
a stack of methods that one wishes to have in a 'nameSpaceSafe'
environment - so that you know that
my $dataLessObjectInstance = FOO::BAR->new();
$dataLessObjectInstance->print("die KMT Puppet");
now you know that the 'print' function you have in
that FOO::BAR will not compete with the 'print' function
that comes with perl.... nor do you have to worry about
the problems of 'overloading' the 'print()' method that
was the standard....
I think the easiest path most folks take is:
a) I wrote a script
b) I learned how to put functions in it
c) I started cutting and pasting the same functions around
d) I built a perl library of them
e) I built a perl module of them so I could use the
autoloader solution and the %EXPORT_TAGS reference
so as to load only those that I wanted...
.....
My still underFinished discussion is at:
http://www.wetware.com/drieux/CS/lang/Perl/PM/OO_v_Procedural.html
and it will show you an OO implementation and a Functional Implementation
that DO the exact same thing.
{ for the WHINERS - YES - that IS an Old Style 'SWITCH:' statement
in it - right fresh out of the book... and Yeah - when I have the
time I'll Like SO worry about fixing that... }
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]