Re: Modules dealing with data files
On Fri, Nov 10, 2006 at 03:05:53PM +0100, David Landgren wrote: Does that sound sane? Does anyone have some pointers on how to deal with the placement of datafiles on the local system with one module, and having the other module know where to find them? Seems pretty sane to me. No, I don't have a great idea on the other part, aside from sticking the data into a .pm file you generate at build time, after __DATA__, and reading it in from there. (don't forget to close the DATA file handle to avoid wasting resources) Nicholas Clark
Re: Modules dealing with data files
I remember having problems with __DATA__ file handle in mod_perl environment. I believe you could only read the file handle once, after which all reads would actually give you back garbage. Just $.02 - Dmitri. On Mon, 2006-11-13 at 06:43 -0500, Nicholas Clark wrote: On Fri, Nov 10, 2006 at 03:05:53PM +0100, David Landgren wrote: Does that sound sane? Does anyone have some pointers on how to deal with the placement of datafiles on the local system with one module, and having the other module know where to find them? Seems pretty sane to me. No, I don't have a great idea on the other part, aside from sticking the data into a .pm file you generate at build time, after __DATA__, and reading it in from there. (don't forget to close the DATA file handle to avoid wasting resources) Nicholas Clark
Re: Modules dealing with data files
On 11/10/06, David Landgren [EMAIL PROTECTED] wrote: I suppose it will default to the site_perl directory if run in batch mode, but interactive installations allow the directory to be specified. OS distribution maintainers may wish to override the default (how? an environment variable à la PERL_G_F_P_PATH=/usr/local/share/doc/insee?) A non-standard installation procedure that runs the package through a transform while installing it, allowing the path to be written into the installed module. Alternately, a .pm interface to the location of the file, just like the .pm interface to the URL of the publicly available data, but generated at install time. package Geography::FR::Postcode::INSEE_FILENOM; sub import { *{caller().'::INSEE_FILENOM'} = sub(){'/usr/local/share/doc/insee'} };1; __END__ You'll have to customize the build and install scripts either way though. -- perl -le'1while(1x++$_)=~/^(11+)\1+$/||print'
Re: Modules dealing with data files
David Nicol wrote: On 11/10/06, David Landgren [EMAIL PROTECTED] wrote: I suppose it will default to the site_perl directory if run in batch mode, but interactive installations allow the directory to be specified. OS distribution maintainers may wish to override the default (how? an environment variable à la PERL_G_F_P_PATH=/usr/local/share/doc/insee?) A non-standard installation procedure that runs the package through a transform while installing it, allowing the path to be written into the installed module. What about Module::Install and File::ShareDir? If the author is OK with bundling the datafile with his module, this seems like the perfect way to do things. There's really no disadvantage to bundling data with the module, because the module won't work without the data, and the code size is probably much less than the data size. (So it's not wasteful to download the code with each data update.) Regards, Jonathan Rockway -- package JAPH;use Catalyst qw/-Debug/;($;=JAPH)-config(name = do { $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //, ;$;]-[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;-setup;