[Rt-commit] [rtir] 01/01: Proof of concept for using Net::Whois::Raw for Whois lookups
Jim Brandt
jbrandt at bestpractical.com
Fri Jun 20 16:03:52 EDT 2014
This is an automated email from the git hooks/post-receive script.
jbrandt pushed a commit to branch 3.2/refactor-whois
in repository rtir.
commit f6b1ce9addb47ee38b6eec351386f440120c5552
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Jun 20 16:02:40 2014 -0400
Proof of concept for using Net::Whois::Raw for Whois lookups
---
html/RTIR/Tools/Elements/ToolFormWhois | 3 +--
html/RTIR/Tools/Elements/ToolResultsWhois | 38 ++++---------------------------
2 files changed, 6 insertions(+), 35 deletions(-)
diff --git a/html/RTIR/Tools/Elements/ToolFormWhois b/html/RTIR/Tools/Elements/ToolFormWhois
index c82adcd..5377df7 100644
--- a/html/RTIR/Tools/Elements/ToolFormWhois
+++ b/html/RTIR/Tools/Elements/ToolFormWhois
@@ -51,8 +51,7 @@
% }
<span class="label">WHOIS:</span>
<span class="input">
- <input type="text" size="30" name="q" value="<% $q %>" /> at
- <& SelectWhoisServer, Name => 'WhoisServer', Default => $WhoisServer &>
+ <input type="text" size="30" name="q" value="<% $q %>" />
</span>
<input type="submit" value="<%loc('Go')%>" />
</form>
diff --git a/html/RTIR/Tools/Elements/ToolResultsWhois b/html/RTIR/Tools/Elements/ToolResultsWhois
index f1191ab..24a17d6 100644
--- a/html/RTIR/Tools/Elements/ToolResultsWhois
+++ b/html/RTIR/Tools/Elements/ToolResultsWhois
@@ -58,35 +58,16 @@
% }
<%PERL>
my $DoInvestigate = 0;
-if ( $WhoisIterator ) {
- while ( my $obj = $WhoisIterator->next ) {
- my @lines_starting_with_space = grep /^(\s+)(\w+)/, $obj->content;
- if ( $handparse || $#lines_starting_with_space >= 4 ) { #we couldn't parse that. suck
- my $content = join "", $obj->content;
+if ( $content ) {
$m->comp( '/Elements/MakeClicky',
object => $TicketObj,
- lookup_params => "ticket=". ($TicketObj? $TicketObj->id : 0) ."&server=$WhoisServer",
+ lookup_params => "ticket=". ($TicketObj? $TicketObj->id : 0),
content => \$content,
);
$DoInvestigate = 1 if $content =~ /Requestorbox/ig;
</%PERL>
<pre><% $content |n %></pre><br />
-% } else {
-Structured RIPE whois data returned. Click <a href="Lookup.html?q=<% $q |u %>&server=<% $WhoisServer |u %>&handparse=1">here</a> to manually parse this data.
-<br />Warnings <% $obj->warnings %>
-<br />errors <% $obj->errors %>
-<hr />
-% foreach my $attribute ( $obj->attributes ) {
-% foreach my $value ( $obj->$attribute() ) {
- <b><%$attribute%></b>:
-% $m->comp('/Elements/MakeClicky', ticket => $TicketObj, lookup_params => "ticket=".$TicketObj->id, content => \$value);
-<% $value |n %><br />
-% }
-% }
-
% }
-% }
-% }
%# Don't offer the option of Investigating to unless there are addresses
% if ( $DoInvestigate ) {
@@ -110,18 +91,9 @@ $WhoisServer => undef
$server => undef
</%args>
<%init>
-$WhoisServer = $server unless defined $WhoisServer;
-unless ($WhoisServer) {
- return unless RT->Config->Get('RunWhoisRequestByDefault');
- $WhoisServer = RT::IR->FirstWhoisServer;
-}
-
+use Net::Whois::Raw qw(whois);
return unless $q;
-
-my ($WhoisIterator, $WhoisError) = RT::IR->WhoisLookup(
- Server => $WhoisServer,
- Query => $q,
- CurrentUser => $session{'CurrentUser'},
-);
+my $WhoisError;
+my $content = whois($q);
</%init>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list