Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 695
  • Last Modified:

Can't Call Method

Trying to install this PERL app on my Win32 box.  Some of you may have heard of it, its called ASSP.

Anyhow, I am no PERL developer.  When I run this command at command prompt I am presented with this error:

Can't Call Method "GetValue" on an undefined value

Errors out on this line:
$ENV{HTTP_proxy} = $rkey->GetValue( "ProxyServer" );
if (-e "$asspdir\\assp.cfg") {
        print "reading proxy settings from assp.cfg\n";
        open(CFG,"<$asspdir\\assp.cfg"); local $/; (%Config)=split(/:=|\n/,<CFG>); close CFG;
        $ENV{HTTP_proxy} = $Config{proxyserver} if ($Config{proxyserver} && ! $ENV{HTTP_proxy});
    } else {
        if ($^O eq "MSWin32" && ! $ENV{HTTP_proxy}) {
            my $rkey;
            my $Registry;
            print "reading IE proxy settings from windows-registry\n";
            eval("use Win32::TieRegistry ( Delimiter=>'/', ArrayValues=>1 );");
            $rkey=$Registry->{'CUser/Software/Microsoft/Windows/CurrentVersion/Internet Settings'};
            if (unpack("N", pack("H8", substr($rkey->GetValue( "ProxyEnable" ), -8)))) {
                $ENV{HTTP_proxy} = $rkey->GetValue( "ProxyServer" );
            }
        }
    }

Open in new window

0
chrisryhal
Asked:
chrisryhal
  • 5
  • 3
  • 2
1 Solution
 
ozoCommented:
that would suggest that
   $Registry->{'CUser/Software/Microsoft/Windows/CurrentVersion/Internet Settings'}
returned undef
but then $rkey->GetValue( "ProxyEnable" ) should have given an error
0
 
chrisryhalAuthor Commented:
Your probably correct, my count of lines was incorrect.  Any ideas what may be throwing this?
0
 
chrisryhalAuthor Commented:
If it helps and if this is what I am thinking, I do not have a proxy setup on this server nor is anything running through proxy.  Its pretty much a virgin server at this point.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ozoCommented:
do you define $Registry anywhere?
0
 
chrisryhalAuthor Commented:
I have no idea what that is.  This script is in its raw from the developer, so I guess the answer might be no?
0
 
lwadwellCommented:
Hi chrisryhal,

Just to double check, do you have the package Win32::TieRegistry installed as part of your perl setup?  This package is setting up the $Registry variable - it contains a tie to your registry values.

Do you have the 'ProxyEnable' in your registry? (within HKEY_CURRENT_USER->Software/Microsoft/Windows/CurrentVersion/Internet Settings)

lwadwell
0
 
chrisryhalAuthor Commented:
TieRegistery is not installed.  Should I install it?  I can do so.
0
 
lwadwellCommented:
chrisryhal,

Two choices ...
1. Yes, install it.
2. Set up an environment variable called HTTP_proxy to contain your proxy server details (if any) and it will be used in preference to getting it from your registry (if ($^O eq "MSWin32" && ! $ENV{HTTP_proxy})).

lwadwell
0
 
chrisryhalAuthor Commented:
I'm using the ActivePerl latest build which is 5.10.  Appears that Win32-Http_Proxy was already installed and configured using the Perl Package Manager.   So I'm good there.

When creating the Windows Environmental Variable what should I make the default value since I have no proxy?  If I just leave it blank, it doesn't appear to save.
0
 
lwadwellCommented:
Hi,

By ASSP do you mean Anti-Spam SMTP Proxy (ASSP) Server?  I had a look through its code and could not find the code you supplied above.  

Anyway ... my reading of the code above is ...

1. Line below checks if a config file exists ... if so, use it.  If not, continue to step 2 below. Q. do you have a config file?  How is the variable $asspdir being set to point to its location?  
if (-e "$asspdir\\assp.cfg") { ##

2. Line below tests if this in a Win32 machins and if the env variable HTTP_proxy does not exist.  If the env variable exists it will already be in $ENV.  If not, continue to step 3 below.  As you cannot store a 'blank' value I do not know what would be a valid alternative (... perhaps 'localhost' or the machines IP ... or even a single space char ... not sure).
        if ($^O eq "MSWin32" && ! $ENV{HTTP_proxy}) {

3. The lnes below will use the perl package Win32-TieRegistry to obtain the proxy values from the Internet Explorer proxy settings from the registry.
            my $rkey;
            my $Registry;
            print "reading IE proxy settings from windows-registry\n";
            eval("use Win32::TieRegistry ( Delimiter=>'/', ArrayValues=>1 );");
            $rkey=$Registry->{'CUser/Software/Microsoft/Windows/CurrentVersion/Internet Settings'};
            if (unpack("N", pack("H8", substr($rkey->GetValue( "ProxyEnable" ), -8)))) {
                $ENV{HTTP_proxy} = $rkey->GetValue( "ProxyServer" );

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now