Skip Menu |

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

Report information
The Basics
Id: 68388
Status: rejected
Priority: 0/
Queue: Win32-IPC

People
Owner: Nobody in particular
Requestors: msl2005a [...] btinternet.com
Cc:
AdminCc:

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



Subject: prbolme with process.pm and changenotify.pm
Date: Mon, 23 May 2011 08:57:15 +0100
To: <durist [...] frii.com>, <bug-Win32-IPC [...] rt.cpan.org>
From: "MSL" <msl2005a [...] btinternet.com>
I think that there is some incompatibility between Process.pm and ChangeNotify.pm. My Perl code seems to work without any problem. However, it would be good to know if there are any potential issues because of it. The test Perl is below. use strict "vars"; use Win32; use Win32::ChangeNotify; use Win32::Process; with this code above I get C:>bug.pl Constant subroutine main::INFINITE redefined at C:/perl5/lib/Exporter.pm line 64. at C:\Radan\configuration_data\dat\cust\hm_app\MSLRadview\bug.pl line 4 Prototype mismatch: sub main::INFINITE () vs none at C:/perl5/lib/Exporter.pm line 64. at C:\Radan\configuration_data\dat\cust\hm_app\MSLRadview\bug.pl line 4 When I put ChangeNotify after Process - i.e. use strict "vars"; use Win32; use Win32::Process; use Win32::ChangeNotify; I get C:\>bug.pz Prototype mismatch: sub main::INFINITE: none vs () at C:/perl5/lib/Exporter.pm line 64. at C:\bug.pz line 5 Best regards Henry Merryweather
Subject: problem with process.pm and changenotify.pm
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.
Subject: RE: [rt.cpan.org #68388] problem with process.pm and changenotify.pm
Date: Mon, 23 May 2011 09:17:09 +0100
To: <bug-Win32-IPC [...] rt.cpan.org>
From: "MSL" <msl2005a [...] btinternet.com>
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 Show quoted text
-----Original Message----- From: Christopher J. Madsen via RT [mailto:bug-Win32-IPC@rt.cpan.org] Sent: 23 May 2011 09:10 To: msl2005a@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.
Subject: problem with process.pm and changenotify.pm
Then tell it you need FILE_NOTIFY_CHANGE_SIZE: use Win32::ChangeNotify qw(FILE_NOTIFY_CHANGE_SIZE); Please read http://perldoc.perl.org/functions/use.html
Subject: RE: [rt.cpan.org #68388] problem with process.pm and changenotify.pm
Date: Mon, 23 May 2011 09:32:31 +0100
To: <bug-Win32-IPC [...] rt.cpan.org>
From: "MSL" <msl2005a [...] btinternet.com>
Many thanks, Best regards Henry Merryweather Show quoted text
-----Original Message----- From: Christopher J. Madsen via RT [mailto:bug-Win32-IPC@rt.cpan.org] Sent: 23 May 2011 09:22 To: msl2005a@btinternet.com Subject: [rt.cpan.org #68388] problem with process.pm and changenotify.pm <URL: https://rt.cpan.org/Ticket/Display.html?id=68388 > Then tell it you need FILE_NOTIFY_CHANGE_SIZE: use Win32::ChangeNotify qw(FILE_NOTIFY_CHANGE_SIZE); Please read http://perldoc.perl.org/functions/use.html