Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3274302
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:01:22+00:00 2026-05-17T19:01:22+00:00

I have written a small perl application for deployment on a few servers. It

  • 0

I have written a small perl application for deployment on a few servers. It consists of some scripts, some modules and some data files. It will be used by multiple users. I’d like to keep all these files together in one directory rather than moving the app modules to the site_perl directory.

For example, lets say the application consists of jump.pl swim.pl Common.pm and messages.txt

The application (either of jump.pl or swim.pl) will be invoked from another directory. The installation location of the application may not be on $PATH so the user (or another app) might invoke it by an absolute pathname such as /some/path/swim.pl or a relative pathname such as ../path/swim.pl

I’d like relocating the application to be as simple as possible, this means having the path to the application in as few places as possible.

At the moment swim.pl and jump.pl start like this

#!/usr/bin/perl
use strict;
use warnings;
use lib '/some/path';
use Common;
#
my $basedir = '/some/path';
...
open my $fh, '<', "$basedir/messages.txt" or die ... ;

So I have /some/path in several locations in several scripts and modules.

I’ve considered the following as possible means to minimise the number of different places to store /some/path

  • Set environment variable PERL5LIB=/some/path and do
    open my $fh, '<', "$ENV{PERL5LIB}/messages.txt"
  • Set the shebang line to #!/usr/bin/perl -I/some/path – but then how find messages.txt?
  • Try use Cwd qw(abs_path);
    and find a way to use basename abs_path($0) for use lib in BEGIN?

Any suggestions to maximise flexibility of location, keep everything together, minimise multiple hard-coding of installation location?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T19:01:23+00:00Added an answer on May 17, 2026 at 7:01 pm

    FindBin:

    use FindBin qw( $Bin );
    use File::Spec::Functions qw( catfile updir );
    use lib catfile( updir($Bin), 'lib');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a small android app that grabs some data and displays it
I have written a small Perl script and now I would like to create
I have written a small java application for which I need to obtain performance
I have a small AJAX application, written in PHP that I did not secure
I have written some code in my VB.NET application to send an HTML e-mail
I have written a small script in Perl which I am executing on Windows
I am having some strange problem. I have written a small module in VC++
I have a small linux vps. I have written a Java client application, which
As a Christmas gift I have written a small program in Java to calculate
In Ruby I have often written a number of small classes, and had a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.