Whats important to note is that the warning comes with a line number, which you can use to investigate (it should give away which variable caused it)

As I said in my orginal post I suspect there is action-at-a-distance going on. The real culprit is in one place but the bug is manifesting with respect to another variable that's getting accidently aliased.

When I run the code (which is in a module) in a standalone CGI script it doesn't give warnings. When I run the code under Apache::Registry then it starts giving warnings in many unrealated places after a few transactions.

Here is an example of one of the places where it's giving a warning.

for my $field ( @$self{@{$_{FIELDS}}} ) { $field->set_related(AFTER => \@keys ); $field->{MULTI} = 1 if $_{MULTICODE} && ! exists $field->{MUL +TI}; $field->{ORDERED} = 1 if $_{ORDER} && ! exists $field->{ORDERE +D}; $field->{CONTEXT_KEYS} = $_{CONTEXT_KEYS} if $_{CONTEXT_KEYS} +&& ! exists $field->{CONTEXT_KEYS}; if ( $table ) { $field->{TABLE} = $table unless exists $field->{TABLE}; $field->{COLUMN} = $fieldmap->{$field} || "$field" unless exists $field->{COLUMN}; } } if ( $structured_field ) { # Warning here! $fieldmap = {%$fieldmap}; my @pseudo_fields = map { @$_ } values %$structured_field; @$fieldmap{@pseudo_fields} = map { [ $fieldmap->{$_} || $_ ] } + @pseudo_fields; }

As you see the line where the warning appears has no buisness unreferencing any scalars. The variable  $structured_field is, by the way, undef.

The perhaps interesting thing is that the variables $self and $field are not a blessed hashes but rather are objects that overload '%{}'. Furthermore the '%{}' overload on $self is done via a transitory tied hash...

use overload '%{}' => sub { my $self = shift; tie my(%h), $self; \%h }; sub TIEHASH { shift }

UPDATE Replacing the transitory tied hash with a persistant one did not fix the problem.


In reply to Re^2: Mark-and-sweep-like mechanism to verify refcount integrity by nobull
in thread Mark-and-sweep-like mechanism to verify refcount integrity by nobull

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.