Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jk2addict (4946)

  (email not shown publicly)
AOL IM: chrislaco (Add Buddy, Send Message)
Yahoo! ID: (Add User, Send Message)

Journal of jk2addict (4946)

Sunday October 07, 2007
06:58 PM

ShareDir Snafu

[ #34628 ]

Something so simple has melted my brain this evening. While working on Mango, I've setup the code so things like TT templates are stored in the perl 'share' directory for Mango using M::I::Share and get those files later view File::ShareDir.

I just put a fresh install of Ubuntu with perl 5.8.8 on my laptop and installed Mango, but the app couldn't find the template files. After some digging, I'm even more confused than ever.

M::I::Share says:
# Put everything inside ./share/ into the distribution 'auto' path

When I ran make install, the shared files were installed to /usr/local/share/perl/5.8.8/auto/Mango. Mango modules files are also installed to /usr/local/share/perl/5.8.8/Mango

When I call ShareDir::dist_dir, I get /usr/local/lib/perl/5.8.8/auto/Mango. Nothing of Mango is installed there.

When I call ShareDir::module_dir, I get /usr/local/share/perl/5.8.8/auto/Mango.

I'm pretty sure at this point that where the files are installed by M::I::Share is correct.

The pod for dist_dir and module_dir both say the same thing:

The dist_dir function takes a single parameter of the name of an installed (CPAN or otherwise) distribution, and locates the shared data directory created at install time for it.

Now, I could just use module_dir instead of dist_dir in my code. The question is, will that always work? Or do I just have screwy expectations that the pod doesn't clarify?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Based on nothing more than looking at the code for 30 seconds I'd say use module_dir as it seems to depend of the path to a loaded copy of the module in question instead of directories existing. Plus the module name is fairly stable but the distro name changes every release so it is one extra thing to keep in sync.