Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Note that my innocent looking smiley was very important. ;) There is no black-and-white to this for me.

Dealing with CGI forms without using is the closest to an absolute for me. I've never seen a case of not using for CGI forms that wasn't a mistake. Dealing with CGI forms exposed to the world is very complex and getting it wrong has serious consequences.

Now, a much more middle-of-the-road case is File::Find. There are minor and major problems with File::Find and rolling your own is really pretty easy. Sure, there are several common mistakes that less experienced programmers make again and again when rolling their own File::Find so you should discourage casual re-rolling of File::Find. But I know all of those mistakes and I don't make those when I roll my own. ;)1

And I understand the way-too-often repeated request for solutions that "use no modules". At one end are modules whose installation involve C compilers, grabbing external libraries from non-Perl web sites, porting code, finding patches, installing other modules that require other modules that require other modules, etc. After you've tried that once, I'm sure you'll be shy about the next time you hear the innocent-sounding "Oh, just install Magic::Black".

At the other end we have, for example, File::KGlob. Someone once ask how to do what it does without using the module. Well I wrote that crufty old module. It consists of a single file of Perl code. My response then was much like the one I gave above (but without the sarcasm tags and the smiley).

I suspected that File::Tail is much closer to the File::KGlob end of the spectrum (or I wouldn't have given that flippant response). Well, I just checked, and File::Tail is implemented as a single file of Perl code (but it includes a test suite and example scripts). Unfortunately, it requires the non-standard Time::HiRes and that one includes C code.

I still suggested that they read the source code for File::Tail as the authors probably bothered to figure out a pretty good way to do things. If I were in this situation I'd probably patch File::Tail so that if Time::HiRes is not installed, then it works around that and just doesn't support sleeping for less than a second (which should be a fine restriction for the vast majority of people).

When I write modules, I try to be very careful about what modules I require. For example, Win32::TieRegistry has some features that only work if certain modules are installed. But if those modules aren't installed, then everything else works just fine. I wish more module writers were careful about that type of thing.

1 Recently I needed File::Find functionality and started out using the module. There was a natural way to do what I wanted that just didn't fit well with the way that File::Find did things. I wrote the code to deal with File::Find's different approach and it was awkward. In the end I rolled my own because adding my own traversal code made the rest of the code so much simpler that it was a net win.

        - tye (but my friends call me "Tye")

In reply to (tye)Re2: 'Tailing' a File? by tye
in thread 'Tailing' a File? by madhatter

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-05-22 02:44 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (78 votes). Check out past polls.