From: Robert M. <rob...@us...> - 2007-06-05 20:32:19
|
On 05/06/07, Brian Rowlands (Greymouth High School) <Row...@gr...> wrote: > I've written my first GUI using The GUI Loft and all works fine except I get > the following warnings: > > 'use Win32::GUI;' is currently exporting constants into the callers scope. > This functionality is deprecated. Use 'use Win32::GUI();' or list your > required exports explicitly instead. at > C:/Perl/site/lib/Win32/GUI/Loft/Design.pm line 31 > C:/Perl/site/lib/Win32/GUI/ToolbarWindow.pm line 23 > C:/Perl/site/lib/Win32/GUI/BorderlessWindow.pm line 24 > C:/Perl/site/lib/Win32/GUI/Loft/Cluster.pm line 21 > C:/Perl/site/lib/Win32/GUI/AdHoc.pm line 31 > C:/Perl/site/lib/Win32/GUI/Loft/Control/ListView.pm line 22 > C:/Perl/site/lib/Win32/GUI/Loft/Control/TabStrip.pm line 23 > C:/Perl/site/lib/Win32/GUI/TabStripGroup.pm line 25 > C:/Perl/site/lib/Win32/GUI/HyperLink.pm line 6 > > Q1: Can someone advise as to the best way to overcome this issue please or > must I just turn off warnings using: > no warnings 'deprecated'; That's the easiest way, but it only masks the problem. We're in a deprecation cycle, and in one of the next releases Win32::GUI will stop exporting the constants by default, and then if any of these modules rely on the constants being exported, they will fail. The best solution is to bug the module authors (and I'm the Win32::GUI::HyperLink author) to fix their modules; or better yet provide them with patches. > BTW, SourceForge say to either > A) use Win32::GUI(); when not using constants > B) explicitly name them if you are using constants > > Q2: Since constants are being used how do I tell what need to be named? If all the modules have use strict; near the start, then just change the use Win32::GUI; line to use Win32::GUI qw(); and re-run you script - it will fail to compile for each constant, and add it use Win32::GUI qw(YOUR_CONSTANT_HERE); If a module doesn't 'use strict' then it's harder, and you'll have to look through the code for the constants. An (easier) alternative is to change each use Win32::GUI; line into use Win32::GUI qw(:compatibility_win32_gui) which will cause Win32::GUI to keep exporting the 300+ constants into the caller's namespace without warning. But this doesn't really solve the problem either .... Regards, Rob. |