Checking for perl [message #52915] |
Wed, 07 March 2007 03:52 |
Ben Panter
Messages: 102 Registered: July 2003
|
Senior Member |
|
|
Hi Folks,
I've got a little routine that takes a postscript file and, using
perl, changes the title from 'Graphics produced by IDL' to something
more meaningful. I find this makes it much easier to tell what a
minimised window is, and helps identify the filename in a gv window when
I want to email a result.
My code runs on linux with spawn quite happily, but I'd really like
to also have it run in windows. On my xp laptop this is fine - I have
perl set up, and it's happy to be spawned. The problem comes, of course,
when I give the code to someone else. I'd like to be able to safely
check whether perl is installed, and if not return a *device
independent* warning that the action wasn't possible - without crashing
the code.... any ideas?
Other options I'm yet to explore would be using IDL itself to do the
replacement...
Cheers!
Ben
The perl command I use goes along the lines of:
command="perl -e 's/%%Title: Graphics produced by IDL/%%Title:
"+new_title+"/' -p " + filename + " > bp_pstitle.temp"
command2="rm "+filename
command3="mv bp_pstitle.temp " + filename
spawn, command
spawn, command2
spawn, command3
--
Ben Panter, Edinburgh, UK.
Email false, http://www.benpanter.co.uk
or you could try ben at ^^^^^^^^^^^^^^^
|
|
|