You are correct that in this instance I have spent more time here trying to find if there is a preferred way to do what I want to do. However, this is something I will be and have been doing on a semi-regular basis.
It is a maintenance issue as well. Everytime you add a function, you must add it to the export line. I don't want to do that but if there is no other preferred means of using functions from another file, then I will.
Besides, can you really blame me for asking if there is a quicker/easier way? Aren't we all looking to make our programming lives a bit easier?
| [reply] |
Aren't we all looking to make our programming lives a bit easier?
In my experience, it is easier in the long run not to export everything into main::. Objects aren't perfect, but they tend to organize things.
For small programs, it likely doesn't matter. Once I get over twenty or thirty functions, though, it really starts to matter very quickly.
| [reply] [d/l] |
No, I don't blame you for asking. And yes, we're all looking for a quicker, easier way to do things. But I think the one thing you're missing here is that Perl and the use of modules, by design, does not export functions and variables. You say this is a maintenance issue. Having all those functions in main:: is also a maintenance issue.
You mention that you work with C# and .NET. The recomendation there is to also use full namespaces when refrencing properties, methods and objects. As you'll notice, Visual Studio .NET generates full namespace paths. The difference is that .NET makes it easier to not do so.
| [reply] |