Patrick Kirsch wrote:
Hey list,
I'm sure you can direct me:
I have several packages together in one file and now I would like "use"
the packages. Now my problem is that Perl's "use" wants to have a file
and does not search in the executed file, see example:
In one file:
package Util;
use base 'Exporter';
our @EXPORT = ('foo', 'bar');
sub foo {
print "foo!";
}
package Amy;
use Util; # imports symbols in @EXPORT
foo();
On execution it gives the error:
Can't locate Util.pm in @INC ...
I'm aware, that I can use in package Amy e.g. Util::foo() or Util->foo()
but then I cannot get the @EXPORT working.
Try
import Util;
instead.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/