At 11:21 PM +0100 2/23/01, Jan Erik Moström wrote:
>Sorry for posting this general Perl question, but I can't figure out what the
>cause of my problems is. If someone can point me in the right
>direction I would
>be most grateful.
>
Jan -- not sure I can solve the problem, but here are a few thoughts:
1. Don't put the same variable (e.g., @EXPORT_OK) in a 'use vars ...'
declaration more than once in a module.
2. Why use the BEGIN block? Try without it. Many initializations work
perfectly well without it.
3. Bring in the import capabilities of Exporter.pm by *inheritance*,
that is, by including the statement '@ISA = qw(Exporter)'. You were
doing this but also using the statement 'use Exporter ();' -- lose
the latter.
3a. Incidentally, don't let the phrase "the import capabilities of
Exporter.pm" throw you. The 'importing' that happens is the
methods/variables of Your_module.pm being imported into the script in
which you say 'use Your_module;'. Exporter.pm provides the means for
this to happen, so yes, something called 'Exporter' does something
called 'import'.
4. Likewise, within a module, consider accessing methods of your
other modules through inheritance (via @ISA) rather than with 'use
...;'.
5. I'm assuming, but you should check, that you have a directory
named JEM, and in it are two files, Error.pm and Util.pm, and also a
directory, Info, in which there is the file PairParse.pm. Located
where Perl knows to look, etc...
One of yours, re-written:
--- file PairParse.pm
package JEM::Info::PairParse;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.1;
@ISA = qw(Exporter JEM::Error JEM::Util);
@EXPORT = qw(&parse);
%EXPORT_TAGS = ();
@EXPORT_OK = ();
sub parse {
# content deleted
}
1;
__END__
The Perl Cookbook by Tom Christiansen and Nate Torkington (O'Reilly)
has a nice treatment of building basic modules, including a template.
HTH
1;
--
- Bruce
__bruce_van_allen__santa_cruz_ca__