OnlyPerlWillDo has asked for the wisdom of the Perl Monks concerning the following question:
(yes, now the world knows my file structure). I constructed it according to this post:package Test; use strict; use warnings; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(test); sub test { print "This is only a drill\n"; } 1;
http://www.perlmonks.org/?node_id=102347
My driver program, /home/steve/scripts/test.pl, looks like:As stated, this fails, with error: Undefined subroutine &main::test called at ./test.pl line 6. Why? I used to write modules all the time (on the same OS, but maybe not the same perl version). Did perl change its export/import/package method? Thanks#!/usr/bin/perl use lib '/home/steve/scripts/lib'; use STEVE::Test qw(&test); test();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem With Exporting subs from Modules
by choroba (Cardinal) on Nov 29, 2014 at 09:11 UTC | |
by OnlyPerlWillDo (Initiate) on Nov 29, 2014 at 09:23 UTC | |
by GrandFather (Saint) on Nov 29, 2014 at 09:46 UTC | |
by tobyink (Canon) on Nov 29, 2014 at 21:07 UTC | |
by OnlyPerlWillDo (Initiate) on Nov 29, 2014 at 13:14 UTC | |
by SimonPratt (Friar) on Dec 02, 2014 at 16:40 UTC |