Thanks Jonathan,
Test::Script would have filled the bill nicely if it
didn't have so many dependencies. I have aborted
installations for having than many!
So I ended up with the following, which works fine in my
test program:
my $build = Module::Build->current();
my $tail = $build->is_unixish() ? ' 2>&1' : '';
my $result = `$^X -c script/killerApp$tail`;
chomp $result;
ok (!($? >> 8), $result);
-----------------
Now, a new question for you or any of the other experts out there:
Q: How can a test program tell if it's running in verbose mode?
I can't make $build->args yield anything useful. The Module::Build
API page has a cryptic reference to a get/set accessor verbose()
near the end, but I can't get that to do anything either.
Thanks to all,
cmac
On Feb 16, 2010, at 6:51 PM, Jonathan Yu wrote:
So I would like to add some tests to one of my test files,
involving something like `perl -c scripts/my_script`, and
fail if there's an error.
There is a module for this - Test::Script - which can be integrated
into your test suite.
My question is: where under M::B can I get the path to the
perl under which Build.PL was run? I could not find this in
the various documentation pages.
Usually the information is output via CPAN Smokers along with test
output. I think $^X is what you want. I print it (along with $] which
is the version number) as diagnostic in my test output, for smokers
that might not include that information.