On Wed, May 02, 2001 at 04:20:49PM -0500, J. Patrick Lanigan ([EMAIL PROTECTED])
spew-ed forth:
[snip]
> my $manpage = param("manpage");
> my @output = `man $manpage | perl -pe 's/(?:.\cH)//g'`; #Thanks Paul
Please read perlsec and untaint $manpage (by hand, or with Untaint.pm). It is a
dangerous habbit to pass unknown data to a sub-shell.
Cheers,
Kevin
> print "<pre>";
> foreach (@output) {$_ =~ /\w/; print };
> print "</pre>";
> } else {
> print hr, start_form;
> print p("Enter manpage: ", textfield("manpage"));
> print p(submit("lookup"), reset("clear"));
> print end_form, hr;
> }
> print end_html();
>
>
> Thanks again,
> Patrick
>
>
> > --- Casey West <[EMAIL PROTECTED]> wrote:
> > > On Wed, May 02, 2001 at 03:12:23PM -0500, J. Patrick Lanigan wrote:
> > > : Thanks to Paul and Mike for the quick response.
> > > :
> > > : Now, does anyone know how I can trim out the unwanted charecters
> > > from the
> > > : output of a man page so that I can display it in a browser?
> > >
> > > Well, you could use the man2html utility, it doesn't seem like anyone
> > > is interested in tackling the job of converting Man to 'X' on CPAN.
> > > You might get away with stripping out just the text by doing:
> > >
> > > man ls | perl -pe's#(.)(\cH\1)|_\cH(.)#$1||$3#ge'
> >
> > Couldn't you just delete all characters followed by a backspace?
> >
> > man ls | perl -pe 's/(?:.\cH)//g'
> >
> > perl -p meaning print each line after processing it, -e meaning do this
> > expression first; the pattern being "substitute any character followed
> > by a backspace with nothing, globally".
>
--
[Writing CGI Applications with Perl - http://perlcgi-book.com]
"If you don't stand for anything, you don't stand for anything!"
-- G.W. Bush at a rally at Bellevue Community College