The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::Ladybug::Subnet - Overloaded Subnet object

SYNOPSIS

  use Devel::Ladybug::Subnet;

  my $addr = Devel::Ladybug::Subnet->new("10.0.0.0/24");

DESCRIPTION

Simple class to represent subnets as strings.

Extends Devel::Ladybug::Str. Uses Net::Subnets to expand ranges.

PUBLIC CLASS METHODS

  • $class->assert(@rules)

    Returns a new Devel::Ladybug::Type::Subnet instance which encapsulates the received Devel::Ladybug::Subtype rules.

      create "YourApp::Example::" => {
        someAddr  => Devel::Ladybug::Subnet->assert( subtype(...) ),
    
        # ...
      };
  • $class->new($addr);

    Returns a new Devel::Ladybug::Subnet instance which encapsulates the received value.

      my $subnet = Devel::Ladybug::Subnet->new("10.0.0.0/24");

PUBLIC INSTANCE METHODS

  • $self->list

    Return a new Devel::Ladybug::Array containing each IP in self's range.

      $subnet->list->each( sub {
        my $ip = shift;
    
        print "Have IP address: $ip\n";
      } );

SEE ALSO

Devel::Ladybug::Str, Devel::Ladybug::Array, Net::Subnets

This file is part of Devel::Ladybug::Net.