On Fri, Jun 01, 2001 at 10:45:31AM -0500, David Michael wrote:
> I am trying to use a package to hold all of my subs. I am calling the package in my 
>main program:
>     use control;

You should be aware that all lowercase module names are reserved for Perl
pragmas.  This is not the source of your problem, nor would this name break
anything, but it could be potentially confusing, and sometime in the future
there may actually be a control pragma for Perl.


>     <!--StartFragment-->
>     sub memUserInfo {
>        my $user = shift;
>        dbmopen %PROXY, "$proxy", 0666 or die "Can't open proxy: $!\n";

>           my %PROXYINFO = "";
            ^^^^^^^^^^^^^^^^^^^
This is suspicious.  You're creating a hash key, "", with an undef value. 
The fact that you haven't noticed it tells me you're either ignoring the
warning it produces (either mentally, or with a no warnings pragma
somewhere), or haven't invoked your script with -w.  Please add a
-w and use strict to your program, it will help your debugging immensely.

Oh, and change it to simply "my %PROXYINFO;".

For example, in your script:

    #!/usr/bin/perl -w

    use control;
    use strict;

and in control.pm

    package control;
    use strict;


>           foreach $pair (split /\n/m, $PROXY{$user}) {
>              my($one,$two) = split(/:/,$pair);
>              $two = trim($two);
>              $PROXYINFO{$one} = $two;
>           }

Your my declaration and foreach are indented oddly.  Did you omit some
encapsulating block, or is this just your indention style?


>        dbmclose %PROXY;
>    
>        return %PROXYINFO;
>     }
> 
> It doesn't return a value. The calling is done from the program, and the
> routine is in control.pm. Any help would be appreciated. Thanks

How are you verifying it doesn't return a value?  At the very least,
%USERINFO should end up with one hash key, "".  The subroutine may very well
not be returning any data if there is no data in the DBM file to split and
return.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to