[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Diagnostic Error!!



On Wed, 13 Dec 2000 19:32:31 +0000, Amitava Basu wrote:

>it gives an error message of which I could make
>out nothing.

># Odd number of elements in hash list.

This means you must have something that acts a bit like this:

	%hash = (1, 2, 3, 4, 5);

Odds are, that it is some code similar to this:

	sub foo {
		my %hash = @_;
	}
	foo(1, 2, 3);


>File 'LC 2:MacPerl Ä:lib:IO:Socket.pm'; Line 130

Let's see what that line is, shall we?

This is what I see around line 130, in IO:Socket.pm:

	sub new {
	    my($class, %arg) = @_;
	    ...
	}

So your (?) call of the method IO::Socket->new is wrong. Are you passing
an odd number of arguments? Or, are you passing an even number of
arguments, but not using IO::Socket as a method, but as a function call?

If you're not using IO::Socket->new (or new IO::Socket) yourself, then
you must figure out where it gets called from. Odds are that it's in a
library, of which you (indirectly) call a function, and to which your
arguments get passed. So, you have to figure out the call tree.

Add this to your code. Make sure it gets called before the warning is
generated, so put it upfront, or inside a BEGIN block. I hope it proves
helpful.

	$SIG{__WARN__} = sub {
	    print STDERR @_, "Call tree:\n";
	    my $i = 1;
	    {
	         my($p, $file, $line, $sub) = caller($i);
	         last unless defined $p;
	         print STDERR "$file line $line, package $p sub $sub\n";
	         $i++;
	         redo;
	    }
	};

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org