in reply to Re^6: can't import using exporter
in thread can't import using exporter
Extraordinary claims require extraordinary evidence.
So far, all you have shown are two snippets that don't compile and a huge program that you obviously did not care to cut down to the problem. I've reduced your program to the following, self-contained program and noted where I added BEGIN blocks to make all symbols appear in the order which use would make appear them in as well:
#!/usr/bin/perl -w use 5.12.0; use warnings FATAL => 'all'; BEGIN { # Added this because that's how "use" works package Debug;{ use Exporter 'import'; our @EXPORT=qw( Debug $Filename2Fields); my %dop = ( Filename2Fields => 1, HaltOnError => 2, ); our $Filename2Fields= $dop{Filename2Fields}; our $HaltOnError = $dop{HaltOnError}; sub Debug($$) { my ($what, $str)=@_; print STDERR $str; } }; } BEGIN { # Added this because that's how "use" works package Transcode_plug;{ use strict; use Exporter 'import'; BEGIN { Debug->import() }; our @EXPORT=qw( album get_fieldAR_from_filename ); sub album {}; sub get_fieldAR_from_filename($) { my $file=$_[0]; Debug($Filename2Fields,"get_fieldAR_from_filename($file)\n"); } }; } package main; BEGIN { Transcode_plug->import; }; print "Main is running\n"; # Now see that even prototype parsing works properly: print "OK\n"; get_fieldAR_from_filename "Foo"; # vim: ts=2 sw=2
It behooves you well to put more effort into making your findings reproducible, especially when nobody else seems to be able to reproduce your problem.
Also, you may be interested in App::fatpacker, which packs a script and its modules into one monolithic file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Fixed a year later...
by perl-diddler (Chaplain) on Mar 25, 2013 at 17:54 UTC | |
by tobyink (Canon) on Mar 26, 2013 at 09:54 UTC | |
by perl-diddler (Chaplain) on Mar 27, 2013 at 23:24 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |