| [reply] |
use Modules::ScriptUpdate;
If you load it like this, your package name should be Modules::ScriptUpdate accordingly, or else Exporter will alias main::script_stats() to Modules::ScriptUpdate::script_stats(), not ScriptUpdate::script_stats(), where it would reside in your case with a package name of ScriptUpdate...
In more detail, the reason is that use Modules::ScriptUpdate; implcitly calls Modules::ScriptUpdate->import(), which in turn (via inheritance) calls Exporter->import() with the first parameter being "Modules::ScriptUpdate". This then is the namespace used by Exporter, not what you specified in the module source with package. For this reason - when you use Exporter - package name and filename/path of the module have to match.
| [reply] [d/l] [select] |
use Modules::ScriptUpdate;
The usual thing to do is to have the module name match the package name - ie in ScriptUpdate.pm it would be usual to declare package Modules::ScriptUpdate; instead of package ScriptUpdate; (as you have done).
Cheers, Rob
| [reply] [d/l] [select] |
Yes, you would get that message if you forgot use:
use strict;
use warnings;
script_stats();
__END__
Undefined subroutine &main::script_stats called at TLEQUERY.pl at line
+ 3.
| [reply] [d/l] |