I've been struggling with this problem for far too long. I seem to get real close. But for some reason, I'm missing a piece of the puzzle, I think. This is probably (should be) simple. :(
I'm attempting to provide 1 text input form field in a web page. The input has 2 choices; IP address, or Domain name. The problem I have is creating a working/effective matching scheme. I think I have all the bits. But I can't seem to focus wide enough to see the whole picture, and put the bits together. Here are the bits/logic I'm attempting to use
Yea, I know. Pretty much worthless. But even complete examples were worthless -- they didn't work. :(#!/usr/bin/perl -w use strict; # seems like an RE might be the easiest use Data::Validate::IP qw(is_ipv4); use Data::Validate::Domain qw(is_domain); # the forms text input name is,not surprisingly, input my $ip = param("input")||""; my $dom = param("input")||""; print qq( <form method="post" action="tester.cgi"> <label for="input">Input: </label><input type="text" name="input" valu +e="" /> <input type="submit" value="Post Input" /> </form>); # how do I know, how can I match? if (is_ipv4($ip)) { print "Looks like an ipv4 address"; }elsif (is_domain($dom)) { print "Looks like a domain\n"; }else{print "We got nadda";}
Apologies for the mess. But, at this point, that's what my head is.
--Chris
Hey. I'm not completely useless. I can be used as a bad example.
In reply to All attempts to match data from input fail. Please help. by taint
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |