Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Embedding CPAN modules

Help
2006-12-02
2013-04-25
  • Rick Conner
    Rick Conner
    2006-12-02

    These may be trivial questions, but I haven't seen them explicitly addressed anywhere.

    I am developing a CB app that uses a couple of standard CPAN modules that aren't installed on Macs by default.

    1. In order to distribute this app, could I simply copy the CPAN modules into the app folder and then put a 'use lib' in my code?

    2. Would this enable anyone to run the app on an out-of-the-box Mac without having to install CPAN modules etc.?

    3. Since my app will have no machine-language code (all Perl), could I call it Universal, or are there parts of the CB framework that are in machine language?

    Appreciate any pointers or help!

    -- rick

     
    • Sherm Pendley
      Sherm Pendley
      2006-12-03

      You should copy the modules into the Resources/ subdir inside your .app bundle - CamelBones already adds that to @INC. Platform-specific XS modules should be in a Resources/(version)/(arch) subdir. You should include versions for every Mac OS X version you intend to support. For instance, if you intend to support Panther or newer, you'd have both Resources/5.8.1/ and Resources/5.8.6 subdirs in your .app, and a darwin-thread-multi-2level subdir under each one.

      The CamelBones framework is a Universal Binary, and the stub for your app will be built as a UB unless you've changed the project settings.

      Building UB's of XS modules can be a challenge - the Apple-supplied Perl is Universal, but they've modified its Config.pm and removed all the compiler and linker switches that would allow it to use the 10.4u SDK and build universal XS modules.

      There's a bunch of pre-compiled modules in /Developer/CamelBones/Modules too. Versions for Panther (5.8.1) and Tiger (5.8.6, Universal) are included, so you can unzip those into your directly into your app's Resources/ subdir, and it should then be able to run on both. I've included most of the more difficult builds - several XML modules, DBI & DBDs for MySQL, PostgreSQL, and SQLite, DBIx::Class, and some other stuff.