⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ip.pm

📁 Network Administration Visualized 网络管理可视化源码
💻 PM
📖 第 1 页 / 共 3 页
字号:
Note that in versions prior to 3.02, if fed with the same IP subnetsmultiple times, these subnets would be returned. From 3.02 on, a more"correct" approach has been adopted and only one address would bereturned.=item C<$me-E<gt>compactref(\@list)>As usual, a faster version of =item C<-E<gt>compact()> that returns areference to a list. Note that this method takes a reference to a listinstead.=item C<-E<gt>first()>Returns a new object representing the first useable IP address withinthe subnet (ie, the first host address).=item C<-E<gt>last()>Returns a new object representing the last useable IP address withinthe subnet (ie, one less than the broadcast address).=item C<-E<gt>nth($index)>Returns a new object representing the I<n>-th useable IP address withinthe subnet (ie, the I<n>-th host address).  If no address is available(for example, when the network is too small for C<$index> hosts),C<undef> is returned.=item C<-E<gt>num()>Returns the number of useable addresses IP addresses within thesubnet, not counting the broadcast address.=backIn addition to the methods, some functions are overloaded to easemanipulation of the objects. The available operations are:=over=item B<Stringification>An object can be used just as a string. For instance, the following code	my $ip = new NetAddr::IP 'loopback';        print "$ip\n";Will print the string 127.0.0.1/8.=item B<Equality>You can test for equality with either C<eq> or C<==>.=item B<Dereferencing as an ARRAY>You can do something along the lines of	my $net = new NetAddr::IP $cidr_spec;        for my $ip (@$net) {	  print "Host $ip is in $net\n";	}However, note that this might generate a very large amount of itemsin the list. You must be careful when doing this kind of expansion.=item B<Sum and auto-increment>You can add a constant to an object. This will return a new objectreferring to the host address obtained by incrementing (ordecrementing) the given address. YOu can do this with the operatorsB<+>, B<->, B<+=> and B<-=>.The auto-increment or auto-decrement operators will return a newobject pointing to the next or previous host address in thesubnet. These are the B<++> and B<--> operators.=back=head2 EXPORTNone by default.=head1 HISTORY=over=item 0.01=over=item *original  version;  Basic testing  and  release  to CPAN  asversion 0.01. This is considered beta software.=back=item 0.02=over=item *Multiple changes  to fix endiannes issues. This  code is nowmoderately tested on Wintel and Sun/Solaris boxes.=back=item 0.03=over=item *Added -E<gt>first and -E<gt>last methods. Version changed to 0.03.=back=item 1.00=over=item *Implemented -E<gt>new_subnet. Version changed to 1.00.=item *less croak()ing when improper input  is fed to the module. Amore consistent 'undef' is returned now instead to allow theuser to better handle the error.=back=item 1.10=over=item *As  per  Marnix   A.   Van  Ammers  [mav6@ns02.comp.pge.com]suggestion, changed  the syntax of the loop  in host_enum tobe the same of the enum method.=item *Fixed the MS-DOS ^M  at the end-of-line problem. This shouldmake the module easier to use for *nix users.=back=item 1.20=over=item *Implemented -E<gt>compact and -E<gt>expand methods.=item *Applying for official name=back=item 1.21=over=item *Added  -E<gt>addr_number and  -E<gt>mask_bits.  Currently  we returnnormal  numbers (not  BigInts).   Please test  this in  yourplatform and report any problems!=back=item 2.00=over=item *Released under the new *official* name of NetAddr::IP=back=item 2.10=over=item *Added support for -E<gt>new($min, $max, $bits) form=item *Added -E<gt>to_numeric. This helps serializing objects=back=item 2.20=over=item *Chris Dowling  reported that  the sort method  introduced inv1.20  for -E<gt>expand  and -E<gt>compact  doesn't always  return anumber under perl versions < 5.6.0.  His fix was applied andredistributed.  Thanks Chris!=item *This module is hopefully released with no CR-LF issues!=item *Fixed a warning about uninitialized values during make test=back=item 2.21=over=item *Dennis  Boylan pointed  out a  bug under  Linux  and perhapsother platforms  as well causing the  error "Sort subroutinedidn't         return         single        value         at/usr/lib/perl5/site_perl/5.6.0/NetAddr/IP.pm  line  299,  E<lt>E<gt>line 2." or similar. This was fixed.=back=item 2.22=over=item *Some changes  suggested by Jeroen Ruigrok  and Anton Berezinwere included. Thanks guys!=back=item 2.23=over=item *Bug fix for /XXX.XXX.XXX.XXX netmasks under v5.6.1 suggestedby Tim Wuyts. Thanks!=item *Tested the module under MACHTYPE=hppa1.0-hp-hpux11.00. It isnow  konwn to  work  under Linux  (Intel/AMD), Digital  Unix(Alpha),   Solaris  (Sun),  HP-UX11   (HP-PA-RISC),  Windows9x/NT/2K (using ActiveState on Intel).=back=item 2.24=over=item *A spurious  warning when  expand()ing with -w  under certaincircumstances  was removed. This  involved using  /31s, /32sand the same netmask as the input.  Thanks to Elie Rosenblumfor pointing it out.=item *Slight change  in license terms to ease  redistribution as aDebian package.=back=item 3.00=overThis is  a major rewrite, supposed  to fix a number  of issues pointedout in earlier versions.The goals for this version include getting rid of BigInts, speeding upand also  cleaning up the code,  which is written in  a modular enoughway so  as to allow IPv6  functionality in the  future, taking benefitfrom most of the methods.Note that no effort has  been made to remain backwards compatible withearlier versions. In particular, certain semantics of the earlierversions have been removed in favor of faster performance.This  version  was tested  under  Win98/2K (ActiveState  5.6.0/5.6.1),HP-UX11 on PA-RISC (5.6.0), RedHat  Linux 6.2 (5.6.0), Digital Unix onAlpha (5.6.0), Solaris on Sparc (5.6.0) and possibly others.=back=item 3.01=over=item * Added C<-E<gt>numeric()>.=item *C<-E<gt>new()> called with no parameters creates a B<default>NetAddr::IP object.=back=item 3.02=over=item *Fxed C<-E<gt>compact()> for cases of equal subnets ormutually-contained IP addresses as pointed out by Peter Wirdemo. Notethat now only distinct IP addresses will be returned by this method.=item *Fixed the docs as suggested by Thomas Linden.=item *Introduced overloading to ease certain common operations.=item *    Fixed compatibility issue with C<-E<gt>num()> on 64-bit processors.=back=item 3.03=over=item *Added more comparison operators.=item *As per Peter Wirdemo's suggestion, added C<-E<gt>wildcard()> forproducing subnets in wildcard format.=item *Added C<++> and C<+> to provide for efficient iteration operationsover all the hosts of a subnet without C<-E<gt>expand()>ing it.=back=item 3.04=over=item *Got rid of C<croak()> when invalid input was fed to C<-E<gt>new()>.=item *As suggested by Andrew Gaskill, added support for prefixnotation. Thanks for the code of the initial C<-E<gt>prefix()>function.=back=item 3.05=over=item *Added support for range notation, where base and broadcast addressesare given as arguments to C<-E<gt>new()>.=back=item 3.06=over=item *Andrew Ruthven pointed out a bug related to proper interpretation of"compact" CIDR blocks. This was fixed. Thanks!=back=item 3.07=over=item *Sami Pohto pointed out a bug with C<-E<gt>last()>. This was fixed.=item *A small bug related to parsing of 'localhost' was fixed.=back=item 3.08=over=item *By popular request, C<-E<gt>new()> now checks the sanity of the netmasksit receives. If the netmask is invalid, C<undef> will be returned.=back=item 3.09=over=item *Fixed typo that invalidated otherwise correct masks. This bug appeared in 3.08.=back=item 3.10=over=item *Fixed relops. Semantics where adjusted to remove the netmask from thecomparison. (ie, it does not make sense to say that 10.0.0.0/24 is >10.0.0.0/16 or viceversa).=back=item 3.11=over=item *Thanks to David D. Zuhn for contributing the C<-E<gt>nth()> method.=item *tutorial.htm now included in the  distribution. I hope this helps somepeople to better  understand what kind of stuff can  be done with thismodule.=item *C<'any'> can be used as a synonim of C<'default'>. Also, C<'host'> isnow a valid (/32) netmask.=back=back=head1 AUTHORLuis E. Munoz <luismunoz@cpan.org>=head1 WARRANTYThis software comes with the  same warranty as perl itself (ie, none),so by using it you accept any and all the liability.=head1 LICENSEThis software is (c) Luis E. Munoz.  It can be used under the terms ofthe perl artistic license provided  that proper credit for the work ofthe  author is  preserved in  the form  of this  copyright  notice andlicense for this module.=head1 SEE ALSOperl(1).=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -