Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Stripping Comments from Source

by tomfahle (Priest)
on May 12, 2010 at 15:53 UTC ( #839665=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Stripping Comments from Source
in thread Stripping Comments from Source

Have a look at PPI::Document, too:

#!/usr/bin/perl use strict; use warnings; # Straight from the documention use PPI; # Load a document from a file my $Document = PPI::Document->new('My/Module.pm'); # Strip out comments $Document->prune('PPI::Token::Comment'); # Strip out Pod $Document->prune('PPI::Token::Pod'); # Save the file $Document->save('My/Module.pm.stripped');

Hth, Thomas

Udate: Added code to strip Pod


Comment on Re^4: Stripping Comments from Source
Download Code
Re^5: Stripping Comments from Source
by Kob (Novice) on May 14, 2010 at 07:40 UTC
    Following your tip, I installed PPI::Document via PPM to see if it would improve on the stripping relative to perltidy. However, this critical step did not work:

    $Document = PPI::Document->new('Module.pm');

    I guess there is some PPI::Document package I need to get. I'll continue this later.

    Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://839665]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-07-04 16:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls