Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Abbreviated output when attempting to do whois via script

by jerrygarciuh (Curate)
on Aug 01, 2004 at 15:50 UTC ( #379091=perlquestion: print w/replies, xml ) Need Help??

jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

I am attempting to track the redemption period status of a client's domain via a script. Initially I used Net::Whois but it produced a "No Match" response (due to the redemption period status at InterNIC I believe).

Because I know running a whois from the commandline is producing the output I want I changed to simply capturing the output via backticks

my $output = `whois`;.

This produces the following:

[Querying] [Redirected to] [Querying] []

My question is why the output is abbreviated when I know the commandline output holds what I need. I thought I was capturing all of the command output with the back ticks.

Any advice greatly appreciated.


"The man who grasps principles can successfully select his own methods.
The man who tries methods, ignoring principles, is sure to have trouble.
~ Ralph Waldo Emerson

Replies are listed 'Best First'.
Re: Abbreviated output when attempting to do whois via script
by PodMaster (Abbot) on Aug 01, 2004 at 16:07 UTC
    Ask your whois program (works for me).
    $ perl -le'print `whois`' NOTICE: Access to .ORG WHOIS information is provided to assist persons + in determining the contents of a domain name registration record in the P +IR registry database. The data in this record is provided by Public Inter +est Regist ry for informational purposes only, and PIR does not guarantee its accuracy. This service is intended only for query-based access. You +agree that you will use this data only for lawful purposes and that, under n +o circumstances will you use this data to: (a) allow, enable, or otherwi +se support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other + than the data recipient's own existing customers; or (b) enable high volume +, automated, electronic processes that send queries or data to the syste +ms of Registry Operator or any ICANN-Accredited Registrar, except as reasona +bly necessary to register domain names or modify existing registrations. +All rights reserved. PIR reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy. Domain ID:D2013834-LROR Domain Name:PERLMONKS.ORG Created On:21-Sep-1998 04:00:00 UTC Last Updated On:05-Apr-2004 05:18:56 UTC Expiration Date:20-Sep-2005 04:00:00 UTC Sponsoring Registrar:R11-LROR Status:CLIENT TRANSFER PROHIBITED Status:CLIENT UPDATE PROHIBITED Registrant ID:tuCZytFOzdNJ8Qli Registrant Name:Allison Randal Registrant Organization:The Perl Foundation Registrant Street1:2861 Barclay Way Registrant City:Ann Arbor Registrant State/Province:MI Registrant Postal Code:48105 Registrant Country:US Registrant Phone:+1.4124887936 Registrant Admin ID:tuTeuejWDPUhKCeC Admin Name:Ask Bjoern Hansen Admin Organization:The Perl Foundation Admin Street1:PO Box 18111 Admin City:Beverly Hills Admin State/Province:CA Admin Postal Code:90209 Admin Country:US Admin Phone:+1.4124887936 Admin Tech ID:tuyX7wRHQsn13sNK Tech Name:Ask Bjoern Hansen Tech Organization:Develooper LLC Tech Street1:PO Box 18111 Tech City:Beverly Hills Tech State/Province:CA Tech Postal Code:90209 Tech Country:US Tech Phone:+1.4137232698 Tech FAX:+1.4132540312 Tech Name Server:NS2.DEVELOOPER.COM Name Server:NS1.US.BITNAMES.COM Name Server:NS2.US.BITNAMES.COM Name Server:NS1.EU.BITNAMES.COM

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Thanks for the reply podmaster,

      So now I am baffled. This does indeed work:

      perl -le'print `whois`'

      So what am I doing wrong here? Why does this get only the abbreviated output?

      #!/usr/local/bin/perl -w use strict; use CGI::Carp qw/fatalsToBrowser /; use CGI qw/:standard/; use CGI::Pretty qw/ :html3 /; my $dom = ""; my $q = CGI->new(); print $q->header,start_html, '<pre>'; print my $output = `whois $dom` . '</pre>';

      BTW when I use this code to lookup a domain which is NOT in the redemption period, I have just found that it works fine.

      Any thoughts?

      "The man who grasps principles can successfully select his own methods.
      The man who tries methods, ignoring principles, is sure to have trouble.
      ~ Ralph Waldo Emerson
        Perhaps your shell environment has a different PATH or an alias that adds other command-line options, which your CGI script lacks because it's running in the web server's environment. Try doing "which whois" in the shell and then use the full path in the CGI script.
Re: Abbreviated output when attempting to do whois via script
by Thelonius (Priest) on Aug 02, 2004 at 01:37 UTC
    Some versions of whois (e.g. that on Debian Linux) are influenced by environment variables such as WHOIS_SERVER. It is possible that a difference of environment variables is causing different results.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://379091]
Approved by ysth
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-10-06 23:43 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (29 votes). Check out past polls.