in reply to Re^2: execution log
in thread execution log
To create a (reusable) module, create a file in the format below, i.e. starting with the section labeled module interface, followed by the actual module code, and concluding with the numeral 1 (which should be the very last character in the file). Name the module file using the extension .pm, e.g., logmsg.pm.
Locate the .pm file in one of the module directories searched by the perl interpreter:
To import the module into (make it accessible from within) your script, include the statement use Logmsg. The module name must be exactly as it appears in the corresponding package statement in the .pm file, including capitalization. By convention, at least the first letter of the module name should be upper case.
Good luck!
Best regards,
Michael
# ============================================== # # module interface # # ============================================== # package Logmsg; # for example -- name as you think best use strict; use Exporter(); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); # set the version for version checking $VERSION = 1.0; @ISA = qw(Exporter); @EXPORT = qw( # autoexported symbols &logstart &logmsg &logstr &logstop &logstack ); %EXPORT_TAGS = (); # symbol groupings @EXPORT_OK = (); # symbols exported on request # ============================================== # # module code # # ============================================== # # ============================================== # # at end of file # # ============================================== # 1;
References
Programming with Perl Modules: Chapter 1, Sebastopol, CA:O'Reilly Media, Inc.
Perlmodlib - Constructing New Perl Modules and Finding Existing Ones
Chapter 10, "Packages" in Wall, Larry, Tom Christiansen, and Jon Orwant, Programming Perl, Third Edition, Sebastopol, CA:O'Reilly Media, Inc., 2000, ISBN 0596000278.
Chapter 11, "Modules" in Programming Perl.
Chapter 12, "Packages, Libraries, and Modules," in Christiansen, Tom and Nathan Torkington, Perl Cookbook, Second Edition, Sebastopol, CA:O'Reilly Media, Inc., 2003, ISBN 0596003137.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: execution log
by yburge (Acolyte) on May 09, 2006 at 20:31 UTC | |
by mscudder (Initiate) on May 12, 2006 at 03:06 UTC |