You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Mark McWiggins <ma...@IcanFixYourEmail.com> on 2005/01/25 03:56:55 UTC

How to call functions in other files?

Hi Everybody,

I'm trying something like:

db.pl:

godone()
{
    # do something

}

---
NewNoticeSubmitPart1.pl:

require "db.pl";

godone($q,"SessExpired.html");

--

But I get:

[Mon Jan 24 18:51:56 2005] [error] Undefined subroutine 
&ModPerl::ROOT::ModPerl::Registry::usr_local_apache2_htdocs_eTracICR_perl_NewNoticeSubmitPart1_2epl::godone 
called at 
/usr/local/apache2/htdocs/eTracICR/perl/NewNoticeSubmitPart1.pl line 16, 
<F> line 20.\n

---

How do I do this sort of thing? It works fine in regular CGI.

Thanks much.

Mark Mc
425-369-8286


Re: How to call functions in other files?

Posted by Perrin Harkins <pe...@elem.com>.
Mark McWiggins wrote:
> [Mon Jan 24 18:51:56 2005] [error] Undefined subroutine 
> &ModPerl::ROOT::ModPerl::Registry::usr_local_apache2_htdocs_eTracICR_perl_NewNoticeSubmitPart1_2epl::godone 
> called at 
> /usr/local/apache2/htdocs/eTracICR/perl/NewNoticeSubmitPart1.pl line 16, 
> <F> line 20.\n
> 
> ---
> 
> How do I do this sort of thing? It works fine in regular CGI.

Here's some documentation that explains it:
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs

- Perrin