Michael Shipper
and 1 contributors

NAME

Net::SolarWinds::ConstructorHash - Default Hash object constructor

SYNOPSIS

  package MyClass;
  
  use base qw(Net::SolarWinds::ConstructorHash);
  
  1;
  
  my $pkg=new MyClass(key=>'value');

DESCRIPTION

This library provides a common base line construcotor that accepts an arbitrary key=>value pair set.

Setting default constructor values.

To create default constructor values, simply use the inherited OO constructor example:

  sub new {
        my ($class,%args)=@_;
        
        return $class->SUPER::new(
          some_argument=>'default_value',
          %args
        );
  }

OO Methods provided

  • Object constructor

    This class provides a basic object constructor that accepts hash key value pairs as its arguments. Keep in mind there are a few reserved hash keys.

    Reserved hash keys:

      _shutdown=>0|1
        # wich is used to manage the shutdown state.
    
      log=>undef|Net::SolarWinds::Log instance
        # this key represents the log object ( if passed into the constructor as class->new(log=>Net::SolarWinds::Log->new()) )
  • $self->is_shutdown

    This method should be used when running infinate loops to see if the application should stop running its extended loop.

  • $self->set_shutdown

    Sets the object into the shutdown state.

AUTHOR

Michael Shipper