in reply to Exporting AUTOLOADed methods?

Ugh. That's a nasty solution. Frankly, I would recommend that you trust the engineers to be able to figure things out. If you have 300 variables, sooner or later there's a chance that one of the engineers is going to write their own get_foo method and overwrite your accessor, thus causing strange problems that are annoying to debug.

Further, the first time that AUTOLOAD is triggered, this implies that AUTOLOAD is going to be in your module's namespace. This means that they already know how to call functions and methods there. If you stick the AUTOLOAD in the namespace of the calling programs, you open up a an entirely different can of worms.

It seems to me that if you go down this treacherous road, you want to create an import method that simply adds generated subs to the calling namespace, but I still wouldn't do that. It's just too messy.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.