bradcathey has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monasterians,

Having a problem with Web app, so I ran a syntax check from the command line:

myserver:/Rapid$ perl -c Categories.pm Base class package "Validate" is empty.

And the 'use' error. Here's how things are set up (file tree and the opening lines of each module. What am I not seeing?

Rapid.pm | Validate.pm | /Rapid/---+ | | Categories.pm #------------------------ package Rapid; use strict; use warnings; use Validate; #------------------------ package Validate; use strict; use Exporter 'import'; my @EXPORT = qw( val_alpha val_number val_whole val_int val_alphanum val_input val_text val_email val_selected val_filename ); #------------------------ package Rapid::Categories; use base qw(Rapid Validate); use strict; use warnings; use Validate;
—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: Missing module error. Inheritance/Structure problem?
by ikegami (Patriarch) on Feb 02, 2008 at 15:22 UTC

    First, modules aren't scripts. If you want to syntax check a module, use

    perl -ce"use Rapid::Categories"

    or

    perl -MRapid::Categories -ce1 (That's the number one)

    It will avoid some problems. (But not the one you're having, I think.)

    Secondly, you're in the wrong directory. Unless you have .. in @INC, it can't find Validate.pm

    myserver:/Rapid$ cd .. myserver:/$ perl -ce"use Rapid::Categories"

    I heard there were problems with use base. If I'm right about the error, I'd say this awful error message is one of them.

Re: Missing module error. Inheritance/Structure problem?
by Joost (Canon) on Feb 02, 2008 at 15:47 UTC