Subject: | Bareword "NORMAL_PRIORITY_CLASS" not allowed while "strict subs" |
Dear,
I have to call Win32::Process because my script have to work on Win32
and on Linux machine. Then, I tried to load the module using require but
I have some problems.
This code work well on Win32 machine
#!/usr/bin/perl
use warnings;
use strict;
use Carp;
use Win32::Process;
my $ProcessObj;
Win32::Process::Create( $ProcessObj,
'C:\Program Files\PSPad editor\PSPad.exe',
" test.txt",
0,
NORMAL_PRIORITY_CLASS,
".") or die Win32::FormatMessage(
Win32::GetLastError() );
But this crash
#!/usr/bin/perl
use warnings;
use strict;
use Carp;
require Win32::Process;
my $ProcessObj;
Win32::Process::Create( $ProcessObj,
'C:\Program Files\PSPad editor\PSPad.exe',
" test.txt",
0,
NORMAL_PRIORITY_CLASS,
".") or die Win32::FormatMessage(
Win32::GetLastError() );
Message : Bareword "NORMAL_PRIORITY_CLASS" not allowed while "strict subs"
If I use no strict 'subs';, the script work but I have a warning :
#!/usr/bin/perl
use warnings;
use strict;
use Carp;
no strict 'subs';
require Win32::Process;
my $ProcessObj;
Win32::Process::Create( $ProcessObj,
'C:\Program Files\PSPad editor\PSPad.exe',
" test.txt",
0,
NORMAL_PRIORITY_CLASS,
".") or die Win32::FormatMessage(
Win32::GetLastError() );
Warning: Argument "NORMAL_PRIORITY_CLASS" isn't numeric in subroutine
entry at ...
Do you have an idea ?
Thank you.
Best Regards,
Djibril