Jozef Kutej <jo...@kutej.net> wrote:

>>   Part of the application is a rather huge SQLite database
>> that gets generated from text data before installation. In a

> so every time there is a new "text data" you want to ship a new package
> to install, right?

It's rather the other way round: My application should nor-
mally connect directly to an online database; but if the
link is severed, for local development and for regression
tests, I need a stable snapshot.

>> standard FHS environment, it should probably end up below
>> /usr/share/$WEBAPP. Module::Build does not seem to provide
>> an option to install data there, so:

> Module::Build does support this. you are free to install any file/folder
> anywhere...

> my $builder = Module::Build->new(
>     ...

>     'db_files' => {
>       'db/sqlite.db' => 'db/sqlite.db'
>     },
>     'install_path' => {
>       'db' => "/usr/share/$WEBAPP"
>     }
> );
> $builder->add_build_element('db');

> assuming that db/sqlite.db is the sqlite file that you want to install
> to /usr/share/$WEBAPP

I must admit that I find the documentation on these options
*very* confusing. Sometimes "*_files" speaks of file exten-
sions, sometimes of directories, sometimes of specific
files, sometimes of "elements", sometimes of "processes".

  Also, the whole train of thought was new to me as an
occasional standard (auto-) make user. For now, my notes say:

1. Some files are copied/created automagically to/in blib.
2. (With App::Build: extra_dirs are copied verbatim.)
3. You can copy/create other files there.
4. Afterwards, all "standard" directories and those expli-
   citly specified by install_path (and with App::Build:
   extra_dirs) are installed without further checking where
   their contents came from.

Interestingly, this works *very* well :-), and the move to
Module::Build was more than worth it in my case.

>>   Where do CPAN modules usually store read-only data? Does
>> someone know of a module that I could use for reference?
>> Also I'm interested in modules using Module::Build with such
>> a generation/transformation step in its Build.PL.

> you can add any additional (non Module::Build) code in Build.PL. depends
> what is enough for you. you can add few lines there that will check if
> db/sqlite.db exists and if not generate it. or you can subclass
> Module::Build and make your transformation during ACTION_build.

IIUC code in Build.PL will only be run when Build is ini-
tially created? Therefore I do not think that would be the
right place.

  I have now subclassed Module::Build and used
process_*_files, and it works for me perfectly. You can have
a look at
<URI:https://svn.toolserver.org/svnroot/timl/wikilint/branches/app-build-branch/Build.PL>.

Tim

Reply via email to