Hello phirun and welcome to the monastery,
you already had nice answers and a useful thread to read, just to add my 2 cents.
bliako is right with:
> Caveat: the motto "only Perl can parse Perl" very frequently pops up in these sort of questions.
But a perl document can be parsed by PPI and pod and comments easily removed
# the entire document:
>perl -MPPI -e "print PPI::Document->new('example.pl')"
use strict;
use warnings;
# safety net loaded
my %ha = ( # dont use one letter variables
'ha' => 1, # this stand for..
'he' => 2, # and this other for
);
=pod
=h4
documentation
=cut
print $ha{'ha'}."\n"; # other unuseful comment
__END__
# the stripped document
>perl -MPPI -e "$doc = PPI::Document->new('example.pl'); $doc->prune('
+PPI::Token::Pod'); $doc->prune('PPI::Token::Comment'); print $doc->se
+rialize"
use strict;
use warnings;
my %ha = (
'ha' => 1,
'he' => 2,
);
print $ha{'ha'}."\n";
__END__
So you can take a big enough perl document ( 1Mb ?) with lot of comments and pod, setup a non persistent weberver (with my limited experience I mean: a server which load the content at each request) and use ab to spot differences between serving the stripped and the complete document. Have fun ;)
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|