Re: perl deparse question.



ewaguespack@xxxxxxxxx wrote:
What does the -p do in the following line:

perl -MO=Deparse,-p

also, is there a one liner that will run deparse, and tidy on a file at
the same time? or is that stupid?

preservation of comments would be nice but isn't critical.

Thanks.


The deparse documentation says that -p adds parentheses to the output, even where they're not required. (If you're not aware, the O module is a frontend to the compiler backends under B::*, and deparse is a backend properly called B::Deparse. The command "perldoc B::Deparse" shows the deparse documentation.)

If your tidy program can run as a filter (read from STDIN, write to STDOUT), you could run it as a filter like:

perl -MO=Deparse file.pl | tidy - > deparsed.pl

Alternately, if your tidy program can't be made to run as a filter, you could write a shell script (or even a Perl script) that saves STDIN to a temporary file, runs the tidy program, then reads the temporary file to STDOUT.

As far as comments go, Perl junks them before deparse even runs.

--
Donald King, a.k.a. Chronos Tachyon
http://chronos-tachyon.net/
.



Relevant Pages

  • Re: perl deparse question.
    ... perl -MO=Deparse,-p ... or is that stupid? ... your .profile or .rc file for running deparse and tidy. ...
    (comp.lang.perl.misc)
  • Re: perl deparse question.
    ... perl -MO=Deparse,-p ... preservation of comments would be nice but isn't critical. ... your .profile or .rc file for running deparse and tidy. ...
    (comp.lang.perl.misc)
  • perl deparse question.
    ... perl -MO=Deparse,-p ... also, is there a one liner that will run deparse, and tidy on a file at ...
    (comp.lang.perl.misc)
  • RE: developing using the firefox engine
    ... i had already tried tidy with no success... ... the xpath/linxml functions in the perl app complain regarding the file. ... thought is that tidy isn't cleaning enough, or that the perl xpath/libxml ... developing using the firefox engine ...
    (Fedora)
  • Re: print statement creates key in hash with reference to empty array??
    ... >> Abigail: ... I don't know why the do-block is needed. ... > what perl actually compiles. ... > Deparse can't very well suppress them either, ...
    (comp.lang.perl.misc)