/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 402 by dpavlin, Sun Feb 19 13:14:26 2006 UTC revision 403 by dpavlin, Sun Feb 19 18:12:57 2006 UTC
# Line 381  sub record { Line 381  sub record {
381  }  }
382    
383    
384    =head2 list_nodes
385    
386      my @nodes = $m->list_nodes( 'site' );
387    
388    Return all databases which have records for selected site. Returned array of
389    hashes has elements C<name> and C<label>.
390    
391    =cut
392    
393    sub list_nodes {
394            my $self = shift;
395    
396            my $site = shift;
397    
398            $self->{log}->debug("list_nodes use site $site");
399    
400            $self->setup_site( $site );
401    
402            my @nodes;
403    
404            if ($self->{est_node}->doc_num > 0) {
405                    push @nodes, {
406                            name => $self->{est_node}->name,
407                            label => $self->{est_node}->label,
408                    }
409            }
410    
411            # refresh set info
412            $self->{est_node}->_set_info;
413    
414            my $links = $self->{est_node}->links || return @nodes;
415    
416            $self->{log}->dumper( $links, 'links' );
417    
418            foreach my $link (@{ $links }) {
419                    my ($url, $label, $credit) = split(/\t/, $link, 3);
420                    if ($url =~ m#/node/(.+)$#) {
421                            push @nodes, {
422                                    name => $1,
423                                    label => $label,
424                            }
425                    } else {
426                            $self->{log}->warn("can't find node name in link $link");
427                    }
428            }
429    
430            $self->{log}->dumper( \@nodes, 'nodes' );
431    
432            return @nodes;
433    }
434    
435    =cut
436    
437    
438  =head2 save_html  =head2 save_html
439    
440    $m->save_html( '/full/path/to/file', $content );    $m->save_html( '/full/path/to/file', $content );

Legend:
Removed from v.402  
changed lines
  Added in v.403

  ViewVC Help
Powered by ViewVC 1.1.26