Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

remove host command #4

jnorell opened this Issue Jan 20, 2014 · 1 comment


None yet
2 participants

jnorell commented Jan 20, 2014

Some systems don't have "host" and it's called "hostx" on others .. probably should just rewrite resolve() to use Net::DNS.


DmitryKoterov commented Jan 22, 2014

Net::DNS is a non-standard module:

# perl -e "use Net::DNS;"
Can't locate Net/DNS.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

So we cannot use it. Maybe add an "if" which checks whether host or hostx is available and use it? But before this check, get a configuration option like

RESOLVER_CMD = host %s
RESOLVER_CMD = super_duper_host_Z %s | grep "la-la" | sed -e s/foo/bar/ 

where %s is processed with the following function before:

sub escape_shell_arg {
    my ($arg) = @_;
    my $q = qq{\x27};
    my $qq = qq{\x22};
    return $arg if $arg !~ m/[\s$q$qq\\]/s && length($arg);
    # aaa'bbb  =>  'aaa'\'bbb'
    $arg =~ s/$q/$q\\$q$q/sg;
    return $q . $arg . $q;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment