http://qs321.pair.com?node_id=851718


in reply to starting perl module

First, I would like to second JavaFan's comments above.

A Perl module that is not designed to be invoked with objects can really be thought of more as a library. I actually use non-OO modules far more often, since my background is Procedural_programming. If you are interested in working with Perl in an object-oriented context, I would suggest reading perlboot and perltoot to understand the mechanics and probably use Moose or Mouse as the framework rather than rolling your own.

I will assume the tutorial you read was Simple Module Tutorial. With regard to non-OO approaches, I'd recommend reading perlmod. I'd also point out that the examples in Simple Module Tutorial include the pragma vars to declare the variables required by Exporter. As vars states,

NOTE: For variables in the current package, the functionality provided by this pragma has been superseded by our declarations, available in Perl v5.6.0 or later. See our.

This means the module at the top of that thread should likely read:

package MyModule; use strict; use Exporter; our $VERSION = 1.00; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(func1 func2); our %EXPORT_TAGS = ( DEFAULT => [qw(&func1)], Both => [qw(&func1 &func2)]); sub func1 { return reverse @_ } sub func2 { return map{ uc }@_ } 1;