| 1 | # P2P::pDonkey::Util.pm | ||||||||||
| 2 | # | ||||||||||
| 3 | # Copyright (c) 2003-2004 Alexey klimkin <klimkin at cpan.org>. | ||||||||||
| 4 | # All rights reserved. | ||||||||||
| 5 | # This program is free software; you can redistribute it and/or | ||||||||||
| 6 | # modify it under the same terms as Perl itself. | ||||||||||
| 7 | # | ||||||||||
| 8 | package P2P::pDonkey::Util; | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | require Exporter; | |||||||||
| 15 | |||||||||||
| 16 | 1 | our $VERSION = '0.05'; | |||||||||
| 17 | |||||||||||
| 18 | 1 | our @ISA = qw(Exporter); | |||||||||
| 19 | |||||||||||
| 20 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 21 | addr2ip ip2addr | ||||||||||
| 22 | ) ] ); | ||||||||||
| 23 | |||||||||||
| 24 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 25 | |||||||||||
| 26 | 1 | our @EXPORT = qw( | |||||||||
| 27 | |||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | # Preloaded methods go here. | ||||||||||
| 31 | |||||||||||
| 32 | 1 | ▶ | use Socket qw (inet_aton inet_ntoa); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | |||||||||||
| 34 | 1 | ▶ | sub addr2ip { | ||||||||
|
Subroutine
addr2ip: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 35 | 1 | my $ip; | |||||||||
| 36 | 1 | $ip = inet_aton($_[0]); | |||||||||
| 37 | 1 | ▶ | defined $ip || return 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 1 | return unpack('L', $ip); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | ▶ | sub ip2addr { | ||||||||
|
Subroutine
ip2addr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 42 | 1 | return inet_ntoa(pack('L', $_[0])); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | 1; | |||||||||
| 46 | __END__ | ||||||||||