If you DO need an XML Schema, you need File::ShareDir 0.01

Alias on 2005-12-12T10:53:43

So having decided to use XML for World Domination Plan #6, I of course need to use an XML Schema. And unlike on commercial projects, I don't have the option of NOT using the "standard" Perl installation mechanisms.

So of course, now I have to fix those as well, because it would appear that there is no sane, standard way to install a shared read-only resource file to the filesystem and find it later.

Except of course there IS, it's just that nobody seems to have thought to make it easy enough to use that people might actually find it.

This is a two part problem. Firstly, getting it installed.

The new Module::Install 0.43 will contain an install_share command.

If your distribution has a directory called share in it, the command will install the share directory to the appropriate place on the filesystem. It's the teensiest bit evil so I won't explain it, but suffice it to say it works everywhere and several code modules depend on it. So it works.

Once you have used install_share to install the files, you need to use the new File::ShareDir to find them.

Like File::HomeDir, File::ShareDir will do the little bit of master-level obscure work for you, so all you need to do is something like this.

my $schema_file = File::ShareDir::module_file('Schema.xsd');

My understanding of the mechanism isn't entirely perfect yet, so File::ShareDir might need a few more releases before it covers all cases, but at least now maybe we can get away from this insane practice of embedding fonts and other files in modules as 1.5meg Data::Dumper structs, simply because the shared file mechanism is so obscure only a master-level Unix administrator can work out how to use it.