Skip Menu |

This queue is for tickets about the Net-Address-IPv4-Local CPAN distribution.

Report information
The Basics
Id: 113131
Status: new
Priority: 0/
Queue: Net-Address-IPv4-Local

People
Owner: JMEHNLE [...] cpan.org
Requestors: MRDVT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.12
Fixed in: (no value)



Subject: Net::Address::IPv4::Local - Example Script to add to distribution
I wrapped this up for my IT folks and I'd like for you to include it in the distribution if you would like. Copyright (c) 2016 Michael R. Davis This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. I just needed `net-address-ipv4-local-public.pl -o 12` but it has all options that I could think of. cat net-address-ipv4-local-public.pl #!/usr/bin/perl use strict; use warnings; use Getopt::Std qw{getopts}; use Net::Address::IPv4::Local; my $syntax = "$0 [[-d] [-s] [-i] [-o [1234]]]\n"; my $opt = {}; getopts('dio:', $opt); #debug my $debug = $opt->{'d'} || 0; my $octets = $opt->{'o'} || ''; my $ip = $opt->{'i'} || !$opt->{'o'}; die($syntax) unless $octets =~ m/\A[1234]*\Z/; my $address = Net::Address::IPv4::Local->public; printf "Address: $address\n" if $debug; printf "$address\n" if $ip; if ($octets) { print "Octets: $octets\n" if $debug; my @octets = split(//, $octets); print "Octets: @octets\n" if $debug; my @addresses = split /\./, $address; print join('.', @addresses[map {$_-1} @octets]), "\n"; } __END__ mrdvt92