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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:27:58+00:00 2026-05-31T01:27:58+00:00

I’m writing a test script for a library I’ve written, and as part of

  • 0

I’m writing a test script for a library I’ve written, and as part of the test I’m clearing the $ENV{PATH} variable to make sure that things I’ve put in my path don’t cause successes. The library appends the needed paths to the PATH variable.

For background, I’m running Strawberry Perl v5.12.0 on 32-bit Windows XP. IPC::Cmd is at version 0.76 and IPC::Open3 is at version 1.05.

The error that I’m seeing is if I clear the PATH variable and then set it, IPC::Cmd using IPC::Open3 does not find the application. If I don’t do this, then it’ll run fine. Here’s an example script that illustrates this error:

use strict;
use warnings;
use IPC::Cmd qw(run);

$ENV{PATH} = '';
$ENV{PATH} = 'c:\\strawberry\\perl\\bin';

my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) =
    run(command => 'perl -v', verbose => 0);

if ($success) {

    print 'Success: ';
    print join("\n", @{$stdout_buf});
} else {

    print 'Failure: ';
    print join("\n", @{$full_buf});
}
exit 0;

If I run it like this, it prints the failure line, and if I run it with the two $ENV{PATH} = commented out then it prints the success line. I’ve tried mucking around with the second PATH line by changing the slashes and adding slashes at the end, but this does no good.

I’ve run this through a debugger, and the failure occurs on line 398 in IPC::Open3:
$pid = eval { system 1, @_ }; # 1 == P_NOWAIT. If I check $! after this line, it tells me ‘No such file or directory’. The PATH is still set correctly at this point, it’s not getting altered at any point.

One other odd point, I’ve tried using can_run method from IPC::Cmd after resetting the PATH, and it’ll find the command with no problem.

Before submitting a bug report for this, has anyone seen this and know how to fix it? Also, for what I’m trying to do, is this the correct way, or is there a better way to reset the PATH variable for testing?

  • 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-31T01:28:00+00:00Added an answer on May 31, 2026 at 1:28 am

    The issue here is that Windows requires %windir%\system32 in the PATH env variable as well. Adding this, and ‘c:\strawberry\perl\bin’ resolved the issue.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.