honestly it's not only hard to read it's using some suboptimal techniques.
about readability:
- please consider using perltidy to reformat your code, it solves most problems afoken mentioned
- use blank lines between logical steps, see commenting in chunks in Perl Best Practices
- take care about naming conventions and clarity
hasref seems to mean hash_ref but reads like a boolean has_a_reference
- avoid deeply nested code!
e.g. using a dispatcher like $cmd{$line}->() with %cmd=('**'=>\&dump_readme,'*'=>...)
- prefer self commenting code, like moving code chunks into well named subs
about commenting
- be sure which audience you are targeting whith your comments
- you seem to mix POD stuff (i.e. for the user) and dev-comments and (sorry) banalities,
- line quantity doesn't equal quality
about techniques:
- your begin block is huge and I'm puzzled why (?) ¹
- your repeatedly looping with $_ over most of your lines, that's very vulnerable to bugs
- &sub() in Perl5 is usable in the rare cases where you need to ignore prototypes
All these mentioned problems keep me away to read more and to try it out.²
In general I'm sure you would love to have a look into Damian's PBP book.
This book helped me a lot understanding the traps in Perl and I hope it'll help you too! :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Updates
¹) if you need to check UserAgent within BEGIN, I'd consider using a second BEGIN block
2) I.e. the top-down structure is hidden
-
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.
|