in reply to Re: how to capture status codes of mongodb in perl
in thread how to capture status codes of mongodb in perl

i have tried that,but a hash code is prinnted while trying to print that

my $err = $database->last_error(); print $err; #prints: HASH(0x2ad39fc)

how could i validate that

Replies are listed 'Best First'.
Re^3: how to capture status codes of mongodb in perl
by choroba (Cardinal) on Nov 05, 2014 at 12:44 UTC
    You can dereference the reference
    print %$err;

    or, better, use Data::Dumper:

    use Data::Dumper; print Dumper $err;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^3: how to capture status codes of mongodb in perl
by blindluke (Hermit) on Nov 05, 2014 at 16:00 UTC

    What have you tried? Have you tried looking at the documentation, and following the link I posted? If you tried, then try reading this particular fragment again:

    last_error returns a hash with fields that vary, depending on what the previous operation was and if it succeeded or failed. If the last operation (before the last_error call) failed, either:
    err will be set or
    errmsg will be set and ok will be 0.

    If err is null and ok is 1, the previous operation succeeded.

    - Luke