AnyEvent-Riak
view release on metacpan or search on metacpan
pbc/generate_doc.pl view on Meta::CPAN
$current_comment = '';
$current_pod .= "=over\n\n";
next;
}
if (/^message (Rpb\w+Resp) {$/) {
$response_name = $1;
$current_pod .= "=head2 $response_name\n\n";
$current_comment
and $current_pod .= "$current_comment\n\n";
$current_comment = '';
$current_pod .= "=over\n\n";
next;
}
if (/^message (Rpb\w+) {$/) {
$object_name = $1;
next;
}
if (/^\s*}$/) {
if ($enum_name) {
$enum_name = '';
next;
}
$current_pod .= "=back\n\n";
if ($request_name) {
$request_name = '';
$methods_pod .= $current_pod;
$current_pod = '';
next;
}
if ($response_name) {
$response_name = '';
$responses_pod .= $current_pod;
$current_pod = '';
next;
}
if ($object_name) {
$object_name = '';
$objects_pod .= $current_pod;
$current_pod = '';
next;
}
die "mofa";
}
if (/^ enum (.*) {/) {
$enum_name = $1;
# $current_pod .= "=item $1\n\n";
# $current_comment
# and $current_pod .= "$current_comment\n\n";
# $current_pod .= "=over\n\n";
next;
}
if (/^\s+(.*)$/) {
my $item = $1;
$item =~ s/ = \d+;$//;
if ($enum_name) {
push @{$enums{$enum_name} //= []}, $item;
next;
}
my ($p1, $type, $name) = split(/\s+/, $item);
defined $name or
say STDERR "$c ($_)";
$current_pod .= "=item $name\n\n";
$type = $mapper{$type} // $type;
if (exists $enums{$type}) {
$type = 'one of ' . join(', ', map { "'$_'" } @{$enums{$type}} )
}
$current_pod .= "$p1, $type\n\n";
$current_comment
and $current_pod .= $current_comment;
$postfix_comment
and $current_pod .= ($current_comment ? '. ': '') . $postfix_comment;
$postfix_comment || $postfix_comment
and $current_pod .= "\n\n";
$current_comment = '';
next;
}
}
$pod .= $methods_pod . $responses_pod . $objects_pod;
say $pod;
sub _from_camel {
my $s = $_[0];
$s =~ s/(.)([A-Z])([a-z])/$1 . '_' . lc($2) . $3/ge;
$s =~ s/^([A-Z])([a-z])/lc($1) . $2/e;
$s;
}
( run in 0.698 second using v1.01-cache-2.11-cpan-483215c6ad5 )