NOTE: Author determined that this was not actually a problem. Please see this node
I'm working on a module for a project that I'm involved in - nothing big, just a few common subroutines that need to be called by a variety of applications. The problem that I'm having is that I can't seem to export the subroutines to be used by the application. In the the code 'modtest.pl' below, it picks up the version number out of the module without any problem. However, when I try to access the subroutine testMod(), I get an error message stating
Undefined subroutine &main::testMod called at C:\path\path\modtest.pl line
17 (#1)
(F) The subroutine indicated hasn't been defined, or if it was, it has
since been undefined.
I've checked perlmod and a couple sites here, but with no luck. It looks like it should work, but doesn't. I've tried with and without the begin blocks - 'require Exporter' vs. 'use Exporter'... still no luck. I'm running Perl 5.6.1 on Win32. Any help, suggestions, or information would be very much appreciated.
«Rich36»
#!/usr/bin/perl
# modtest.pl
#######################################################
# Setup variables and packages
#######################################################
use strict;
use warnings;
use diagnostics;
use lib './lib';
use CART::Validate;
#######################################################
# MAIN
#######################################################
print qq(The module version is $CART::Validate::VERSION\n);
my $testing = testMod();
print qq(The return value from testMod is $testing\n);
exit;
# CART::Validate
package CART::Validate;
BEGIN {
use Exporter;
our( @ISA, @EXPORT, @EXPORT_OK, $VERSION );
@ISA = qw( Exporter );
@EXPORT = qw( &testMod );
@EXPORT_OK = qw();
$VERSION = 1.00;
}
sub testMod {
return "HELLO!";
}
1;