Apache-Session-MongoDB

 view release on metacpan or  search on metacpan

lib/Apache/Session/MongoDB.pm  view on Meta::CPAN

    }
    return \%res;
}

sub _col {
    my ( $self, $args ) = @_;
    my $conn_args;
    foreach my $w (
        qw(host auth_mechanism auth_mechanism_properties bson_codec
        connect_timeout_ms db_name heartbeat_frequency_ms j local_threshold_ms
        max_time_ms password port read_pref_mode read_pref_tag_sets
        replica_set_name server_selection_timeout_ms server_selection_try_once
        socket_check_interval_ms socket_timeout_ms ssl username w wtimeout
        read_concern_level)
      )
    {
        $conn_args->{$w} = $args->{$w} || $default->{$w};
        delete $conn_args->{$w} unless ( defined $conn_args->{$w} );
    }
    my $s = MongoDB->connect( $args->{host} || $default->{host}, $conn_args )
      or die('Unable to connect to MongoDB server');

lib/Apache/Session/MongoDB.pm  view on Meta::CPAN

 };

=head1 DESCRIPTION

This module is an implementation of Apache::Session.  It uses the MongoDB
backing store and no locking.

=head1 PARAMETERS

You can set the followong parameters host, db_name, collection, auth_mechanism,
auth_mechanism_properties, connect_timeout_ms, ssl, username and password.
See L<MongoDB> for more

=head1 SEE ALSO

L<MongoDB>, L<Apache::Session>

=head1 AUTHOR

Xavier Guimard, E<lt>x.guimard@free.frE<gt>

lib/Apache/Session/Store/MongoDB.pm  view on Meta::CPAN

}

sub connection {
    my ( $self, $session ) = splice @_;
    return
      if ( defined $self->{collection} );
    my $conn_args;
    foreach my $w (
        qw(host auth_mechanism auth_mechanism_properties bson_codec
        connect_timeout_ms db_name heartbeat_frequency_ms j local_threshold_ms
        max_time_ms password port read_pref_mode read_pref_tag_sets
        replica_set_name server_selection_timeout_ms server_selection_try_once
        socket_check_interval_ms socket_timeout_ms ssl username w wtimeout
        read_concern_level)
      )
    {
        $conn_args->{$w} = $session->{args}->{$w} || $default->{$w};
        delete $conn_args->{$w} unless ( defined $conn_args->{$w} );
    }
    my $s =
      MongoDB->connect( $session->{args}->{host} || $default->{host},

t/Apache-Session-MongoDB.t  view on Meta::CPAN

            tied(%h)->delete;
        }
    }

    ok( ( tied(%h2)->delete or 1 ), 'Delete session' );

    unless ( defined $ENV{MONGODB_USER} and defined $ENV{MONGODB_DB_NAME} ) {

        skip 'MONGODB_USER and MONGODB_DB_NAME are not set', 2;
    }
    for my $w (qw(db_name username password)) {
        $args->{$w} = $ENV{ "MONGODB_" . uc($w) };
    }
    ok( tie( %h, 'Apache::Session::MongoDB', undef, $args ),
        'Authentified object' );
    ok( ( tied(%h)->delete or 1 ), 'Delete session' );
}

sub newsession {
    my ( $args, %data ) = @_;
    my %h;



( run in 0.642 second using v1.01-cache-2.11-cpan-49f99fa48dc )