First, you probably want to add use warnings
after use strict
. This may or may not make some warnings pop out.
Next, if you look on the home page for Win32::API::Prototype, you'll see that all their examples of using ApiLink all have || die after them. This makes it so that the program will stop executing if it can't link the api call. It will also tell you what line it was on when it died. You can also add an informative message like "could not link WNetCloseEnum". Read all about it with perldoc -f die.