in reply to Re: Library file or module for sharing code?
in thread Library file or module for sharing code?
This looks exactly like the answer I was wanting, but I get this error:
Undefined subroutine &main::get_uppercase called at /usr/www/users/foo +bar/cgi-bin/test.pl line 9.
What is missing?
Update: The only way I could get this to work was use all the code outlined in Simple Module Tutorial.
package Common; use strict; use Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(get_uppercase); %EXPORT_TAGS = ( All => [qw(&get_uppercase)]); sub get_uppercase { my ($name) = @_; return uc($name); } 1;
AND
#!/usr/bin/perl -w use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); use Common qw(:All); my $name = "frodo"; $name = get_uppercase($name);
It needed:
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter); @EXPORT = ();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Library file or module for sharing code? (import)
by tye (Sage) on Dec 28, 2005 at 15:47 UTC | |
by bradcathey (Prior) on Dec 28, 2005 at 16:22 UTC | |
by tye (Sage) on Dec 28, 2005 at 17:40 UTC | |
|
Re^3: Library file or module for sharing code?
by kwaping (Priest) on Dec 28, 2005 at 14:30 UTC |