Re: talking to Perl for a text-cleanup [SOLUTION]

From: Date: Wed, 16 Apr 2003 10:31:09 +0000
Subject: Re: talking to Perl for a text-cleanup [SOLUTION]
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-144096@lists.php.net to get a copy of this message
On (15/04/03 20:22), Michael Sims wrote: > On Tue, 15 Apr 2003 20:20:59 +0200, you wrote: > > >On (15/04/03 12:35), John Nichel wrote: > >> Okay, try this..... > >> > >> $clean_text = $unformatted_text | perl -MText::Autoformat > >> -e'autoformat' > > > >nope, it's not working. > > Three ways that I know of: > > 1. Echo the text and pipe it to your command. You have to make sure > and escape shell metacharacters: > > $unformatted_text = escapeshellarg($unformatted_text); > $clean_text = `echo $unformatted_text | perl -MText::Autoformat > -e'autoformat'` This worked ! thanks. Here is how, in case someone else bumps into this : $original = escapeshellarg($original); $clean_text = echo $original | perl -MText::Autoformat -e'autoformat{all=>1, right=>50}'; $quoted_clean_text = eregi_replace ("([^\n]+)?(\n)" , "> \\1\\2" ,$clean_text ); $quoted_clean_text = htmlentities($quoted_clean_text); echo "<pre>".$quoted_clean_text."</pre>"; which produces : > <CN = Clooless Noobie> writes: > CN> PERL sux because: > CN> > CN> * It doesn't have a switch statement and you > CN> have to put $ signs in front of everything > CN> * There are too many OR operators: having |, > CN> || and 'or' operators is confusing > CN> * VB rools, yeah!!!!!!!!! > CN> > CN> So anyway, how can I stop reloads on a web > CN> page? Email replies only, thanks - I don't > CN> read this newsgroup. > > Begone, sirrah! You are a pathetic, Bill-loving, > microcephalic script-infant. The same using wordwrap() isnt (IMO) as well wrapped : > '<CN = Clooless Noobie> writes: > CN> PERL sux because: > CN> > CN> * It doesn'''t have a switch statement and > you have to put $ > CN>signs in front of everything > CN> * There are too many OR operators: having |, > || and '''or''' > CN>operators is confusing > CN> * VB rools, yeah!!!!!!!!! > CN> > CN> So anyway, how can I stop reloads on a web > page? > CN> Email replies only, thanks - I don'''t read > this newsgroup. > > Begone, sirrah! You are a pathetic, Bill-loving, > microcephalic > script-infant. Thanks again to all that helped ! j.

« previous php.general (#144096) next »