AnnoCPAN
view release on metacpan or search on metacpan
lib/AnnoCPAN/DBI.pm view on Meta::CPAN
# union of all the notes/podvers
push @notes, $self->notes;
push @podvers, $self->podvers;
# boldly translate the notes to where they have never been before
for my $note (@notes) {
for my $podver (@podvers) {
my ($np) = AnnoCPAN::DBI::NotePos->search_podver_note(
$podver, $note);
unless ($np) {
$note->guess_section($podver);
}
}
}
# delete the other pods
$_->delete for @others;
$self;
}
=head2 AnnoCPAN::DBI::PodDist
lib/AnnoCPAN/DBI.pm view on Meta::CPAN
use base 'AnnoCPAN::DBI';
__PACKAGE__->table('distver');
__PACKAGE__->columns(Essential => qw(id dist version path pause_id
distver mtime maturity));
__PACKAGE__->has_a(dist => 'AnnoCPAN::DBI::Dist');
sub translate_notes {
my ($self) = @_;
for my $podver ($self->podvers) {
for my $note ($podver->pod->notes) {
$note->guess_section($podver);
}
}
}
sub count_visible_notes {
my ($self) = @_;
return $self->sql_count_visible_notes->select_val($self->id);
}
__PACKAGE__->set_sql(count_visible_notes => 'SELECT count(*)
lib/AnnoCPAN/DBI.pm view on Meta::CPAN
unless (fork) {
# child process
nice(+19);
close STDIN;
close STDOUT;
close STDERR;
# Now "translate" the note to other versions
my $pod = $data->{pod};
for my $pv ($pod->podvers) {
if ($pv->id != $podver->id) { # note was not added here
$note->guess_section($pv);
}
}
exit;
}
return $note; # only parent returns
}
sub simple_create { shift->SUPER::create(@_) }
sub simple_update { shift->SUPER::update(@_) }
sub guess_section {
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;
lib/AnnoCPAN/Dist.pm view on Meta::CPAN
Currently the only option is 'verbose'; if true, various diagnostic messages
are printed to STDOUT and STDERR when extracting the file.
=cut
sub new {
my ($class, $fname, %options) = @_;
return unless $fname =~ m{(authors/id/.*)};
my $rel_pathname = $1;
# let CPAN::DistnameInfo do the guessing
my $self = $class->SUPER::new($fname);
$self->{verbose} = $options{verbose};
$self->{rel_pathname} = $rel_pathname;
# XXX should make sure we like the filename...
$self;
}
=item $obj->archive
tt/faq.html view on Meta::CPAN
<p>The notes can be hidden from the new versions, while keeping them for the
old versions of the documentation (if it's still on CPAN). If the change to the
document was big enough, this might happen automatically; if note, either the
note author or a moderator can do it manually.</p>
<h2>Technical</h2>
<a name="conf"></a><h3>What's the %confidence?</h3>
<p>When a note is added to a document, the software tries to guess where
would the same note go in other versions of the same document. This is based
on a text similarity analysis which provides a quantitative estimate
expressed as a percentage.</p>
<p>For example, let's say that you add a note to My::Module in My-Dist-0.10,
next to a paragraph that says "this is a paragraph". When version 0.20 comes
out, let's say that the paragraph moved and was modified to say "this is
one paragraph". The similarity search decides that this is still the same
paragraph with a confidence of 95% and assigns the note accordingly.</p>
( run in 0.383 second using v1.01-cache-2.11-cpan-702932259ff )