[Melbourne-pm] Bug in "B"

Alfie John alfiejohn at gmail.com
Sat Jul 24 23:05:01 PDT 2010


Hey,

On Sun, Jul 25, 2010 at 1:23 PM, Mathew Robertson <
mathew.blair.robertson at gmail.com> wrote:

>
>> I have found a bug in B->walksymtable...  Someone here is more likely to
>>> get a patch submitted than I ever will... :)
>>>
>>
>> Submit a patch if you have found a bug. Perl is a meritocracy, not a
>> cabal.
>>
>
> Indeed.  I have had good and bad experiences submitting patches to various
> free-software projects... so I'm a little weary of making an effort that get
> punished.
>

Same here. However each time I've had a patch rejected, upon further
reflection it did seem I assumed the wrong thing. In one case, it was a
documentation bug which caused me to assume the wrong thing. The
documentation was patched instead of the buggy code :)

Separate to that, the main issue is that I first need to subscribe to some
> list just to submit something, and have done so previously.... I just
> figured someone here might already be subscribed to an appropriate list.
>

I think by doing so allows reasoning of the patch to ferment and hopefully
lead to a discussion. Otherwise, little discussion and quick commits could
lead to bad decisions such as backslashes being a nameseperator ;p

 I have provided an example implementation which provides support for
>>> blessed arrays, but am unsure how to walk other blessed types...
>>>
>>
>> Your code looks correct, but I think that's not the purpose of
>> walksymtable(). I was under the impression that *all* symbol tables were
>> hashes. I've never seen array based symbol tables let alone scalars.
>>
>
> That is an interesting comment.  Indeed a function name with "walksymtable"
> would imply some sort of key-value list, which is part of a symbol-table of
> an object.
>

I think that's where you understanding could be incorrect. I think when it
talks about symbol tables, it doesn't talk about the generic idea of symbol
tables. It's actually talking about Perl's definitive symbol table. In other
words, the first param needs to be of the form "\%PACKAGE::".

If you still want to use walksymtable() with objects such as array-based
objects, inside-out objects etc, you could do something like the following:

  my $arrayob = ArrayOb->new();
  walksymtable( \%{ (ref $arrayob ) . "::" }, sub { foreach ( @_ ) { print
"\t", $_->NAME,"\n" } }, sub { 0 }, ref( $arrayob) );

Alfie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20100725/da5e4eb7/attachment.html>


More information about the Melbourne-pm mailing list