Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I'd like to know if there's an official way to do this too. In the mean time, here's what I did.

    I package the files like this:
    lib/My/Module.pm
           /Module/my_data_file
    cpan installs that just fine, and I can get at it from my module by mucking around with my entry in %INC. The last bit is ugly though, and I'd like to know how to improve it.

    Here's the code I use to find my data file:
        my $datafile_path = $INC{'My/Module.pm'};
        $datafile_path =~ s!\.pm$!!;
        $datafile_path .= '/my_data_file';
    It looks and feels like a hack, but it worked for me.