in reply to Strange warning when USEing Win32::GUI module with warnings / diagnostics
This is a warning of the module itself about a deprecated feature, i.e. it isn't a warning coming from perl. In the source code you can read this comment:
# use Win32::GUI; currently exports a load of constants for # backwards compatibility with earlier Win32::GUI versions. # This is deprecated, and in the future # use Win32::GUI; and # use Win32::GUI(); will have the same behaviour.
So the answers to your questions are (as far as I can answer them)
1) The problem with these constants probably is that modules should not export lots of names because they might clash with variable names in the main script (i.e. the script you are writing). Probably there is already a different mechanism in place to get at these constants easily, a hash maybe?
2) You can list exports simply by adding them to the parens, i.e. "use Win32::GUI('function1','function2');". The reason is that in that case you know exactly which names are reserved, other names are free to use
2.1) both vars and subs
2.2) If you use the empty parens, no name exporting takes place at all and you have to call any function1() in Win32::GUI as Win32::GUI::function1(). If you don't use parens, you get the warning and many functions and constants are included in your namespace
|
|---|