Tamas Dober <[EMAIL PROTECTED]> wrote: > Hello, > > I'm a beginner, please forgive me b/c of the simple questions. > > I'd like to test that that a batch file (starting a Java app) gives me the > expected output or not.
I really like IPC::Run, but it is a bit of a heavy package to make users install just for your test cases. If your module is already using it for something else, go for it! Otherwise i'd suggest just opening a pipe if you don't need bidirectional communication; open(my $fh, '-|', "@ls"); my $out = join('', <$fh>); ... Cheers, Tyler > use warnings; > use IPC::Run 'run'; > my $out; > my @ls = ( '\/perl\/Feb\/packager\/bin\/package.bat' ) ; > run [EMAIL PROTECTED], \undef, \$out or die "bat returned $?" ; > like($out, qr/Usage/, 'Usage message' ); > is( $out =~ /config/, 'this is like that'); > > -- > > The outcome: > > C:\perl\Feb\packager\bin>prove -v Run2.t > Run2....1..2 > > Usage: > -config [Configuration XML URL] > -request [Request XML URL] > --help > > not ok 1 - Usage message > # Failed test 'Usage message' > # in Run2.t at line 8. > # ' > # > # > # ' > # doesn't match '(?-xism:Usage)' > > not ok 2 > # Failed test in Run2.t at line 9. > # got: '' > # expected: 'this is like that' > # Looks like you failed 2 tests of 2. > > > It seems I couldn't redirect the output. > Maybe IPC::Run is not a good choice? > If I try it under LINUX (using package.sh instead of package.bat) I'm having > the same issue. > > Could you please help me what direction I should go, what module should I use? > > Thank you > > Tamas > > > > --------------------------------- > Yahoo! Mail - Helps protect you from nasty viruses.