in reply to Struggling with Modules

c - I'm curious as to what problems you seem to be having. Maybe it's just cause I've been working exclusively with modules (writing and using) for over a year, but I don't see where your problem is.

Please don't take this as a "You're stupid" post, cause it's not. I am genuinely curious as to what issues you're running into. Are they:

I'm asking because I'm going to start teaching my girlfriend how to program (at her request) and I want to find out what stumbling blocks are out there so I can head them off with her.

The other reason I'm asking is that maybe you don't have to go out and spend $$ on those books when you could just get your answer here. I like to think that people here are relatively smart ... :)

Replies are listed 'Best First'.
Re: Why are you struggling with Modules
by c (Hermit) on Jul 25, 2001 at 18:37 UTC
    I sincerely appreciate your optimism on posting my questions to the monastery members, however I'm finding myself scratching my head with modules a bit too often. The problem isnt really "what modules are" and I don't think that its with the language itself. Some modules have what I consider very good doc that I run with, but others just leave me asking "I know what this is supposed to do, but how do I get it into my code?". Once I see an example that another monk fires over to me, I get a clearer picture, and it seems like one that I myself couldnt have drawn using just the cpan docs.

    humbly -c

      Yes, the documentation for File::Find would be improved a great deal if it were to actually mention (or even, *gasp*, explain) the basic concept of what the module does. ;)

      It never says, for example:

      For each directory you specify, File::Find calls a function that you provide (&wanted) for each file and directory found in that directory, every subdirectory, every subsubdirectory, etc., allowing you to "do something" for each file/directory within an entire directory tree. To use File::Find, you have to write a function that, each time it gets called, will decide what should be done with a specific file [for example, based on whether it is an ordinary file (-f $_) or if the file name matches some pattern (/\.html?$/i)] and then perform those operation(s). [...]

      It mearly says that "it traverses a directory tree" and that you pass it a "wanted" function and talks about various details. It never actually says that "wanted" is called once for each file, much less explain the concept.

      This is rather sad as File::Find is part of the base distribution. Many modules don't enjoy this level of attention and so are often just the ramblings of a lone hacker trying to offer something useful to the community. The lone hacker may not have great language skills (especially in English which might be "a second language") or have other reasons why the documentation doesn't really shine.

      So modules are a very mixed bag. If you find one that has documentation that gives you a hard time, the best thing that you can do is to get the documentation updated. The most important step in that process is finding someone motivated enough to actually produce and submit a patch to the module maintainer and then follow-up if needed. I suggest you look to yourself for that.

      Then you need to get someone to write some decent documentation. Perhaps just asking about the module here and requesting specific suggestions for documentation updates could get you the raw material for producing a patch.

              - tye (but my friends call me "Tye")
      Learning to read Perl documentation, in its many forms, is as important as learning the language itself. Patience. You are not the first to struggle with this.
        But reading documentation should not be a struggle, especially for someone who says they include RTFM-ing as part of their normal problem resolution.

        If Perl's documentation style is such that is inherently difficult to understand, then I would posit that it needs to be changed. Note that this isn't a knock on Perldoc, which is more of a document definition. Rather, perhaps it's a knock on Perl documentation style. Structure versus content and all that. All modules should, in their documentation, have a clear and complete documentation of the interfaces present in the module. This may be all c is needing.