note
Lady_Aleena
<p>Hi. I know it has been almost two months since I asked this, but I got frustrated then, so decided to let this sit for a while. So now I have calmed down a bit, I can dig in.</p>
<p>So, today I decided to give File::ShareDir a go on the command line, and I got the answer I was looking for initially. The main directory for external files a module needs is <c>lib/auto</c>. So now I know where to put the external data files and can use File::ShareDir to hopefully get them. I have <i>not</i> tried this yet but will shortly. Here is what I <i>think</i> the top of my module will look like, in this case I am using one of my favorites, <c>Random::Color</c>.</p>
<code>
package Random::Color;
use v5.10.0;
use strict;
use warnings;
use Exporter qw(import);
use File::ShareDir qw(module_dir);
use Fancy::Rand qw(fancy_rand);
use Fancy::Open qw(fancy_open);
our $VERSION = '1.000';
our @EXPORT_OK = qw(random_color);
my $directory = module_dir('Random::Color');
my @Crayola_crayons = fancy_open("$directory/Crayola_crayon_colors.txt");;
my @MandMs = fancy_open("$directory/MandMs_colors.txt");
</code>
<p>Also, I am assuming when I go to package <c>Random::Color</c> the file list inside the package will be something like this.</p>
<ul>
<li>Random-Color
<ul>
<li>Changes</li>
<li>ignore.txt</li>
<li>Makefile.PL</li>
<li>MANIFEST</li>
<li>README</li>
<li>lib
<ul>
<li>auto
<ul>
<li>Random
<ul>
<li>Color
<ul>
<li>Crayola_crayon_colors.txt</li>
<li>MandMs_colors.txt</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Random
<ul>
<li>Color.pm</li>
<li>Color.pod</li>
</ul>
</li>
</ul>
</li>
<li>t
<ul>
<li>00-load.t</li>
<li>manifest.t</li>
<li>pod-coverage.t</li>
<li>pod.t</li>
</ul>
</li>
<li>xt
<ul>
<li>boilerplate.t</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Am I on the right track here? I got the base of this structure from [href://https://github.com/LorenzoTa/step-by-step-tutorial-on-perl-module-creation-with-tests-and-git/blob/master/tutorial/tutorial-english.md#dayonestep2|Discipulus's tutorial].</p>
<p>As an aside, I finally started using git because of that tutorial. How to use git was explained very well there. I am so very grateful for it!</p>
<p><b>Update:</b> I tried it, it works as expected, I'm happy! Thank you for the recommendation.</p>
<div class="pmsig"><div class="pmsig-161890">
<p><small>My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.</small></p>
<div><strong>No matter how hysterical I get, my problems are <em>not</em> time sensitive. So, relax, have a [id://1026423|cookie], and a very nice day!</strong></div>
<div><em>Lady Aleena</em></div>
</div></div>
11118780
11118781