#!/usr/bin/perl -w # unfinished code, possibly insecure. use strict; sub AUTOLOAD { shift }; sub pod_blank { "

" } sub pod_code { "

$_[0]
" } sub pod_C { "$_[0]" } sub pod_I { "$_[0]" } sub pod_B { "$_[0]" } sub pod_S { "$_[0]" } sub pod_F { "$_[0]" } sub pod_Z { "" } sub pod_L { # XXX - needs a lot of work (split /\|/, shift)[0] } sub pod_E { $_[0] =~ /^\d+$/ ? "&#$_[0];" : { qw(lt < gt > sol / verbar |) }->{ $_[0] } || "&$_[0];" } sub pod_head1 { "

$_[0]

" } sub pod_head2 { "

$_[0]

" } sub pod_over { "" } sub pod_item { "
  • $_[0]
  • " } sub pod_PRE { local $_ = shift; s/&/&/g; $_; } sub pod_POST { local $_ = shift; s//>/g; "$_"; } ### my $pod = do { local $/ = undef; open my $fh, 'pod' or die $!; readline $fh; }; $pod = pod_PRE($pod); $pod =~ s/([\[\]\$\@\\])/\\$1/g; $pod =~ s/^[^\n\S]*$/\${\\ pod_blank() }/gm; $pod =~ s/^=(\w+)(?: ?(.*))?/\${\\ pod_$1(qq[$2]) }/gm; $pod =~ s/^((?:[^\n\S].*\n?)+)/\${\\ pod_code(qq[$1]) }/gm; for (2..6) { my $op = '<' x $_; my $cl = '>' x $_; while ($pod =~ /([IBSCLFXZE])$op (.*?) $cl/) { $pod =~ s//\${\\ pod_$1(qq[$2]) }/g; } } while ($pod =~ /([IBSCLFXZE])<(.*?)>/) { $pod =~ s//\${\\ pod_$1(qq[$2]) }/g; } $pod = 'qq[' . pod_POST($pod) . ']'; print eval $pod;