megamic has asked for the wisdom of the Perl Monks concerning the following question:
Im using Exporter to write a module that exports some constant values (by default), aswell as subs on request. It works fine if I just do this:
use Foo; printf "Value is: %d\n",SOME;
However when I actually specify a sub to import my default constants are no longer imported. eg. the following breaks:
The module looks something like this:use Foo qw(bar); printf "Value is: %d\n",SOME;
package Foo; use strict; our (@ISA,@EXPORT,@EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT = qw(SOME CONST VARS); @EXPORT_OK = qw(bar); }; use constant ( SOME => 1 ,CONST => 2 ,VARS => 42 ); sub bar { . . . } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: exporter question
by DrHyde (Prior) on Jul 28, 2008 at 10:18 UTC | |
|
Re: exporter question
by Anonymous Monk on Jul 27, 2008 at 12:25 UTC | |
by Anonymous Monk on Jul 27, 2008 at 12:37 UTC | |
|
Re: exporter question
by CountZero (Bishop) on Jul 28, 2008 at 18:47 UTC | |
|
Re: exporter question
by apl (Monsignor) on Jul 27, 2008 at 15:17 UTC | |
by Anonymous Monk on Jul 27, 2008 at 15:30 UTC | |
by megamic (Sexton) on Jul 27, 2008 at 22:15 UTC | |
by Anonymous Monk on Jul 28, 2008 at 06:40 UTC |