Re: Require-ing Code vs Functions in a Module (was Use Strict)
Thanks again for taking the time to review my code. I've tried out some of
the suggestions and here's what I get:
> "use" is generally preferred for a variety of reasons (see your camel bookmy $data_file = 'digest.data';
> for more in depth explanations).
This works; 'requires' can evaluate an expression. Substituting 'use' here
generates a syntax error, because use apparently cannot evaluate an
expression (Camel 3rd, pp 774, 822).
> Currently, digest.data is a hash declaration. For a user to make use ofmay
> your program, they will have to understand (or hope they don't bungle it
> during editing), how to declare a complicated perl data structure. This
> be sub-optimal in the area of ease of use to anyone not comfortable withperl
> perl, never mind programming.
> This would allow anyone to potentially use your program, regardless of
> skills, or programming experience. ...Good point. Since this program was designed primarily to satisfy my own
obsessions, I wasn't focused on how a non-expert user would set the program
up. A separate module to set the program up could, in principle, sidestep
the question of whether the user understands Perl data structures, and it
could automatically establish the correct directory structure as well.
However, given that quite a few of the entries in %my_digests require
or typing of long lines (such as the delimiters between messages), any
user -- expert programmer or not -- would be better off doing this in a GUI
text editor with cut-and-paste capabilities. Unfortunately, using Perl to
design GUI interfaces is beyond me at this point.
> Since you already require the directory to be provided as an argument, addIn the full code (not presented in the original message but available at
> a BEGIN block to parse @ARGV, make sure the directory exists ...
http://www.concentric.net/~Jkeen/digest/digest.zip) I have a subroutine
which checks the directory structure.
In light of your comments, I'll be thinking about this question of ease of
set-up for the less experienced user when embarking on my next project.
----- Original Message -----
From: "Sean Quinlan" <seanq@...>
To: "James E Keenan" <jkeen@...>
Cc: "Perl Beginner Group" <email@example.com>
Sent: Monday, May 28, 2001 3:47 PM
Subject: Re: Require-ing Code vs Functions in a Module (was Use Strict)