Skip Menu |

This queue is for tickets about the Win32-API CPAN distribution.

Report information
The Basics
Id: 11715
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Win32-API

People
Owner: cosimo [...] cpan.org
Requestors: aa29 [...] mail.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: INIT block in Win32::API::Type seems not to be invoked on nested 'use'
Tested on Perl 5.6.1 / 5.8.5 / 5.8.6 with the same result. bar.pm: ======= use Win32::API; Win32::API->Import("kernel32", "int GetCurrentProcessId()"); 1; ======= C:\>perl -e "use bar" Win32::API::parse_prototype: WARNING unknown output parameter type 'int' at C:/Perl/site/lib/Win32/API .pm line 273. But perl -e "do bar.pm" runs ok. Further investigation shows that INIT block in Win32::API::Type (where 'parameter types' are defined) is NOT executed if Win32::API is used in a module which is in turn used in another module (sorry for a long statement). Possible workaround is to remove 'INIT' label in Win32::API::Type and make this block just a bare block.
From: aa29 [...] mail.ru
[guest - Wed Mar 2 09:29:48 2005]: This issue is not a bug, but it needs a clue in a doc. INIT block in Win32::API::Type is invoked but after all BEGIN blocks. That means that bar.pm should be: use Win32::API; INIT {Win32::API->Import("kernel32", "int GetCurrentProcessId()")}; 1; or use Win32::API; sub tralala {Win32::API->Import("kernel32", "int GetCurrentProcessId ()")}; 1; to work correctly (because "use bar" = BEGIN { require bar... } ).
INIT block has been removed from v0.43. Current release is now v0.45.