package Test;require Exporter;use strict;our $VERSION = 1.00;our @ISA = qw(Exporter);our @EXPORT_OK = ();our @EXPORT = qw(hello);sub hello { my($name) = @_; return "hello, $name";}1;
use Test qw(hello);my $string = hello("cseymour");print $string;
[...]In our environment, we created our own directory tree under $iwhome/iw-perl/site/lib/. Under the lib directory (which is automatically placed in the @INC path), create a file like "Test.pm". Inside that file, put the following code: package Test;require Exporter;use strict;our $VERSION = 1.00;our @ISA = qw(Exporter);our @EXPORT_OK = ();our @EXPORT = qw(hello);sub hello { my($name) = @_; return "hello, $name";}1;
package MyTest;# require Exporter;use strict;use warnings;use base qw(Exporter);our $VERSION = 1.00;# our @ISA = qw(Exporter);our @EXPORT_OK = qw(hello);our @EXPORT; # = qw(hello);sub hello {# my ($name) = @_; my $name = shift; return "hello, $name";}1;