[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Forcing a Perl Script to Run on Every Build

Let's say you wrote a Perl script that is supposed to save files for your build. Unless the file is "touched" or altered every time you build, it may not run.

When you "touch" a file you are telling the IDE that the file's state has changed. If you modify the file, the IDE will also see that the file has changed. However, once you have the script perfected, it won't change again. So when you do a build, the Perl file is not executed.

To put the problem another way, when you initially run the IDE's Make command, the Perl script is touched. If you don't change the Perl script before you run the Make command again, the script won't execute!

To get around this issue, and make sure that the Perl script is executed every time a build is done, you might have the Perl script touch itself for every build using one of these example methods:


Touch on Last Line

The last line of your Perl script could be a system call that invokes this command:


touch thisfile.pl

This would make the Perl script named thisfile.pl touch itself so that the file looks changed.


Using utime()

This example uses the Perl utime() function to touch the script file. Include these lines in your script to force the file to be touched.


$now = time;
utime( $now, $now, "thisfile.pl" );


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 02, 2000