There are a number of ways to do this. The most simple is:

use strict;
use warnings;

use File::HomeDir;
my $conf_dir = File::Spec->catdir( File::HomeDir->my_home, '.Foo' );

Not that I wish to be a pedant about this, but only so people keep it in mind...

This installer will crash with a non-useful error message if someone tries to install of < 5.006, and has an implicit undeclared (still unresolvable I believe) dependency on File::HomeDir.

(I'll shut up about the whole implicit undeclared unresolvable dependency on Module::Build for a while, given it's now in the core and I've had a good long chat about the issue with Tony.)

So if you use warnings in your Build.PL you should always do it as

use 5.006;
use strict;
use warnings;

As for how to ensure File::HomeDir is installed before you actually know what you dependencies are, well I dunno, but this problem is going to keep coming back and haunting us till MB supports bundling of some kind.

Adam K

Reply via email to