ViceRaid has asked for the wisdom of the Perl Monks concerning the following question:
Good afternoon
I'm writing a test script that tests whether another perl script compiles correctly. If I was on the command line, I'd use perl -c foo.pl. Normally, if I was within a perl script, I'd either slurp the file into a string and eval it, or try eval { require 'foo.pl' } and check $@ for compilation errors
However, in this case, at the end of foo.pl, it enters a long-running loop with while (<>) (it's a Squid redirector script). This means that my test script hangs forever. How can I break out of this loop, and test whether it looked ok?
Thanks
ViceRaid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Emulating -c within perl
by hardburn (Abbot) on Sep 12, 2003 at 15:06 UTC | |
by liz (Monsignor) on Sep 12, 2003 at 15:16 UTC | |
by ViceRaid (Chaplain) on Sep 12, 2003 at 15:24 UTC |