in reply to Library file or module for sharing code?
COMMON 3
package Common; use warnings; use strict; use base 'Exporter'; our @EXPORT_OK=qw(get_uppercase); sub get_uppercase { my ($class, $name) = @_; return uc($name); } 1;
SCRIPT 3
#!/usr/bin/perl use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); use Common qw(get_uppercase); my $name = "frodo"; $name = get_uppercase($name);
Update: Changed use Exporter to use base 'Exporter' to inherit properly. Sorry, bradcathey!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Library file or module for sharing code?
by bradcathey (Prior) on Dec 28, 2005 at 13:23 UTC | |
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 | |
by kwaping (Priest) on Dec 28, 2005 at 14:30 UTC |