I have read that link you provided, thanks.

The modules I have declared do contain a package name.

Is it not possible or easy to just use/require/include a pl or pm file that
contains a set of function for me to reuse.

Is this a valid pm and pl file?



package Test;

sub DisplaySection {
        print $_[0];
}

1;


and in my pl file(without the other stuff to make it run):

use Test;
&DisplaySection("Test12");



-----Original Message-----
From: Perrin Harkins [mailto:perrin@;elem.com]
Sent: Friday, October 25, 2002 4:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Making a module-It can't be this hard.


Robert Covell wrote:
> I simply want to make a module so I can reuse a common header instead of
> manually changing each page.  Under mod-perl how do you simply create a
> module that I can use/require/include that I can call a
subroutine/function
> to generate some html based on the page you are on.
>
> It works 5 out of 10 times.  When it fails I get:
>
> [Fri Oct 25 14:24:05 2002] [error] Undefined subroutine
> &Apache::ROOTvirusmailcenter_2erolet_2ecom::index_2epl::DisplaySection
> called at /mnt/data1/www/htdocsM/mailcenter/index.pl line 410.

It sounds like you are using perl4-style libs that don't declare a
package name.  You can find a description of the problem and some
solutions here:
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modu
les_and_libs

The basic fix is to give your modules unique package names.  See the
perlmod man page for more on package names.

- Perrin


Reply via email to