Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This was one of the better posts I've read here. I've read a lot of great posts here too, so that's saying something.

I got to thinking about some of the people who wander in here with real problems to solve. We usually advise them . . .

I usually dole out such generic advice because I'm sure that it's not wrong in most cases rather than because I think it is best for a specific case. It usually works out because if someone is asking a question which can be met with a canned answer then they are likely to be inexperienced enough that the canned answer will serve them best anyway.

I don't always follow my own advice. I often write scripts in which I implement the one hundredth of Random::Module's functionality that I need because I don't need the other ninety-nine percent of it. I make those decisions with my eye's open though. I keep my requirements in mind and I research alternatives if I'm not already familiar with them.

Available modules are often not the best solution. Using them doesn't always result in more robustness, more maintainability, or less work.

Using modules requires that you rely on the work of people outside your organization and code which isn't developed with your guidelines, procedures, or standards in mind. Module authors usually aren't paid for their work and maintenance can be sporadic.

Depending on your environment, installing modules may be difficult. Keeping versions synchronized may be realistically impossible. Upgrading modules can break current functionality. Unlike binary shared libraries, getting multiple versions of a Perl module to coexist isn't always easy to do. Modules often contain XS code or rely on external libraries for which cross-platform support isn't as good as it is for Perl itself.

Just as the module may add some overhead to the project, the module's interface may well add overhead to your actual code. Abstractions chosen by module authors in an attempt to make some difficult tasks relatively simple may also make some simple tasks relatively difficult and the added complexity can be more hassle than it is worth. This is evident in the number of *::Easy and *::Simple modules on CPAN.

A regular expression to extract an easily identifiable link from some HTML might well make more sense than parsing the whole document and it might be a lot more robust too. It's perfectly acceptable to just print "Content-type: text/html\n\n"; and get on with life if your CGI script doesn't take parameters. Why not open a socket and print "HEAD / HTTP/1.0\n\n"; if that's really all you need to do?

Knowing what you really need to is, afterall, the key. If you need to make multiple head requests for documents residing on different servers then you should probably be using LWP. If your CGI application is even mildy complex then you are better off using CGI.pm. If your application needs to extract links from random HTML, then parse it.

Canned solutions work well in the average case. I think the same can be said for the canned advice we give.

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Simplicity vs. Doing It Right by sauoq
in thread Simplicity vs. Doing It Right by dws

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found