AnyEvent-Riak

 view release on metacpan or  search on metacpan

pbc/generate_doc.pl  view on Meta::CPAN

#
# This file is part of AnyEvent-Riak
#
# This software is copyright (c) 2014 by Damien Krotkine.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use 5.012;
use strict;
use warnings;
use FindBin qw($Bin);

my @content = split(m|\n|, do{local(@ARGV,$/)="$Bin/riak.proto";(<>)});

my $pod = "package AnyEvent::Riak::Documentation;\n\n1;\n\n";

my $current_comment = '';
my $request_name = '';
my $response_name = '';
my $object_name = '';

my %enums;
my $enum_name = '';

my $methods_pod = "=head1 METHODS\n\n";
my $responses_pod = "=head1 RESPONSE OBJECTS\n\n";
my $objects_pod = "=head1 OTHER OBJECTS\n\n";

my $current_pod = '';

my %mapper = (
  bytes => string =>
  uint32 => number =>
  bool => boolean =>
);

while (defined ($_ = shift @content)) {

state $c++;
    s/^\s*$//;
    length or
      $current_comment = '',
      next;

    if (m|^\s*//\s*([A-Z]?)(.*)$|) {
        $current_comment .= ($1 ? ($current_comment ? ". $1$2" : "$1$2"): " $2");
        next;
    }

    my $postfix_comment = '';
    s|//\s*(.*)$||
      and $postfix_comment = $1;

    if (/^message Rpb(\w+)Req {$/) {
        $request_name = $1;
        my $method_name = _from_camel($request_name);
        $current_pod .= "=head2 $method_name\n\n";
        $current_comment
          and $current_pod .= "$current_comment\n\n";
        $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+) {$/) {

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.228 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )