Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Just another Perl shrine
 
PerlMonks  

Capturing output of linklint on Win32

by zod (Scribe)
on Feb 10, 2009 at 01:28 UTC ( #742631=perlquestion: print w/ replies, xml ) Need Help??
zod has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I'm running linklint from a perl program on Win XP and I want to capture its output in a variable like so:

my $result = `perl D:\\Perl\\bin\\linklint-2.3.5 http://www.perlmonks. +org `; print "result: $result\n";
That doesn't work. $result is always empty despite the fact that the call to linklint works and displays output to the screen.

This does work:

my $test = `perl -v `; print "this is test: $test\n";
$test contains the output of `perl -v`, so I assumed it would work the same way with linklint.

I also tried this:

my @result = (); open (TEST, "perl D:\\Perl\\bin\\linklint-2.3.5 http://www.perlmonks.o +rg |"); while (<TEST>){ push(@result, $_); } close TEST; print "This is result: @result\n";
That didn't work either with linklint (but it does work with perl -v).

So, it *appears* that this is something related to linklint, but I'm not sure what that is.

Any ideas?

Thanks

Comment on Capturing output of linklint on Win32
Select or Download Code
Re: Capturing output of linklint on Win32
by toolic (Chancellor) on Feb 10, 2009 at 01:44 UTC
    Is the linklint output going to STDERR instead of STDOUT? Did you try to capture both?
    my $result = `perl D:\\Perl\\bin\\linklint-2.3.5 http://www.perlmonks. +org 2>&1`;

    See also `STRING`

      That fixed it. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://742631]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-04-19 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls