Mon May 23 04:16:56 2011: Request 68388 was acted upon.
Transaction: Correspondence added by msl20...@btinternet.com
       Queue: Win32-IPC
     Subject: RE: [rt.cpan.org #68388] problem with process.pm and 
changenotify.pm 
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: msl20...@btinternet.com
      Status: rejected
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=68388 >


Many thanks for your quick reply.

My use of ChangeNotify is
        $notify = Win32::ChangeNotify->new($watched_dir, 0, 
FILE_NOTIFY_CHANGE_SIZE);

Just this mean that if I added () (to give  use Win32::ChangeNotify ();) I 
would not get the FILE_NOTIFY_CHANGE_SIZE variable.
If so what is the cure?

Best regards

Henry Merryweather

-----Original Message-----
From: Christopher J. Madsen via RT [mailto:bug-win32-...@rt.cpan.org] 
Sent: 23 May 2011 09:10
To: msl20...@btinternet.com
Subject: [rt.cpan.org #68388] problem with process.pm and changenotify.pm 

<URL: https://rt.cpan.org/Ticket/Display.html?id=68388 >

Both Win32::ChangeNotify and Win32::Process export the constant INFINITE
by default.  Constants in Perl are implemented as subroutines that
return a constant value, which is why you get a warning about
"subroutine main::INFINITE redefined".  The prototype warning arises
because Win32::ChangeNotify creates constants with an empty prototype,
and Win32::Process creates constants with no prototype.

Since both modules get the value of INFINITE from the Windows headers,
it doesn't really matter which one you use.  You just have to pick one.

To avoid the warnings, use an import list with at least one of the
modules to import only the subroutines you need.  Without seeing your
code, I can't tell what subs you're using, but many programs using
Win32::ChangeNotify don't actually use any of the constants it exports.
 So it might look like this:

  use Win32::Process;
  use Win32::ChangeNotify ();

The empty parens after Win32::ChangeNotify tell it not to export anything.


Reply via email to