Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Perl & SWIG best practices?

by Pic (Scribe)
on May 22, 2011 at 18:51 UTC ( [id://906189]=perlquestion: print w/replies, xml ) Need Help??

Pic has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to wrap a C library (the Xerox finite state tools, here for more) with SWIG, and after a certain amount of trial and error (structs with the same name as structs in the Perl headers, dead functions in the headers), I've gotten the basics running. Now I wonder if there are some best practices I should keep in mind while the project is still in its infancy, and some other bits and pieces related to making a "real" module:

  • ATM I'm using MakeMaker and Makefile.PL to create the Makefile, but I have to admit I don't really understand all of what's going on. Should I use Module::Build instead?
  • I assume I shouldn't ask an end-user to run swig to create the wrapper code. How do I best separate the developer and user parts of the workflow?
  • Are there any (relatively) simple wrapper modules I can look at for examples?

Replies are listed 'Best First'.
Re: Perl & SWIG best practices?
by John M. Dlugosz (Monsignor) on May 22, 2011 at 19:37 UTC
    My understanding from similar recent investigations is that Module::Build is newer than the old Makefile.PL tools and should be used instead. But Dist::Zilla offers even better tools for the author (though is hard to install), and Module::Install is even better than Module::Build for whatever technical reasons and in working with up-to-date best practices. (see link)

    It seems there is a lot to learn about testing, and module creation scripts are well behind the curve in what they set up for you.

    The normal installation process will run the C compiler if necessary. For these build tools, you just have to use the proper naming and directory convention and it knows what to do.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://906189]
Approved by Corion
Front-paged by Corion
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-21 09:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found