in reply to Re: scandns.pl in thread scandns.pl
That's stupid. A better, simpler, less logic-assaulting change would be to address the warning message itself, by changing
my $x;
to
my $x=0;
More to the point, your "fix" completely blows the logic of the code, which attempts to implement the requirement that all four of the octets must be in the range 0..255.
Your "fix" would say that an argument of 1.99999.99999.99999 is a valid IP address.
I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies .
Re^3: scandns.pl
by taint (Chaplain) on Nov 14, 2013 at 04:57 UTC
|
Right you are jdporter.
Boy, was I stupid! It would have killed me to take the time to evaluate it. Rather than simply stripping off the offender.
I'll take more time, before pressing the "create" button, in the future.
Sorry for the bother, and thanks for calling me on it, jdporter.
--Chris
#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;
| [reply] |
Re^3: scandns.pl
by taint (Chaplain) on Nov 14, 2013 at 06:00 UTC
|
$x++ if(($_>=0)&&($_<=255));
as I read it, is:
if the input ($x), is at least 0, and no greater than 255
$x is legitimate, so return $x
So as I see it. There is nothing afoul with my proposed solution.
:)
--Chris
#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;
| [reply] [d/l] |
|
as I read it...
You're reading it wrong.
$x is counting the number of valid octets. The number of valid octets should be 4, not simply >0. It's fine to return 4 rather than 'true', but it is not fine to return 1 or 2 or 3. The number of the counting shall be 4.
I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies .
| [reply] |
|
The number of valid octets should be 4, not simply >0. It's fine to return 4 rather than 'true', but it is not fine to return 1 or 2 or 3. The number of the counting shall be 4.
"First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who being naughty in My sight, shall snuff it."
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] |
Re^3: scandns.pl
by taint (Chaplain) on Nov 14, 2013 at 05:29 UTC
|
Greetings jdporter.
So is you're assignment.
I take back most of my 1st reply to you.
If choosing you're assignment. CDIR masks will be rejected:
% ./scandns.pl 209.197.123.153/29
209.197.123.153 is an invalid address.
%
Using my assignment (correct, or incorrect):
% ./scandns.pl 209.197.123.153/29
209.197.123.152 => renku.org => 4.79.43.173
209.197.123.153 => perlmonks.pair.com
209.197.123.154 => taidsaccount.com
209.197.123.155 => murphyworld.com => 208.91.197.132
209.197.123.156 => beetz.at
209.197.123.157 => best-kids-bedding-prices-online.com => best-kids-be
+dding-prices-online.com has no A record
209.197.123.158 => lowest-prices-for-kids-bedding.com => lowest-prices
+-for-kids-bedding.com has no A record
209.197.123.159 => no PTR record
%
Not to sound too much the smart a$$. But before ridiculing someone for trying to help. Perhaps it best to test your own solution first?
Best wishes.
--Chris
#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;
| [reply] [d/l] [select] |
|
| [reply] [d/l] |
|
% ./scandns.pl 209.197.123.153/29
209.197.123.153 is an invalid address
%
I have no idea. The only possible difference(s) I can imagine, would be
* differing OS's
* differing versions of: IO::Socket or Net::Netmask
* differing versions of Perl itself
Sincerely confused.
Best wishes.
--Chris
#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;
| [reply] [d/l] |
|
|
|
|
|