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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:27:25+00:00 2026-05-17T17:27:25+00:00

I am developing a suite of Perl scripts and modules that then get deployed

  • 0

I am developing a suite of Perl scripts and modules that then get deployed on different machines and systems round our company.
Some facilities are dependent on a particular module which may or may not be installed on different machines. I have used ‘eval’ to detect whether or not this module is available.

I’ve just had a fault report which came down to the fact that the user had not successfully installed the module on his machine (but didn’t realise that he hadn’t): but the bug in my code was that I did not, in this case, pass the error condition up to the top level, so it was getting lost, and the script was just silently failing to perform part of its function.

In order to investigate it, I disabled the particular module on my machine, and easily found and fixed the problem. But the only way I could think of to disable it, short of uninstalling it, was to rename the file (which I had to do via sudo, of course).

I am now running all of my tests with this module unavailable, and it has thrown up a few other places where I am not handling the situation properly.

But what I now want to do is to write some tests for this condition: but how can I sensibly make this module unavailable temporarily within an automatic test. I really don’t want my tests using sudo to move modules out the way (I may be doing other things on the machine at the same time).

Does anybody know a way that I can tell Perl “Do not find this module, wherever I try to ‘use’ or ‘require’ it from, for testing purposes”?

I’m running Perl 5.10.0 (on Fedora 12), and using Test::More and TAP::Harness. Some of our installations are running Perl 5.8, so I am willing to use 5.10 features in testing, but not in the code itself.

  • 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-17T17:27:25+00:00Added an answer on May 17, 2026 at 5:27 pm

    There’s a couple of CPAN modules doing just that. The one I often use is Test::Without::Module. Another one would be Devel::Hide. Those two, and a few others whose names I can’t quite remember right now, all work pretty much the same way, by hooking into perl’s module loading through either @INC, or CORE::GLOBAL::require. The details of that are documented in perldoc -f require.

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

Sidebar

Related Questions

I am developing a site and that that is managed by two. one is
I am developing a new module for a large Application in Delphi 2010. I
I am developing an application handling CTRL - C . I am producing a
Lets say; I am developing a Web Application which talks to a RESTful web
I am currently developing a site which requires a print option on the page.
Hi I am developing a site based on Joomla 1.5 and I wanted to
I'm developing a site where you are not allowed to login on multiple accounts
I am developing a site in asp.net mvc 2.0 .Here i want to send
In my app, I'm subclassing QApplication to do a lot of things, like centralized

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.