in reply to Perl complains of redefining undefined module export

I'd be very interested in learning from which perl docs you copied this from - it's not normal to do all the exporting in the BEGIN block, the more usual form is along the lines of...
package SomePkg; use warnings; use strict; use Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/&GeneratorConfig &Generate &GetWidthFromType &GetWidt +hFromFormat/; sub GeneratorConfig { ... } sub Generate() { ... } sub GetWidthFromType { ... } sub GetWidthFromFormat { ... } 1;
The bulk of your problems, I believe, lie in the apparent lack of any sub declaration in scope (at the time that Exporter does its work) - if there are subs declared in the module, they won't have been parsed until after the BEGIN block has run i.e. your use of Exporter in the BEGIN block is far too early in the compilation cycle

Note that the using strictures might have pointed you in right direction a little earlier.

Note also that it is extremely unadvisable to export everything by default (via @EXPORT), it is far more preferable to export on demand (using @EXPORT_OK).

As an aside, I've recently been asked about a similar situation in some extremely legacy code - the workaround (given that there are over 100 warnings if strictures are enabled) was to change use to require.

Update:

In the light of ikegamis salient qualification, I thought I ought to further qualify my comment ...it's not normal..., here, by normal, I was alluding to the module template generated by h2xs.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Perl complains of redefining undefined module export
by ikegami (Patriarch) on May 10, 2009 at 00:38 UTC

    it's not normal to do all the exporting in the BEGIN block

    I always do. I like for my code to be executed in the order it appears in the file. There's no harm in doing so.

    And it's necessary to do so when you have two exporting modules that use each other. Granted, that's also not a normal thing to do.

Re^2: Perl complains of redefining undefined module export
by ig (Vicar) on May 10, 2009 at 01:54 UTC

    The style looks familiar to me, though I can't say where I have seen it particularly.

    Playing Safe has an example in a very similar style.

Re^2: Perl complains of redefining undefined module export
by ysth (Canon) on May 10, 2009 at 20:37 UTC
    The bulk of your problems, I believe, lie in the apparent lack of any sub declaration in scope (at the time that Exporter does its work) - if there are subs declared in the module, they won't have been parsed until after the BEGIN block has run i.e. your use of Exporter in the BEGIN block is far too early in the compilation cycle
    That isn't a problem. If you take a reference to a not-yet-defined subroutine (essentially what Exporter does), you implicitly are creating a forward declaration which will later be fully defined when the sub body is parsed.
Re^2: Perl complains of redefining undefined module export
by WienIsset (Novice) on May 11, 2009 at 05:47 UTC
    http://perldoc.perl.org/perlmod.html
    Section "Perl Modules"

    "For example, to start a traditional, non-OO module called Some::Module, create a file called Some/Module.pm and start with this template:"

    The only difference I can see there is that they use "Some::Module", but I don't have "pm::Xyz" even though the module is in the pm directory.

    And there we go.

    Once I had all the directory :: name instead of relying on simply name, it worked...

    If by "strictures" you mean use strict;, yeah, have that (that's default behavior around my house).
    Thanks for your time!

    rip