[Nh-pm] Help with Exporter?
pll at lanminds.com
pll at lanminds.com
Tue Jan 28 15:15:23 CST 2003
Hi all,
Anyone familiar with creating modules? I've got a module I've
created, which currently exports a single function. This works just
fine. However, I now want to export certain variables set within the
module so I can use them within the program calling the module, and
that's not working. I'm quite sure I don't adequately grok the
Exporter function :)
Here's what I have so far:
package Foo;
use 5.008;
use strict;
use warnings;
use CGI qw/:all/;
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = \
('all'=> [qw(&print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK)]);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(print_header_table $TEXT $BGCOLOR $LINK $VLINK $ALINK);
our $VERSION = '0.02';
# WWW vars
my ($TEXT) = "#FFFFBB";
my ($BGCOLOR) = "#000000";
my ($LINK) = "#FFFFBB";
my ($VLINK) = "#00bbff";
my ($ALINK) = "#FF0000";
sub print_header_table {
# a bunch of working code
}
The call to print_header_table() from my perl program works just fine. Yet
I can't seem to access the scalars (listed under the section # WWW Vars).
Any ideas?
Thanks,
--
Seeya,
Paul
--
Key fingerprint = 1660 FECC 5D21 D286 F853 E808 BB07 9239 53F1 28EE
It may look like I'm just sitting here doing nothing,
but I'm really actively waiting for all my problems to go away.
If you're not having fun, you're not doing it right!
More information about the Nh-pm
mailing list