Re: [rt.cpan.org #49619] Bareword "NORMAL_PRIORITY_CLASS" not allowed while "strict subs"

[email protected] ("Bill Luebkert via RT")
Newsgroups perl.libwin32
Message-ID <[email protected]>
Sat Sep 12 17:16:47 2009: Request 49619 was acted upon.
Transaction: Correspondence added by [email protected]
       Queue: Win32-Process
     Subject: Re: [rt.cpan.org #49619] Bareword "NORMAL_PRIORITY_CLASS" not allowed while "strict subs"
   Broken in: 0.14
    Severity: (no value)
       Owner: Nobody
  Requestors: [email protected]
      Status: rejected
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49619 >


Jan Dubois via RT wrote:
> 
> This has nothing to do with "strict subs".  When you "use
> Win32::Process" then you are importing several symbols at compile time
> into your own namespace.  If you simply "require Win32::Process" at
> runtime, then those symbols have not been imported and must be used
> fully qualified:
> 
>     Win32::Process::NORMAL_PRIORITY_CLASS()
> 
> instead of
> 
>     NORMAL_PRIORITY_CLASS
> 
> This is not a bug in the module; this is just how Perl works.

Actually the trick is the () on the end.  I kept trying to do:

	require Win32::Process;
	import Win32::Process qw(NORMAL_PRIORITY_CLASS);

	my $flags = NORMAL_PRIORITY_CLASS;

But all I needed to do was add the ():

	my $flags = NORMAL_PRIORITY_CLASS();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.