Farly::Transport::PortRange - TCP/UDP port range class


This class represents a TCP or UDP port number range.

Inherits from Farly::Transport::Object.


new( <string> )

The constructor accepts port number range with the first port separated from the last port by a space or dash.

 my $port_range = Farly::Transport::PortRange->new( "1024 65535" );
 my $port_range = Farly::Transport::PortRange->new( "1024-65535" );


Returns the first port in the range as an integer

  $first_8_bit_int = $port_range->first();


Returns the last port in the range as an integer

  $last_8_bit_int = $port_range->last();


Returns the current Farly::Transport::PortRange as a string

  print $port_range->as_string();


Returns an array containing the all of the port objects in the current PortRange object. For use in Set calculations.

  my @array = $port_range->iter();


Farly::Transport::PortRange Copyright (C) 2012 Trystan Johnson

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.