in reply to Adding "podpath" to Pod::XHTML?

I like Pod::XHTML because I get better control of the output formatting, but I really want the "--podpath" kind of searching in Pod::Html. Is this feasible? Assuming I know nothing about subclassing? (BTW, this is for https://www.openssl.org/docs/manpages )

What?

What is your actual ultimate goal? Combine wrap pod2html in a perl script and Adding "podpath" to Pod::XHTML? a picture is starting to form, but the details are peculiar, can you clarify them?

Does this help you in any way?

get '/mods/doc/:modname' => sub { my %params = params; my $ruri = request->request_uri(); if( $ruri =~ s/%3A/:/g ) { ## workaround for Pod::Simple::HTML , I prefer : over %3A ## and I preserve the rest http://localhost/mods/doc/Dancer%3A%3AReque +s%74 return redirect( $ruri ); } my $ret = eval { modlist::pod2html( %params ) }; if( !defined $ret or !length $ret ) { return meta_redirect( params, redirect => uri_for( "/mods" ) ) +; } return cache_page $ret; }; sub modlist::pod2html { my %opts = @_; my $module = $opts{modname}; my $modfile = $INC{$module}; $modfile ||= do { use Config(); use Pod::Find(); Pod::Find::pod_where( { -inc => 1, -script => 1, -perl => 1, -dirs => [ @INC, grep { defined and length } @Config::Config{ qw' installsitebin installsitescript installvendorbin installvendorscript installbin installscript ' } ], }, $module ); }; use Pod::Simple::XHTML; my $pshtml = Pod::Simple::XHTML->new; $pshtml->index( 1 ); $pshtml->html_css( 'http://search.cpan.org/s/style.css' ); $pshtml->perldoc_url_prefix( '' ); $pshtml->perldoc_url_postfix( '' ); $pshtml->man_url_prefix( 'http://man.linuxquestions.org/index.php?type=2&query=' ); $pshtml->man_url_postfix( '' ); my $somestring = ""; $pshtml->output_string( \$somestring ); $pshtml->parse_file( $modfile ); return $somestring; } ## end sub modlist::pod2html

Replies are listed 'Best First'.
Re^2: Adding "podpath" to Pod::XHTML?
by rsalz (Initiate) on Aug 20, 2015 at 01:56 UTC
    That probably helps; I need to learn more and understand it :) I am trying to statically build openssl .pod manpages into our website, see https://www.openssl.org/docs/manpages.html I made the current script available at https://www.openssl.org/mk-manpages.pl It's pretty naive perl :) Especially once you look at a typical manpage. Feel free to write to me rsalz at the openssl website if that's easier (I promise to update this with any answers I get). Let me know if I didn't make myself clear enough!

      ah, ok, so do you want more general comments on that script? Are you satisfied with your pod-xhtml code ?

      The main thing I would do make more subs , maybe with more descriptive names

      Path::Tiny makes using File::Basename/File::Spec... more convenient, it even does "or die" for you most of the time

      Also included is subclassing Pod::Simple::XHTML if thats a direction you need

      So ask more questions please

        I am okay with the script, but appreciate the more perl-ish way of doing things and will take on your suggestions (except the flush-left comments, yuk :) The subclassing is the most important part; it needs to look at some parent/global context to get the path, which I can do by adding a sub to MyPSX to set the path; e.g., sometimes I want crypto:ssl:app, sometimes I want app:crypto:ssl, etc. Thank you VERY much. I will post back in a day or two.
        Thanks to any/all posters here. The manpages on openssl now work! Thanks in particular to Phil Pearl for reaching out and turning the POC into production code :) If I can ever return the favor with openssl code, ping me.