in reply to Wget using backquotes

wget is one of those apps that dosn't play nice with backticks. It writes directly to the tty, and sends some messages to STDERR. You can try this with IPC::Open3, but you might need to use IO::Pty.
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; use IO::Select; my $pid = open3(0, \*READ,\*ERROR,"wget --spider -nv http://zentara.n +et"); my $sel = new IO::Select(); $sel->add(\*READ); $sel->add(\*ERROR); my($error,$answer)=('',''); foreach my $h ($sel->can_read) { my $buf = ''; if ($h eq \*ERROR) { sysread(ERROR,$buf,4096); if($buf){print "ERROR-> $buf\n"} } else { sysread(READ,$buf,4096); if($buf){print "response->$buf\n"} } } waitpid($pid, 1);
Output: ERROR-> 200 OK

I'm not really a human, but I play one on earth. Cogito ergo sum a bum