Padre::DocBrowser -- documentation browser for Padre
Provide an interface for retrieving / generating documentation, resolving terms to documentation (search?) and formatting documentation.
Allow new packages to be loaded and interrogated for the mimetypes they can generate documentation for. Provide similar mechanism for registering new documentation viewers and uri schemes accepted for resolving.
NOTE i think all the method names are wrong. blast it.
# Does perlish things by default via 'Padre::DocBrowser::POD' my $browser = Padre::DocBrowser->new(); my $source = Padre::Document->new( filename=>'source/Package.pm' ); my $docs = $browser->docs( $source ); # $docs provided by DocBrowser::POD->generate # should be Padre::DocBrowser::document , application/x-pod my $output = $browser->browse( $docs ); # $output provided by DocBrowser::POD->render # should be Padre::Document , text/x-html $browser->load_viewer( 'Padre::DocBrowser::PodAdvanced' ); # PodAdvanced->render might add an html TOC in addition to # just pod2html my $new_output = $browser->browse( $docs ); # $new_output now with a table of contents
Boring constructor , pass nothing. yet.
Accepts a single class name , will attempt to Autouse the class and interrogate it's ->provider_for method. Any mimetypes returned will be associated with the class for dispatch to ->generate
Additionally , interrogate class for ->accept_schemes and associate the class with uri schemes for dispatch to ->resolve
Accepts a single class name , will attempt to Autouse the class and interrogate it's ->viewer_for method. Any mimetypes returned will be assiciated with the class for dispatch to ->render
Accepts a URI or scalar
package My::DocBrowser::Doxygen; # URI of doxygen:$string or doxygen://path?query sub accept_schemes { 'doxygen', } sub provider_for { 'text/x-c++src' } sub viewer_for { 'text/x-doxygen', } sub generate { my ($self,$doc) = @_; # $doc will be Padre::Document of any type specified # by ->provider_for # push $doc through doxygen # ... # that was easy :) # You know your own output type, be explicit my $response = Padre::Document->new(); $response->{original_content} = $doxygen->output; $response->set_mimetype( 'text/x-doxygen' ); return $response; } sub render { my ($self,$docs) = @_; # $docs will be of any type specified # by ->viewer_for; ## turn $docs into doxygen(y) html document # ... # my $response = Padre::Document->new(); $response->{original_content} = $doxy2html->output; $response->set_mimetype( 'text/x-html' ); return $response; }
To install Padre, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Padre
CPAN shell
perl -MCPAN -e shell install Padre
For more information on module installation, please visit the detailed CPAN module installation guide.