MAC vendor lookup: Difference between revisions

Content added Content deleted
(→‎{{header|Python}}: Add libheader for requests since it needs to be installed)
(→‎{{header|Perl}}: Add request throttling.)
Line 856: Line 856:
=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>#!/usr/bin/env perl -T
<lang perl>#!/usr/bin/env perl -T
use 5.018_002;
use v5.18.2;
use warnings;
use warnings;
use LWP;
use LWP;
use Time::HiRes qw(sleep);


our $VERSION = 1.000_000;
our $VERSION = 1.000_000;
Line 864: Line 865:
my $ua = LWP::UserAgent->new;
my $ua = LWP::UserAgent->new;


no warnings 'qw';
my @macs = (
my @macs = qw(
'FC-A1-3EFC:FB:FB:01:FA:21', '00,0d,4b',
FC-A1-3EFC:FB:FB:01:FA:21 00,0d,4b
'Rhubarb', '00-14-22-01-23-45',
'10:dd:b1', 'D4:F4:6F:C9:EF:8D',
Rhubarb 00-14-22-01-23-45
'FC-A1-3E', '88:53:2E:67:07:BE',
10:dd:b1 D4:F4:6F:C9:EF:8D
'23:45:67', 'FC:FB:FB:01:FA:21',
FC-A1-3E 88:53:2E:67:07:BE
23:45:67 FC:FB:FB:01:FA:21
'BC:5F:F4',
BC:5F:F4
);
);


for my $mac (@macs) {
while (my $mac = shift @macs) {
my $vendor = get_mac_vendor($mac);
my $vendor = get_mac_vendor($mac);
if ($vendor) {
if ($vendor) {
say "$mac = $vendor";
say "$mac = $vendor";
}
}
sleep 1.5 if @macs;
}
}