Personally, I hate hate hate C-ish libraries when a perlish approach fits much nicer. For example the OpenGL C libraries use something like hungarian notation so the caller can specify what types and how many parameters they pass in:

glGetLightfv glGetLightiv

These two functions make no sense in Perl, one is for passing in the number of the light as a floating point number, the other is for passing in the number as an integer number. So, conveniently, there is OpenGL::Simple, which exports only one function and uses Perl (or rather XS) code to determine which function was meant:

glGetLight

This is possibly slightly less efficient but doesn't burden me with thinking about the parameter count and types, especially when Perl has to convert to the right types anyway.

To answer your question, I like how you provide sensible defaults. You might want to make the other, more specialized C functions available too, but maybe not export them, so one can always still override your "smart" code. But as long as your "smart" wrapper even lives in Perl code, people can always look at it and patch it directly. So I say, go for it and reduce the API by Perl dwimmery ;-)


In reply to Re: Question about module interface style by Corion
in thread Question about module interface style by Leviathan

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.