qazwart has asked for the wisdom of the Perl Monks concerning the following question:
However, if I call my function as Guid::guid(), it works. Here's the calling program that doesn't work:Undefined subroutine &main::guid called at H:\bin\foo.pl line 11.
Nor does this work:use Guid; print "Guid = " . guid() . "\n";
But, this does work:use Guid qw(guid); print "Guid = " . guid() . "\n";
Here's my module's header (from Guid.pm):use Guid; print "Guid = " . Guid::guid() . "\n";
I've written Perl modules before and have successfully exported the various functions in them. I know the problem is probably something very simple, but I can't figure out what I am doing wrong. So, why can't I seem to export guid() to my main namespace? What stupid detail am I leaving out?package Guid; use strict; use warnings; use Math::BigInt; use Net::Address::Ethernet qw(get_address); BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); $VERSION = 1.00; @EXPORT = qw(guid); %EXPORT_TAGS = (); } sub guid { my ($clockId, $netId) = $_; my $maxClockId = 2**14; my $clockIdOffset = 2**15; #Turn on Clock High bit my $timeOffset = "122192928000000000"; [...And On...]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exporting Module Functions
by ambrus (Abbot) on Jun 05, 2006 at 20:12 UTC | |
|
Re: Exporting Module Functions
by Fletch (Bishop) on Jun 05, 2006 at 20:12 UTC | |
|
Re: Exporting Module Functions
by tinita (Parson) on Jun 05, 2006 at 21:30 UTC | |
|
Re: Exporting Module Functions
by qazwart (Scribe) on Jun 06, 2006 at 13:04 UTC |