1) FIRST: A Perl module should be set up like a Perl executable module. So that you can have a test() target that does a "sanity check" for debugging, etc. That means that that this module should start like any other Perl module. You are Windows user, but this is the standard preamble that will allow your programs to work on Unix. This is completely compatible with Windows and even the -w option on the first line is recognized as "use warnings" although the script path is ignored.
2. Use of BEGIN {} is not needed here.#!/usr/bin/perl -w use strict;
3. use of address of sub_name is not needed: &load_config, just load_config is better.
4. use of @EXPORT (%args) makes no sense. You have no %args to export, but this would not be an error.
There are vars that are exported by default and some that can be exported upon "request" by caller. All subroutine names are "eligible for export". A scalar can only be exported if it has "our" declaration (package scope) - you don't have any so this is not an issue here.
I think you will have much better luck with this preamble:
Calling program does a#!/usr/bin/perl -w use strict; package Routines; #File is Routines.pm IMPORTANT! use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; our $VERSION=1.0; our @ISA = qw(Exporter); our @EXPORT = qw( clear_config load_config show_config command_showconfig ); our @EXPORT_OK = qw();
I did not do any testing of you code so I don't know if it works or not.
In reply to Re: cannot export from Module
by Marshall
in thread cannot export from Module
by sqspat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |