On Dec 22, 2003, at 12:43 PM, Support wrote: [..]
This is part of the module

require Exporter;

@ISA = qw(Exporter);

@EXPORT = qw();
@EXPORT_OK =
qw(
    Days_in_Year
    Days_in_Month
    Weeks_in_Year...............etc
[..]

well, there you have it. by default you are
not exporting any functions from your module.
Which IS actually a GOOD thing. But it does
require that the person calling that module
will need to expressly assert which function
is going to be imported from the module, eg:

use myModule qw/Days_in_Year/;

now the function Days_in_Year() will be seen as
available IN the calling code...

a strategy you May want to think about is
useing the

        our  %EXPORT_TAGS = (
                'foo' => [ qw(....) ],
                'bar' => [ qw(....) ],
                'baz' => [ qw(....) ],
                'bob' => [ qw(....) ]
        );

        $EXPORT_TAGS{'all'} = [ (@{$EXPORT_TAGS{'foo'}}),
                                                (@{$EXPORT_TAGS{'bar'}}),
                                                (@{$EXPORT_TAGS{'baz'}}),
                                                (@{$EXPORT_TAGS{'bob'}})
                                        ];

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

This way you can get different groups of functions
with something like

use myModule qw/:foo/;

it's at about that point in the process where you
may decide that even IF all you are doing is creating
a bunch of functions, and do not need an 'object' that
is based upon some specified 'data model' about how
camel's are a sub class of horse derived by multiple
class inheritence from committee... and opt for the
OO-ishneff of

        package Foo::Bar;
        
        use 5.006;
        use strict;
        use warnings;
        
        #our @ISA = qw(PARENT_CLASS);
        
        our $VERSION = '0.01';
        #---------------------------------
        # Our Stock Constructor
        # note: <http://www.perlmonks.org/index.pl?node_id=52089>
        sub new
        {
                my $class = shift;
                my $self = {};
                bless $self, $class;
        
        } # end of our simple new
        
        #---------------------------------
        # so that AUTOLOAD finds one here
        
        sub DESTROY {}
        
        #
        # your methods here
        #
        
        1; # so that the 'use Foo::Bar'
       # will know we are happy

and then make the minor modification to all of
your current subs  that take any input and insert
the line

my $me = shift;

to get the Class or Instance ref off the front of @_;


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to