wfsp has asked for the wisdom of the Perl Monks concerning the following question:
This script will only work with a full package name (see the comments):#!/usr/bin/perl -w # module path: c:/Perl/myperl/CWI/Message.pm package CWI::Message; use strict; use Exporter; use vars qw( $VERSION @ISA @EXPORT ); $VERSION = 1.00; @ISA = qw( Exporter ); @EXPORT = ( &get_msg ); sub get_msg{ return "message from module\n"; } 1;
Activestate 5.8 and winXP#!/usr/bin/perl -w # script path: c:/Perl/myperl/dev/test_mod.cgi # module path: c:/Perl/myperl/CWI/Message.pm use strict; use lib 'c:/Perl/myperl'; use CWI::Message; # next print statement produces: # 'Name "main::get_msg" used only once' # print get_msg; # prints ok print CWI::Message::get_msg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a simple module without full package names
by Joost (Canon) on Jul 12, 2004 at 15:16 UTC | |
by wfsp (Abbot) on Jul 12, 2004 at 16:07 UTC | |
by fergal (Chaplain) on Jul 12, 2004 at 22:00 UTC | |
by wfsp (Abbot) on Jul 13, 2004 at 07:10 UTC |