Is there any simple and practical way to include txt files in a module?
This is my problem:
I have a package named Foo::Foo1::Foo2::FooPackageName This reads 3 text files (data sources)
my @files = qw/file1 file2 file3/; foreach my $file (@files) { open( INFILE, '<', './lib/Foo/Foo1/Foo2/' . $file . ".txt" ) or die "$0 : ERROR : could not open file '" . $file . ".txt' : $!\n"; [CODE HERE] }
Now, when I do a perl Makefile.PL, make, make test and make install everything runs fine. (The MANIFEST also includes those 3 files)
Then, I can see the files in the right directory (/usr/lib/etc...)
But, when I try to run some program using that module it complains about not getting the files.
What am I doing wrong or missing here?
---------------- UPDATE -----
Maybe I wasn't clear enough before.
Let me put it this way:
Q1. Is it possible to include txt files (as data sources) inside a Perl package? (not to dump the contents as some kind of variables; the idea is to keep those files intact)
Q2. How do I do that in a portable way? this is, no matter what system is running the module, those files are always accessible (probably in the same directory where the module is)
------------------ UPDATE -----
Miguel
In reply to Including text files in Modules by Miguel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |