$DH->priv_key($DH_private);

When you call priv_key() like that, I believe you provide the function with two args - the string "Crypt::DH::GMP" and $DH_private.

However, the priv_key() function takes only one argument, and returns a string.
I presume you therefore need to be calling priv_key() as something like:
my $string = priv_key($DH_private);
Afterthought: Or perhaps you'll need to call it by its fully qualified name:
my $string = Crypt::DH::GMP::priv_key($DH_private);
However, I know nothing of this module's functionality, and I couldn't find any example of priv_key() usage in either the documentation or the test suite.
AIUI, the priv_key function is provided in xs/dh_gmp.c as:
char * PerlCryptDHGMP_priv_key( PerlCryptDHGMP *dh ) { return PerlCryptDHGMP_mpz2sv_str(PerlCryptDHGMP_PRIVKEY_PTR(dh), 1 +0, NULL); }
Update: And all that essentially does is express the value contained in PerlCryptDHGMP *dh as a base 10 string, and then return that string (packed with extra 0's as needed).

Cheers,
Rob

In reply to Re: Usage problem with Crypt::DH::GMP::priv_key( ) by syphilis
in thread Usage problem with Crypt::DH::GMP::priv_key( ) by Llew_Llaw_Gyffes

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.