Oops, sorry, Ubuntu server 10.04 64bit.
I have no idea how to do it and can't find any info anywhere so I thought it probably wasn't a realistic option.
The best I can think of is to use a ram disk and then wipe it.
Re^2: Spawning processes from scalars
Replies are listed 'Best First'.
There only is the hard way of copying your process (via fork), patching up your scalar like your OS would, and then jumping (via XS or assembly code) to the start of the process.
On Solaris, the /tmp "directory" resides in RAM and is not flushed to disk - if it really is a pressing matter of performance, you could mount /tmp as a ramdisk on your system as well. Note that for security reasons, programs in /tmp often are not allowed to execute, because malicious code uses this directory as a vector to drop files. So you might want to set up a directory similar but different from /tmp.
The mount point for the tmpfs partition must be created as a directory first. It need not be in the root of your file-system.
You can be quite generous with the size of the tmpfs volume, as it is only the upper limit for the file-system, so you won't consume 2G of RAM just by creating the file-system, only the total size of the files you write there, and in any case file data in tmpfs will get swapped out if the fs is large enough to cause memory pressure.
Once you have created the temporary partition, you can write your executable binary there from your perl scalar in the normal way. It should be very quick as you are just copying bytes from one part of ram to another. From there it is trivial to run the executable. You can also delete files just as quickly.