Perl'ers
I am reading Object Oriented Perl pages 52 and 53 for setting up a module.
It is telling me in order to use a routine from a different file you have
to
1) choose a lib directory
2) export PERL5LIB=.../.../.../
use lib /usr/local/perl/my.pl
3) created nested subdirs for each component of the module name
4) create a text file in the last directory
5) Insert you code.
6) add 1; at then end of the perl program file.
NOTE: is says in the footer that I can use h2xs to combine steps 3 and 4.
My quesiton is can't I just use step 2 and then in my program where I want
to use this code, make a routine call?
My goal is to set up a module for a routine that I can pass a data file
to, from a different file so it can read this file in then execute.
an example would be : &routine(datafile);
I then looked into Perl Cookbook ch 12_02 and it discussed :
In module file YourModule.pm, place the following code. Fill in the ellipses as
explained in the
Discussion section.
package YourModule;
use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
use Exporter;
$VERSION = 1.00; # Or higher
@ISA = qw(Exporter);
@EXPORT = qw(...); # Symbols to autoexport (:DEFAULT tag)
@EXPORT_OK = qw(...); # Symbols to export on request
%EXPORT_TAGS = ( # Define names for sets of symbols
TAG1 => [...],
TAG2 => [...],
...
);
########################
# your code goes here
########################
1; # this should be your last line
Is one autoloader and self loader? It seems to me I am getting
conflicting info of just that I am not understanding?
thanks, derek