in reply to Re: How not to use "our"?
in thread How not to use "our"?

Thanks, kcott!

Wished I had read it in greater detail each time I went to that page, because I missed out that part entirely.

But I'm a little puzzled.

Under "Selecting What To Export", the first rule is "Do not export method names!" Why is that so? I thought one of the niceties about modules is that you can put functions in them so that they (the functions) can be reused? And how does one reuse the functions if they aren't exported. Hm...scratches head.

Thanks to all who have commented, particularly wazoox with the working code!

Replies are listed 'Best First'.
Re^3: How not to use "our"?
by kcott (Archbishop) on Nov 29, 2010 at 17:18 UTC

    Very briefly, methods are functions used in object oriented code (there's OO tutorials in perldoc is you're not familiar with this). Access to methods should be through inheritance - exporting method names will likely break inheritance.

    If you read a bit further down that section you'll see it makes a distinction between modules that are object oriented and those that are just a collection of functions. As an example of the latter type, Scalar::Util is a collection of functions which you can selectively choose to export.

    -- Ken