[p4perl] P4.pm line 51: Key not a reference!

Tony Smith tony at smee.org
Thu Nov 10 09:05:41 PST 2005


Hi Dimitri,

> While running some Perl scripts based on P4.pm I get such messages:
> Key (depotFile) not a reference! at
> /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/P4.pm line 51.
> Key (rev) not a reference! at
> /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/P4.pm line 51.
>
> I'm not the first to come across this error:
> http://maillist.perforce.com/pipermail/p4perl/2005q2/000099.html
>
> Line 51 looks like this:
>      my $results = $self->_Run( @_ );
>
> So it looks like _Run() returns something that should be a reference but
> is not a reference. I'm not sure how that can happen using plain usual
> Perl. So I guess this happens during the C++-Perl translation. I'm not
> aware of the C++-Perl translation internals, all I could find is:
>  $ nm -C i386-linux-thread-multi/auto/P4/P4.so | fgrep _Run
>  0002c238 T XS_P4__Run(interpreter*, cv*)
>  $
> I understand some magic is done by XSLoader that in turn is probably
> called by DynaLoader.
>
> Does anyone have a clue? How serious is this? If it's not serious, how
> to avoid the error message? How does XSLoader tell that _Run() should
> return a reference?

It depends which build of P4Perl you're using (you don't say), but if it's the 
same problem as the original poster then I fixed it back in June:

http://maillist.perforce.com/pipermail/p4perl/2005q2/000105.html

3.4987 Fri Jun 03 2005

 - Bug fix for tagged mode output from 'p4 diff2'. Diff2 is one of
   the few (only?) commands to use variables of the form 'var' and
   'var2' rather than 'var1' and 'var2'. Normally, if there's no
   numeric suffix to a variable, P4Perl can assume it's looking at
   the only instance of that variable in the output. In the case of
   'p4 diff2', that's not true.
 
   This change enables P4Perl to adapt to this change of circumstances
   and convert a previously scalar member of the hash result into an
   array member.

Could that be it? It was specific to 'p4 diff2' so if you're getting the error 
on some other command, then it's likely to have a different root cause.

If that's the problem, then grabbing a build later than 3.4987 (i.e. the 
latest development build) should solve the problem. 

Regards,

Tony


More information about the p4perl mailing list