Page 1 of 1

running perl script

Posted: Thu Nov 16, 2000 5:57 pm
by Eric
Hi,
I was wondering if anyone can help me out. I wrote a perl script which I can run through text pad just fine, except I want to have the output replace the contents of the file I am working on and be able to undo it if I wish. I don't know if there is a way to do this, but if anyone could help it would be much appreciated. Right now the results go to the results window, but I want them to go to the file window without the message on the bottom saying that it has run successfully.
thanks
eric

RE: running perl script

Posted: Fri Nov 17, 2000 4:34 am
by Andreas
Hello Eric,

in your tool settings, give the -i parameter followed by the extension to use for the temporary file:

perl -i.tmp c:\perl\MyPerlScript.pl $FILE

in your perl script, read from stdin and write to stdout:

while(<>) #read from stdin
{
#substitute or whatever you want to do with the line
print; #write to stdout
}

The -i switch tells perl to use the same file for input and output. This is done by creating a temporary file with the same name as the original file but the extension you provide.

HTH
Andreas

RE: running perl script

Posted: Wed Mar 20, 2002 9:32 pm
by Fabien
Hi
I'm trying to run perl scripts in textpad, and i created a tool/command for this, but i get the following errer:
'perl' is not recognized as an internal or external command,
operable program or batch file.

Tool completed with exit code 1

How should i configure textpad to run and view the result of the script, in the command result window ?

Thanks a lot
Fabien