I'm trying to create a custom "mongodb perl wrapper". I created the following perl module, which local on my machine runs. My questions to the are:
1. Would you create the module different?
2. Do you have improvements or adaptations to create the module better?
Code:

package MyMongo; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use MongoDB; $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = ( DEFAULT => [qw()], Both => [qw()]); sub new { my ($class, $args) = @_; my $self = { host => $args->{host} || 'localhost', port => $args->{port} || '27017', database => $args->{database} || '', connection => $class->_set_connection(), }; return bless $self, $class; } sub _set_connection { my $self = shift; my $client = MongoDB->connect('mongodb://localhost'); return $client; } sub get_database_names { # Lists all databases on the mongo server my $self = shift; return $self->{connection}->database_names; } sub get_database { # Returns a MongoDB::Database instance for database with the given + $name my ($self, $dbname) = @_; return $self->{connection}->get_database($dbname); } sub authenticate { my ($self, $args) = @_; $self = { dbname => $args->{dbname}, user => $args->{user}, password => $args->{password} }; $self->{connection}->authenticate($self->{dbname}, $self->{user}, +$self->{password}); } 1;

In reply to MongoDB Perl Wrapper by IruP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.