in reply to $ENV{HTTPS_PROXY} works in one environment but not another

Are you using use strict; and use warnings;? Do they output anything? Does anything output anything prior to the hang? Have you tried putting print statements around what you believe is the problematic code to see what is going on? What OSs are we talking about here?

Please provide us some code to look at. Also, after you've ensured strict, warnings are in effect (to rule out anything silly, like an undefined variable), put a line like this: $DB::single = 1; directly above the code that you think is hanging, then on the command line, run your script with perl -d script.pl. This will open the debugger. Press c to 'continue' to the line that you put $DB::single = 1; on. Next, press s. This will 'step' through each line, and display the actual line of code prior to executing it. Keep hitting s until you have it hang, then post the lines of code just prior to it breaking.

Replies are listed 'Best First'.
Re^2: $ENV{HTTPS_PROXY} works in one environment but not another
by bigdatageek (Novice) on Sep 29, 2015 at 15:02 UTC

    Thanks! Yes I used the print trick prior to my post, but forgot to mention that is how I figured out where it is hanging. Also, yes I am using strict/warnings. I get a timeout error: Could not login to SFDC: 500 Can't connect to www.salesforce.com:443 (timeout)

    The server where it works: Red Hat Enterprise Linux Server release 6.7

    The server where it doesn't work: Red Hat Enterprise Linux Server release 5.11

    Here is the code:

    #!/usr/bin/perl use strict; use warnings; use Storable; use POSIX qw(strftime); # Parameter/host file require "host.pl"; # Environment Proxy our $http_proxyurl; our $http_proxyprt; $ENV{HTTPS_PROXY} = $http_proxyurl . ':' . $http_proxyprt; use WWW::Salesforce; our $sfdc_username; our $sfdc_password; our $sfdc_secrtokn; our $sfdc_instance; our $sfdc_soap_url; our $sfdc_versnnum; our $oper_emailadd; my $sfdc_loginatt = eval { WWW::Salesforce->login( username => $sfdc_username, password => $sfdc_password.$sfdc_s +ecrtokn, serverurl=> 'https://' . $sfdc_ins +tance . '.' . $sfdc_soap_url . $sfdc_versnnum ); }; if ($@) { warn "Could not login to SFDC: $@"; die; };

Re^2: $ENV{HTTPS_PROXY} works in one environment but not another
by bigdatageek (Novice) on Sep 29, 2015 at 15:11 UTC
    I'm trying the debug trick but I'm able to keep stepping through every step and can't see where it might be hanging

      I'd first run strace (or the local equivalent) to see what it is doing when it hangs. That might lead me to getting a packet capture. If either of those seem to show that the Perl code is doing something wrong, then you could turn on debugger trace (to a file; see AutoTrace in perldebug) and just let it run and, after a while, check if it has been looping or was sitting waiting for something, and where.

      - tye        

        Thanks for sticking with me, I did the autotrace debug. What is weird is that it skips right over the part that hangs...

        84: close(MAIL); 113: warn "Could not login to SFDC: $@"; 114: die;
        Line 84 is the end of a subroutine that I use for mailing errors to an Operations team. Then line 113 is the error message when the login fails. There is no info in between those two items.