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...]
In reply to Exporting Module Functions by qazwart
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |