On Friday, July 19, 2002, at 05:09 , Peter Scott wrote: [..] >> hence why the 'OO' style is so popular with the >> >> my $thing = FOO::BAR->new(@arglist); >> >> my $this = $thing->get_this($with_that); >> >> and the only 'exported' "method" is the 'new'... > > Please don't confuse people.
not my intention, and thank you for noting that I was stepping on top of myself. > The 'new' class method there is not exported; 'exported' means "put in > the caller's namespace," usually by the Exporter. [..] The basic evolution that I have observed, both in my own growth in this area, and how many go wandering is to establish that some collection of functions sub foo_do { my ($foo1, $foo2....) = @_; .... } sub bar_do { my ($bar1, $var2....) = @_; .... } become useful across several scripts - and the leap is to push them into a simple perl library and simply require "coolLib.pl"; .... my $answer = foo_do(@args); { I even opted at one point to NOT try to figure out how to 'export' variables that I wanted to have cached in a 'library' and simply nested them in a function - so that I could do my %those_things = get_those_Things(); so as not to worry about exporting into the caller's space... or obliging them to use the %FOO::BAR::those_things types of constructs... at the time it 'looked cooler'.... } Then they figure out how Exporter works - and wind up in the issues about 'EXPORT_TAG' - when they find that they have several functions that inter-relate in a :foo group and some in the :bar group and sometimes they need all of them.... So I had that 'konk on the head' about 'utility classes' - which are all methods, and no internal data structure, that would avoid the problem of which functions need to be 'grouped' together - and expressly exported into the caller's code so that they could run use FOO::BAR qw/:page/; ... my $answer = dtk_get_page($url); which they could have also found at use FOO::BAR ; ... my $answer = FOO::BAR::dtk_get_page($url); or just as 'easily' with say use FOO::BAR ; ... my $foo = FOO::BAR->new; my $answer = $foo->dtk_get_page($url); and it is this latter approach, which seems to be the easier to develop at the 'module' end of the play, than the levels of complexity that go into the name space management issues of either old style perl libraries or the 'export function names' approaches... so it was that 'konk on the head' that game out as a question - without first field testing the language about the 'konk on the head'... The other misapplication of language is my use of 'OO' style, since this approach of a 'simple utility class' of all methods does not go anywhere near the whole suite of issues about class inheritence, implementation of this utility class in sub_classes, etc, etc, etc.... ciao drieux --- it is one thing to read the answer in a book that says 'doing foo is easier and simpler' it is another thing to have the understanding arrive in one's head and explode into knowledge -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]