Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/MetaCPAN/Document/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ sub _build_documentation {
return undef;
}

has documentation_length => (
is => 'ro',
isa => Maybe [Int],
lazy => 1,
builder => '_build_documentation_length',
);

sub _build_documentation_length {
my ($self) = @_;
return length( $self->documentation );
}

=head2 suggest

Autocomplete info for documentation.
Expand Down
3 changes: 3 additions & 0 deletions lib/MetaCPAN/Script/Mapping/CPAN/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ sub mapping {
},
"ignore_above" : 2048
},
"documentation_length" : {
"type" : "integer"
},
"download_url" : {
"type" : "string",
"index" : "not_analyzed",
Expand Down
1 change: 1 addition & 0 deletions lib/MetaCPAN/Script/Release.pm
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ sub import_archive {

$file->clear_module if ( $file->is_pod_file );
$file->documentation;
$file->documentation_length;
$file->suggest;

log_trace {"reindexing file $file->{path}"};
Expand Down
5 changes: 3 additions & 2 deletions t/document/file.t
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ END

my $file = new_file_doc( content => \$content );

is( $file->abstract, 'mymodule1 abstract' );
is( $file->documentation, 'MyModule' );
is( $file->abstract, 'mymodule1 abstract' );
is( $file->documentation, 'MyModule' );
is( $file->documentation_length, 8 );
is_deeply( $file->pod_lines, [ [ 3, 12 ], [ 18, 6 ] ] );
is( $file->sloc, 3 );
is( $file->slop, 11 );
Expand Down