Tobias,

On Thu, 5 Apr 2007, Tobias Regneri wrote:
Robert Landrum wrote:
I would use Data::Dumper; warn(Dumper([EMAIL PROTECTED])); and see what's in 
the logs.
(eval): MyProvider MyGroup attrList=HASH(0x517834)
$VAR1 = \'MyProvider';
$VAR1 = \'MyGroup';
$VAR1 = \bless( {
                  'listItem' => [
                                bless( {
                                         'attrVal' => 'Wert1',
                                         'attrName' => 'Attribute1'
                                       }, 'attrItem' ),
                                bless( {
                                         'attrVal' => 'Wert2',
                                         'attrName' => 'Attribute2'
                                       }, 'attrItem' )
                              ]
                }, 'attrList' );
...
to access the third value (see first line -> attrList=HASH(...))
I only retrieve an empty hash.

The hash with name attrList contains the key listItem with an anonymous
array as value. The array itself contains two hashes each with the two
keys attrVal and attrName.

That looks pretty much accurate to me, except that the top level is a blessed hash reference of type attrList. If you're getting an empty hash, perhaps it's TIEed somehow to prevent you from accessing the fields directly - not sure if Dumper shows this?

You might want to look at attrList and attrItem classes to see if there are any accessors you can invoke?

A quick test might be to change warn([EMAIL PROTECTED]) to:
warn($_[2]->{listItem}->[0]->{attrVal})  and see if you get 'Wert1'?

I haven't followed the thread, however, you can then do something like:

sub getStuff{
        my $attrList = shift;
        my $listItems = $attrList->{listItem};
        foreach my $attrItem (@$listItems) {
                my $attrName = $attrItem->{attrName};
                my $attrVal = $attrItem->{attrVal};
                ## do whatever
        }
}

And then call:

getStuff($foo) where $foo is your previous $_[2];

Hope that this helps in some form?

Raf

Reply via email to