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 6214299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:51:09+00:00 2026-05-24T06:51:09+00:00

I want to distribute my Perl application which have one CPAN dependency. Can I

  • 0

I want to distribute my Perl application which have one CPAN dependency. Can I include a check for this dependency when somebody starts the application. Through command line argument or inside perl directly?

  • 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-24T06:51:09+00:00Added an answer on May 24, 2026 at 6:51 am

    Is this a pure Perl module with no other dependencies?

    I’d just package it with my code. Heck, you can even just append it to your file, if you prefer.

    If this is a bit more complex, that is, there are a dozen of required modules that must be installed, and there is some compilation that is required, you’ll have to use CPAN to download it. There is a CPAN::AutoINC which is suppose to download and install any modules you need from CPAN when the module is required and not in the @INC path.

    However, my experience has been that you end up with a mess ‘o worms. A user might start to run your program thinking it’ll run for a a minute only to discover that they’re spending 20 minutes downloading, compiling, and testing prerequisite modules when they really don’t have time.

    It’s better just to fail, and give a good explanation of what is required. The user might prefer to run cpan as root, so it’s available for everyone on the machine. Or, maybe they need to ask a system admin to do it for them.

    I’ve found I can do something like this:

    our $missingModuleFlag;
    
    BEGIN {
      eval { require My::Mod; };
      our $missingModuleFlag = $@ if ($@);
    }
    
    [...]
    
    our $missingModuleFlag;   #Package Variable -- Value is from above
    if ($missingModuleFlag) {
       die <<EOM;
    ERROR: You are missing module "My::Mod" which is required for
        this program. Please use "cpan" to download this module
        and install it on this server. If you have no idea what
        I am talking about, see http://www.cpan.org/modules/INSTALL.html.
        If that doesn't make any sense to you, then ask a system administrator.
    EOM
    }
    

    It explains what is the issue, and what needs to be done and gives the user a choice to either go ahead with the install, or ask someone else to do it for them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to distribute my application to .ipa file which can be added by
I have this Java application which uses a MySql Database which I want to
I have an sqlite database I want to distribute with my application. It's about
I have this perl script that I need to distribute to my coworkers who
I have a bunch of scripts which I want to refactor into modules. This
I have a product database which I want to distribute to an iphone user
I want to distribute a webstart application which uses RMI. I want to avoid
I want to distribute a Java desktop application for Windows. Which is the best
I have a list of email address which I want to distribute evenly by
I have a program that I want to distribute, without giving the source code

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.