in reply to NetDB - Problem with perl module NET:MAC:Vendors

Maybe try the following first:

my $filename = '/opt/netdb/netmacvendor/oui.txt'; open my $fh, '<', $filename or die "Couldn't read $filename: $!";

Also, file:// URIs are somewhat underspecified. Sometimes I've experienced needing three slashes for the path:

file:///opt/netdb/netmacvendor/oui.txt

... and sometimes only one:

file:/opt/netdb/netmacvendor/oui.txt

If you have URI::file installed (likely), you can test what you really need:

use URI::file; print URI::file->new('/opt/netdb/netmacvendor/oui.txt');

Replies are listed 'Best First'.
Re^2: NetDB - Problem with perl module NET:MAC:Vendors
by Vict0rC (Initiate) on Oct 12, 2015 at 19:08 UTC

    Hello and thanks for reply, I tried all you adviced but nothing helped yet...

    my $filename = '/opt/netdb/netmacvendor/oui.txt'; open my $fh, '<', $filename or die "Couldn't read $filename: $!";

    This outputs nothing :(

    use URI::file; print URI::file->new('/opt/netdb/netmacvendor/oui.txt');

    And this outputs three slashes: file:///opt/netdb/netmacvendor/oui.txt

    So I put file:///opt/netdb/netmacvendor/oui.txt in the code, bud error persists :(

    #!/usr/bin/perl use strict; use Net::MAC::Vendor; use URI::file; print URI::file->new('/opt/netdb/netmacvendor/oui.txt'); Net::MAC::Vendor::load_cache("file:///opt/netdb/netmacvendor/oui.txt") +; my $filename = '/opt/netdb/netmacvendor/oui.txt'; open my $fh, '<', $filename or die "Couldn't read $filename: $!";

    This outputs same error: Net::Mac::Vendor cache source [file:///opt/netdb/netmacvendor/oui.txt] does not exist at ./net-mac-vendor-test.pl line 7.

      Meh - looking ath the source code of Net::MAC::Vendors, it seems that its documentation is simply wrong:

      ... sub load_cache { my( $source, $dest ) = @_; my $data = do {; if( defined $source ) { unless( -e $source ) { carp "Net::Mac::Vendor cache source [$source] does not + exist"; return; } do { local( @ARGV, $/ ) = $source; <> } } else { __PACKAGE__->ua->get( oui_url() )->res->body; } }; ...

      Try simply passing a plain filename to it:

      Net::MAC::Vendor::load_cache("/opt/netdb/netmacvendor/oui.txt");

      Also, opening a bug report here might help :-)

        You are right!!! Docu is wrong! But... still no luck at all :( without file:// it shows no error, but still not translating...
        #!/usr/bin/perl use strict; use Net::MAC::Vendor; Net::MAC::Vendor::load_cache("/opt/netdb/netmacvendor/oui.txt"); # Vendor code lookup my $winmac = "90:2b:34:38:44:0d"; my $vendor_ref = Net::MAC::Vendor::fetch_oui_from_cache( $winmac ); print "Vendor is: $vendor_ref \n"

        This outputs nothing...

        I am using http://standards.ieee.org/regauth/oui/oui.txt

        I opened issue at authors github page here https://github.com/briandfoy/net-mac-vendor/issues/8 And also tried many other test, with perlbrew and different perl and cpan versions, to test if there isnt some incompatibility issue... But no luck. Still no output from fetch_oui_from_cache

        Is there any way to test, if load_cache function works? If it really loads the cache from file? Thanks for help.