in reply to How to deal with multiple functions served from only one input field?

Sorry for not addressing your actual question, but I strongly suggest you run your input through some kind of untainting (especially since you are using taint mode) before doing anything else with it. You will likely save yourself some grief by not using/sending what is obvious crap (bogus user input) when it is present to begin with. Testing for a valid IP address format is fairly trivial, and there are several patterns for domain names that can be used.

Trust me on this. :)

It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
  • Comment on Re: How to deal with multiple functions served from only one input field?

Replies are listed 'Best First'.
Re^2: How to deal with multiple functions served from only one input field?
by taint (Chaplain) on Nov 15, 2013 at 01:17 UTC
    "Trust me on this. :) "

    I do, trust me. :)

    Thank you very much boftx for your thoughtful reply.
    This has already been accomplished. I really should have also included it -- crap!

    So, I'll append it now:
    REVISED

    use CGI; use Net::Whois::ARIN; use Regexp::Common qw /net/; my $w = Net::Whois::ARIN->new( host => 'whois.arin.net', port => 43, timeout => 30, ); print "content-type:text/html; charset=utf-8\n\n"; print $head; my $q = new CGI; my $ip = $q->param('ip'); if (!$ip){print $formm; }else{ my @records = $w->network($ip=~ /^$RE{net}{IPv4}$/); foreach my $net (@records) { # print ...; } }
    Sorry for the previous omission. :(

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;