Undefined subroutine &Sys::IP::SUPPORTED called at /usr/lib/perl5/site_perl/5.6.0/Sys/IP.pm line 27. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.6.0/Sys/IP.pm line 28. Compilation failed in require at ./getip.pl line 5. BEGIN failed--compilation aborted at ./getip.pl line 5.
I think the BEGIN block doesn't like looking for a sub not included in the block. So, I tested my theory with the following adjustment:
#--------------------------------------------------------------------- +-------# #we want to die if a system isn't explicitly supported BEGIN { #these are the os's that are supported at this time my @Supported = ( 'openbsd', 'freebsd', 'linux', 'irix', 'solaris', 'darwin', 'MSWin32' ); grep /$^O/, @Supported or die "$^O isn't supported by Sys:IP yet.\n"; }
I've been up all night, so this could be made better, but it works. Here is my test code:
#!/usr/bin/perl -w #-*-perl-*- use strict; use Sys::IP; use diagnostics; my $ip = ip(); my @ips = ips(); print $ip , "\n"; foreach ( @ips ) { print $_ , "\n"; }
BTW, MSWin32 uses 'ipconfig /all' for the type of data you need. I think it sits in %SystemRoot%/system32 on NT/2k and %SystemRoot%/command on 98/ME, but I could be wrong. By default, if networking is installed, ipconfig should reside in the PATH env var. I'll check it for you when I get in to work.
HTH
Dex
In reply to Re: Sys::IP
by idnopheq
in thread Sys::IP
by BlueLines
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |