Subject: | Can't call methods in deeply embedded objects |
It seems that the Data::Path notation using method calls are only
possible if the method call is on top of the path declaration. Consider
the following example:
#!/usr/bin/perl
use strict;
use Data::Path;
{
package Foo;
sub new { bless {}, shift }
sub bar { "bar" }
}
{
my $data = Foo->new;
my $dp = Data::Path->new($data);
warn $dp->get("/bar()"); # works
}
{
my $data = { foo => Foo->new };
my $dp = Data::Path->new($data);
warn $dp->get("/foo");
warn $dp->get("/foo/bar()"); # does not work
}
__END__
The first block works fine, but in the second block I get a
"trie to retrieve a key from a no hash value (in key foo)" error.
Regards,
Slaven