Mon Sep 14 05:36:01 2009: Request 49619 was acted upon.
Transaction: Correspondence added by DJIBEL
       Queue: Win32-Process
     Subject: Bareword "NORMAL_PRIORITY_CLASS" not allowed while "strict subs"
   Broken in: 0.14
    Severity: (no value)
       Owner: Nobody
  Requestors: dji...@cpan.org
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49619 >


Le Sam. Sep. 12 17:16:47 2009, dbec...@roadrunner.com a écrit :
> 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();


It is a good idea. I will use this method.

    require Win32::Process;
    import Win32::Process qw(NORMAL_PRIORITY_CLASS);
    my $flags = NORMAL_PRIORITY_CLASS();
    
    # Create and execute a process to start
    my $ProcessObj;

    Win32::Process::Create( $ProcessObj, $executable, $argument, 0,
$flags, '.' )
      or die Win32::FormatMessage( Win32::GetLastError() );

Thank you. 

Reply via email to