AnnoCPAN
view release on metacpan or search on metacpan
lib/AnnoCPAN/DBI.pm view on Meta::CPAN
}
my $html = $self->{parser}->$method(@args);
}
sub before_delete {
my ($self) = @_;
# make sure no notes use us as their reference section...
for my $note ($self->original_notes) {
my $max_sim = 0;
my $best_sect;
for my $notepos ($note->notepos) {
if ($notepos->section->id != $self->id
and $notepos->score > $max_sim)
{
$max_sim = $notepos->score;
$best_sect = $notepos->section;
}
}
$note->section($best_sect);
$note->update;
}
}
=head2 AnnoCPAN::DBI::User
Represents an AnnoCPAN user. Columns:
id
username
lib/AnnoCPAN/DBI.pm view on Meta::CPAN
my ($self, $podver) = @_;
# delete cached html
$podver->flush_cache;
# XXX version check might go here
my $ref_section = $self->section or return;
my $orig_cont = $ref_section->content;
my $max_sim = AnnoCPAN::Config->option('min_similarity') || 0;
my $best_sect;
for my $sect ($podver->raw_sections) {
next if $sect->{type} & COMMAND; # can't attach notes to commands
my $sim = similarity($orig_cont, $sect->{content}, $max_sim);
if ($sim > $max_sim) {
$max_sim = $sim;
$best_sect = $sect;
}
}
if ($best_sect) {
AnnoCPAN::DBI::NotePos->create({ note => $self,
section => $best_sect->{id}, score => int($max_sim * SCALE),
status => CALCULATED });
return 1;
}
return;
}
sub update {
my $self = shift;
for my $pv ($self->pod->podvers) {
$pv->flush_cache;
( run in 1.011 second using v1.01-cache-2.11-cpan-4e96b696675 )