The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::IPEntry - A megawidget for input of IP-Adresses IPv4 and IPv6

SYNOPSIS

 use Tk;
 use Tk::IPEntry;

 my $mw = MainWindow->new();
 my $ipadress;

 my $entry = $mw->IPEntry(
        -variable  => \$ipadress,
 )->pack(-side => 'left');

 $ipadress = '129.2.32.1';

 MainLoop;

-type (ipv4|ipv6)

The format of Ip-Number.

METHODS

Here come the methods that you can use with this Widget.

$IPEntry->variable(\$ipnumber);

Specifies the name of a variable. The value of the variable is a text string to be displayed inside the widget; if the variable value changes then the widget will automatically update itself to reflect the new value. The way in which the string is displayed in the widget depends on the particular widget and may be determined by other options, such as anchor or justify.

$IPEntry->set($ipnumber);

Set the IP number to display. You can use all standart format for IP-Adresses in Version 4 and Version 6. Here comes some examples, please look also in perldoc from Net::IP:

  A Net::IP object can be created from a single IP address: 
  $ip->set('193.0.1.46') || die ...
  

  Or from a Classless Prefix (a /24 prefix is equivalent to a C class): 
  $ip->set('195.114.80/24') || die ...

  Or from a range of addresses: 
  $ip->set('20.34.101.207 - 201.3.9.99') || die ...
  

  Or from a address plus a number: 
  $ip->set('20.34.10.0 + 255') || die ...
 

  The set() function accepts IPv4 and IPv6 addresses 
  (it's necessary set -type option to 'ipv6'): 
  $ip->set('dead:beef::/32') || die ...

Very interesting feature, you can give Ip-Ranges and the user can only choice a Ip-Adress in this Range. The other Numbers is disabled. I.E.:

  $ip->set('195.114.80/24') || die ...
  $ip->set('dead:beef::/32') || die ...

$IPEntry->get();

Here you can get IP number from display. This is also a Interface to Net::IP, in example you will get the binary code from displayed IP-Number then you can call:

  $IPEntry->get('binip');
  

Please look for all allow commands to Net::IP.

$IPEntry->error();

This prints the last error.

EXAMPLES

Please see for examples in 'demos' directory in this distribution.

AUTHOR

xpix@netzwert.ag

SEE ALSO

Tk; Tk::NumEntry; Tie::Watch; Net::IP;

__END__