File: auth.pl

package info (click to toggle)
libmongodb-perl 0.45-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,960 kB
  • sloc: perl: 2,664; ansic: 1,694; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 647 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use utf8; 
use warnings;
use MongoDB;
use MongoDB::Code;
use DateTime;
use IO::File;
use boolean;
use Data::Dumper;
use MongoDB::OID;
use Devel::Peek;
use File::Copy;
use Data::Dump;
use File::Temp;
use File::Slurp;
use Tie::IxHash;
use FileHandle;

my $conn = MongoDB::Connection->new("username" => "kristina", "password" => "foo", "db_name" => "bar");

my $db = $conn->get_database("bar");
my $c = $db->get_collection("x");

my $count = 0;
while ($count < 10) {
  print "inserting $count...\n";
  eval {
    my $cursor = $c->insert({"name" => 1}, {"safe" => true});
  };

  if ($@) {
    print $@."\n";
  }
  sleep(3);
  $count++;
}