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 = ();
In reply to Re^2: Library file or module for sharing code?
by bradcathey
in thread Library file or module for sharing code?
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |