in reply to MongoDB Perl Wrapper
Code-wise, I would make ->_set_connection respect the ->{port} and ->{host} arguments.
Also, I found a cascade of arguments makes testing and overriding things much easier in such routines. I would take the URL from the passed arguments, or from $self, in that order:
sub _set_connection { my( $self, %options ) = @_; my $url = $options{ url }; $url ||= sprintf 'http://%s:%s', $self->{host}, $self->{port}; return MongoDB->connect($url); }
|
|---|