"be consistent" PerlMonks

### Comment on

 Need Help??

I'd come to a similar opinion as tye above, though perhaps for a slightly different reason. I know no C or C++, and very little about the specifics of XS. I know a good deal of Perl. I'm probably not unusual: if the intended audience for your new Perl interface module is Perl developers, you're guaranteed that everyone in that audience is going to know something about Perl - at least how to download, install and use a module - whilst you can't say anything with confidence about how much C they know.

The most important thing is to supply those Perl developers with a library-centric interface and enough documentation to get started using it. They may well hate the interface as "un-Perlish". If they loathe it enough, and have enough Perl to understand packages and modules, they can sweeten the interface to taste. Well, they don't even need to understand packages: if they can write a function, they can hide the nastiness of your library-centric module all they want.

As an example, take a look at the HTML parser modules on CPAN. Many of them derive from the c-based parser in HTML::Parser. The interface of HTML::Parser probably isn't to the taste of most people (a few years ago, I tried and failed several times to understand it), but it doesn't matter, because there's lots of people willing to step in and provide more "perlish" interfaces (whatever that means to them). Hence HTML::PullParser, HTML::TokeParser, HTML::TreeBuilder, HTML::TokeParser::Simple, and so on.

Recently, I wanted to use the library version of HTML Tidy. Without disrespect to the author, what's provided for Perl is a pretty bare (SWIG-ified) interface to the underlying C calls. To me it's ugly to do:

my $tidy = HTML::Tidy::Document->new();$tidy->Create();
$tidy->SetErrorFile('/dev/null');$tidy->OptSetValue( $tidy->TidyBodyOnly, 1);$tidy->ParseString($messy); my$tidied = $tidy->SaveString(); [download] The underlying C-constants are exposed ($tidy->TidyBodyOnly) and there's steps that are meaningless in Perl ($tidy->Create()). And I don't like the method naming convention. But it's simple for me as a Perl developer to make a functional interface I like, such as: my$tidied = html_tidy(\$messy, 'TidyBodyOnly' => 1)
[download]

That hides all the C messiness. The point being: I could never have written the C interface; I simply don't know how. But I - or any other competent Perlista - can wrap your generously-provided C-interface just as they wish.

Let a thousand interfaces bloom
ViceRaid

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.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
 erix . o O( "what fools the french are, Jeeves" ) [choroba]: Also some Достое́вс кий [Discipulus]: mmh windows understand something like: cd c:\\\\path\\\\to weird..

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-05-24 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My favorite model of computation is ...

Results (183 votes). Check out past polls.