TreePath

 view release on metacpan or  search on metacpan

lib/TreePath.pm  view on Meta::CPAN


# ex : search_path(/A/B/C')
#      or search_path(/A/B/C, { by => 'name', source => 'Page'} )
sub search_path {
  my ( $self, $source, $path ) = @_;

  croak "path must be start by '/' !: $!\n" if ( $path !~ m|^/| );

  my $search_key = $self->_get_key_name('search', { source => $source});

  my $nodes = [ split m%/%, $path ];
  $$nodes[0] = '/';

  my $not_found = 0;
  my (@found, @not_found);
  foreach my $node ( @$nodes ) {

    my $result = $self->search({ $search_key => $node, source => $source } );

    if ( ! $not_found && $result ) {
        push(@found, $result);



( run in 0.524 second using v1.01-cache-2.11-cpan-71847e10f99 )