Andrew M Pastuszak wrote:

[edited]

> My script used to read as follows:
>
> use strict;
> use warnings;
> use Win32;
> use Win32::GUI;   <- line 12

> I get the following error:
>
> Subroutine main::MB_ICONEXCLAMATION redefined at
> C:/Perl/lib/Exporter.pm line 65. at I:\SiteBuild HTA
> files\SiteBuild HTA files\policymod2.pl line 12
[snip]

> I simply changed it to:
>
> use Win32::GUI;
> use strict;
> use warnings;
> use Win32;
>
> and my problem seems to have resolved itself.

I can duplicate the problem and the solution. I don't understand why the presented solution solves the problem.

Both Win32 and Win32::GUI export a set of constants by default (this, by the way, will change if a future Win32::GUI release), and some of the constants are the same. I would expect to get those warnings (and they are warnings, not errors) whichever way round you put the use statements.

A better way to fix the problem is to get the 2 modules to
only export the constants that you really want, by listing them in the use statement. For example, if you're not using any of the exported constants, turn them off:

  use strict;
  use warnings;
  use Win32();
  use Win32::GUI();

Regards,
Rob.

Reply via email to