Skip Menu |

This queue is for tickets about the Net-ILO CPAN distribution.

Report information
The Basics
Id: 65085
Status: resolved
Priority: 0/
Queue: Net-ILO

People
Owner: NLEWIS [...] cpan.org
Requestors: dean [...] fragfest.com.au
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



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)
Fair enough, for some reason I enjoy all the squigglies but that is my own personal problem. ;) I'll go ahead and make this change to new() but is this something you'd like to see for all methods (eg. add_user(), network(), etc.) which take a hashref as an argument? I suppose flexibility can't hurt!
Fixed in 0.54