Subject: | "new" could be more flexible... |
new is a bit rigid in its need to have a hash ref of options, its
straight forward to be more flexible with something like ...
sub new {
my ($class) = shift;
my %options = ref $_[0] ? %{$_[0]}
: @_;
die __PACKAGE__ . 'requires address, username and password'
unless ($options{address}
&& $options{username}
&& $options{password});
my $self = {};
bless($self, $class);
$self->address( $options->{address} );
$self->username( $options->{username} );
$self->password( $options->{password} );
# iLO version will be autodetected later if not specified
$self->{_version} = $options->{version} || undef;
$self->{port} = $options->{port} || '443';
$self->{_debug} = $options->{debug} || '0';
return $self;
}
which will permit
Net::ILO->new({ username => 'asdad', password => 'asdadasd', %etc})
and also the slightly less curly...
Net::ILO->new( username => 'asdad', password => 'asdadasd', %etc)