Win32::Process->Create, can't get right syntax

S

Shea Martin

I have the following line in my code:

Win32::process->Create($proc, "C:\\WINDOWS\\system32\\notepad.exe",
'nodepad text.txt', 1, DETACHED_PROCESS, "." );

It keeps generating the following error:

Usage: Win32::process::Create(cP, appname, cmdline, inherit, flags, curdir)
at D
:\my\path\test.pm line 535.


Any ideas?

Thanks,

~S
 
P

Paul Lalli

Shea said:
I have the following line in my code:

Win32::process->Create($proc, "C:\\WINDOWS\\system32\\notepad.exe",
'nodepad text.txt', 1, DETACHED_PROCESS, "." );

It keeps generating the following error:

Usage: Win32::process::Create(cP, appname, cmdline, inherit, flags, curdir)
at D
:\my\path\test.pm line 535.

Using the arrow notation is not simple syntactic sugar for the ::
notation. Your call translates to:

Win32::process::Create('Win32::process', $proc,
"C:\\WINDOWS\\system32\\notepad.exe",
'nodepad text.txt', 1, DETACHED_PROCESS, "." );

The arrow notation should be used for methods only, not simple
subroutines.

Indeed, the perldoc for Win32::process has a synopsis using
Win32::process::Create(...), not Win32::process->Create(...)

Hope this helps,
Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top