--- On Mon, 10/5/09, Steve Cookson <steve.cook...@sca-uk.com> wrote:

> From: Steve Cookson <steve.cook...@sca-uk.com>
> Subject: wxWidgets Object Model
> To: wxperl-users@perl.org
> Date: Monday, October 5, 2009, 11:21 AM
> Hi All,
> 
> Is there some way I can cycle through the object model of
> the object
> we all know and love as '$self'?
> 
> I've tried using:
> 
>     my %loc_array = $self;
>     while ( (my $k,my $v) = each %loc_array
> ) {
>             print "$k =>
> $v\n";
>         }
> 
> But I just get one entry.  Does anyone have any other
> ideas?
>  
> Regards
> 
> Steve
> 
> WX      : 2.8.7 (I think)
> OS      : XP SP3
> COMPILER: wxPerl
> 
> 

I do not know the specifics of wxWidgets and Perl bindings, but typically
$self is a hash reference, not a hash.

So, try this:

warn "\$self=$self"; # make sure it's a HASH reference

while((my $k, my $v) = each(%{$self}))
  {
  warn "\$k=$k => \$v=$v";
  }


Regards,
  Sergei.



Reply via email to