http://qs321.pair.com?node_id=1127811

ali0sha has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create an application which uses a manifest.xml. Now in order to access this both while developing and using it, we can use File::Share as recommended in Using File::ShareDir in development, but I also want to be able to access it when it's packaged using PerlApp. Is my only recourse something like this? It seems inelegant, to say the least...

use FindBin '$Bin'; use File::Share 'dist_dir'; my $result; # Get the version bound by PerlApp $result = PerlApp::extract_bound_file("manifest.xml") if defined $PerlApp::VERSION; # Get the distribution's shared files directory $result ||= dist_dir('App-SFDC', 'manifest.xml');

Replies are listed 'Best First'.
Re: Using File::Share and PerlApp (elegance)
by Anonymous Monk on May 26, 2015 at 21:50 UTC

    Is my only recourse something like this? It seems inelegant, to say the least...

    First get something that works, because good enough should be your goal, it works for nature :)

    Also, elegance is easy , just hide the inelegance

    use MyPappyShare qw/ dist_dir /; my $result = dist_dir('App-SFDC', 'manifest.xml');