perl-docs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Autogenerating Docs
Date Mon, 09 Dec 2002 02:31:00 GMT
Randy Kobes wrote:
> Stas has mentioned that getting the autogenerating of skeleton
> pods would be useful ... 

Gerald works on the generalized WrapXS, which also parses the C headers 
files and based on that will generate the pods. Lyle was/is working on 
the latter functionality.

> Attached is a script that perhaps might
> be a start in that direction - it takes a pdd file and writes a
> pod outline of the included methods (name, C definition,
> description, arguments, and return type).

what's pdd?

> ------------------------------------------------------------------------
> 
> use strict;
> use warnings;
> my $pdd = shift || die "Useage: $0 pdd_file";
> 
> pdd2pod($pdd);
> sub pdd2pod {
>   my $pdd = shift || die "Please supply a pdd file";
>   open(PDD, $pdd) or die "Coudn't open $pdd: $!";
>   my @lines = <PDD>;
>   close PDD;
>   my $VAR1;
>   my $code = join " ", @lines;
>   eval ($code);
>   (my $pod = $pdd) =~ s!\.pdd$!.pod!;
>   open (POD, ">$pod") or die "Can't open $pod: $!";
>   my $module = $VAR1->{module};
>   print POD <<"END";
> =head1  $VAR1->{module} documentation
>     
> The following methods are available.
> 
> =head1 Methods
> 
> =over
> 
> END
>   
>   foreach my $hash (@{$VAR1->{functions_detailed}}) {
>     my $comment = $hash->{comment_parsed};
>     my $desc = $comment->{func_desc} || 'none given';
>     my $return = $comment->{doxygen_return} || 'not supplied';
>     print POD <<"END";
> 
> =item $hash->{name}
>  
> I<C Type>:
> 
>  $hash->{code}
> 
> I<Description:> $desc
> 
> END
>   
>   my @keys = keys %{$comment->{doxygen_param_desc}};
>     if (@keys) {
>       print POD "I<Arguments:>\n";
>       foreach my $key (@keys) {
> 	print POD " \n$key: $comment->{doxygen_param_desc}->{$key}\n";
>       }
>     }
>     else {
>       print POD "I<Arguments:>\nnot supplied\n";
>     }
>     print POD "\nI<Return:> $return\n";
>     
>   }
>   
>   print POD "\n=back\n";
>   close POD;
> }
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: docs-dev-help@perl.apache.org


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Mime
View raw message