[Pdx-pm] Odd Test Failures

Eric Wilhelm scratchcomputing at gmail.com
Thu Aug 14 01:37:11 PDT 2008


# from Jonathan Leto
# on Thursday 14 August 2008 00:38:

>Not an ARRAY reference at
> /usr/local/lib/perl5/5.10.0/Attribute/Handlers.pm line 185.
>...
>I have no clue what is touching Attribute::Handlers, I do not use it
>directly.

If it is not repeatable every time, I would make a copy of 
Attribute/Handlers.pm and add a croak() at 185 (to replace perl's deref 
error message.)  Unfortunately, mine doesn't seem to have a deref on 
185, but I fear you're running into this unchecked eval not returning 
[$data].

  my $evaled = !$raw && eval("package $pkg; no warnings;
	    local \$SIG{__WARN__}=sub{die}; [$data]");
  $data = ($evaled && $data =~ /^\s*\[/)  ? [$evaled]
	      : ($evaled)			? $evaled
	      :					  [$data];

So, ugh...

  croak('gotcha') if(ref($data) ne 'ARRAY'));

Then run it as many times as it takes to get a stack trace.  (See if you 
get the same trace each time it fails?)

  perl -MCarp=verbose -Iblib/{lib,arch} t/your_test.t

That is, unless there's some way to get a stacktrace from the builtin 
deref error -- which would be nifty.

--Eric
-- 
"It is impossible to make anything foolproof because fools are so 
ingenious."
--Murphy's Second Corollary
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list