use strict; use warnings; use Pod::Simple::HTML; use Getopt::Long; my $add_titlebars=1; # show title bars? { package Pod_To_HTML; use base 'Pod::Simple::HTML'; # the default doesnt have long enough max_content_length. sub run { my $self=shift; delete $self->{Pod_To_HTML}{title}; $self->SUPER::run(@_); } sub get_title { my $self=shift; if (!exists $self->{Pod_To_HTML}{title}) { $self->{Pod_To_HTML}{title}= $self->_get_titled_section( 'NAME', max_token => 50, desperate => 1, max_content_length=>256, @_) ; } return $self->{Pod_To_HTML}{title}; } sub get_title_bar_text { my $text=shift->get_title(); ($text= <<"EOFTEXT")=~s/^#\s+//mg; return $text; <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="block" valign="middle"> <big><strong><span class="block">&nbsp;$text</span></strong></big> </td></tr> </table> EOFTEXT } sub do_middle { my $self=shift; my $fh = $self->output_fh; my $title_text= $add_titlebars ? $self->get_title_bar_text() : ""; print $fh $title_text; my $ret= $self->SUPER::do_middle(); print $fh $title_text; $ret } } my $toc= 1; (my $css= $0)=~s/\.[^.]+$/.css/; $css="" if !-e $css; GetOptions( "css=s" => \$css, "toc!" => \$toc, "titlebars!"=> \$add_titlebars, ) or die <<'END_OF_USAGE'; pod_to_html.pl [--css=FILESPEC] [--notoc] [PODFILE [HTMLFILE]] --css: If FILESPEC is 'auto' then tries to find the CSS based on the value of $^X. Currently 'auto' is only useful on Win32 ActiveState perls. If no value is provided and there exists a pod_to_html.css file in the same directory as the script is running from then it defaults to using that. --notoc: Turn off the Table Of Contents at the top. --notitlebars: Turn off the title header and footer lines If PODFILE is omitted reads from STDIN, if HTMLFILE is omitted writes to STDOUT. END_OF_USAGE if ( $css eq 'auto' ){ $css=""; if ( $^O eq 'MSWin32' && $css=~s/\\bin\\perl\.exe$// ) { $css.="/html/Active.css"; if ( ! -e $css ) { $css=""; } } warn "Failed to autodetect 'css' location on '$^O' with exe '$^X'\ +n"; } if ( $css!~m<^[a-z]{3,5}://> ) { # assume its a file $css=~s!\\!/!g; $css= "file://$css"; } my $parser=Pod_To_HTML->new(); $parser->index(1) if $toc; $parser->html_css($css) if $css; $parser->parse_from_file(@ARGV); exit(0);

In reply to pod_to_html.pl by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.