You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Frantzcy Paisible <fr...@softvoyage.com> on 2003/09/24 22:44:14 UTC
defined, but undefined
Hi,
I've just read the 79 pages long http://perl.apache.org/docs/1.0/guide/porting.html but I still cannot see the light... and franckly it kind off confused me.
I'm trying to migrate from perl to mod_perl. I've tried Apache::PerlRun it works, but it's not enough. I'm aiming for Apache::Registry.
Let me explain :
ScriptA
require 'config.lib';
%x=&read_query_string;
ScriptB
require 'confib.lib';
%x=&read_query_string;
config.lib
require 'lib1.lib';
require 'lib2.lib';
require 'lib3.lib';
lib1.lib
sub read_query_string
This show the hierarchy of the requires.
If I restart the apache server (single process mode), and run ScriptA, everything ok. But ScriptB will break on "Undefined subroutine &Apache::ROOT::cgi_2dbin::ScriptB_2ecgi::read_query_string"
I've tried putting the entire content of ScriptA and ScriptB in subs and running the subs... no luck...
I've tried to load them in httpd.conf (PerlRequire /path/to/lib1.lib).. no luck
(not sure on how to access the functions)
Any help would be grately appreciated
thanX in advance
Frantzcy
--
Unreachability is bliss
Re: defined, but undefined
Posted by Frantzcy Paisible <fr...@softvoyage.com>.
Thanx! That seems to work, i'll get it running like this and then convert to PM...
My first goal is fasterm memory I have... then I'll make it less memory hungry...
Thanx for your help...
Frantzcy
On 24 Sep 2003 17:03:43 -0400,Perrin Harkins <pe...@elem.com> wrote:
> On Wed, 2003-09-24 at 16:54, Frantzcy Paisible wrote:
> > Yes, I saw that, but was kind off trying to avoid it.
> > Is it the "only" way ? I have lots f "legacy" code in those lib file.
>
> It's definitely the best way to do it, but if you must, you can do this
> instead:
>
> BEGIN {
> do 'lib1.lib';
> }
>
> That uses more memory though.
>
> - Perrin
--
Unreachability is bliss
Re: variable exporting
Posted by Frantzcy Paisible <fr...@softvoyage.com>.
duh!
Sorry, in all the moving around they , it kinda disapeared. I got some other issues with some requires and uses... think I can handle them
Thanx for your help
Frantzcy
On 26 Sep 2003 11:58:25 -0400,Perrin Harkins <pe...@elem.com> wrote:
> On Fri, 2003-09-26 at 11:53, Frantzcy Paisible wrote:
> > I PerlModule the package directy via httpd.conf
>
> You have to also use the module from your Registry script if you want
> the import to happen.
>
> - Perrin
--
Unreachability is bliss
Re: variable exporting
Posted by Perrin Harkins <pe...@elem.com>.
On Fri, 2003-09-26 at 11:53, Frantzcy Paisible wrote:
> I PerlModule the package directy via httpd.conf
You have to also use the module from your Registry script if you want
the import to happen.
- Perrin
Re: variable exporting
Posted by Frantzcy Paisible <fr...@softvoyage.com>.
The command line does not work, I get the undefined error..,
My exporting is basically a copy-paste from the docs. With or without the BEGIN, no go..
Can't find init1
Note:
I PerlModule the package directy via httpd.conf
I even put init in EXPORT, instead of EXPORT_OK
#BEGIN {
use Exporter ();
use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@EXPORT_OK = qw();
@EXPORT = qw(init1);
%EXPORT_TAGS = (
vars => [qw($fname $lname)],
subs => [qw(reread_conf untaint_path)],
);
Exporter::export_ok_tags('vars');
Exporter::export_ok_tags('subs');
#}
Frantzcy
On 26 Sep 2003 11:40:25 -0400,Perrin Harkins <pe...@elem.com> wrote:
> On Fri, 2003-09-26 at 11:21, Frantzcy Paisible wrote:
> > I've converted all perl4 .lib files to .pm.
>
> Hooray!
>
> > I've exported the sub names, but I still get the "undefined" error.
>
> Probably a bug in your exporting code. Does it find the sub from a
> command-line test? perl -e 'use MyModule; my_exported_sub();'
>
> - Perrin
--
Unreachability is bliss
Re: variable exporting
Posted by Perrin Harkins <pe...@elem.com>.
On Fri, 2003-09-26 at 11:21, Frantzcy Paisible wrote:
> I've converted all perl4 .lib files to .pm.
Hooray!
> I've exported the sub names, but I still get the "undefined" error.
Probably a bug in your exporting code. Does it find the sub from a
command-line test? perl -e 'use MyModule; my_exported_sub();'
- Perrin
variable exporting
Posted by Frantzcy Paisible <fr...@softvoyage.com>.
Hi all,
I've converted all perl4 .lib files to .pm. Now I cannot access my subs without specifying the full name Packname::SubName.
I've exported the sub names, but I still get the "undefined" error.
Any ideas ?
Frantzcy
Re: defined, but undefined
Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2003-09-24 at 16:54, Frantzcy Paisible wrote:
> Yes, I saw that, but was kind off trying to avoid it.
> Is it the "only" way ? I have lots f "legacy" code in those lib file.
It's definitely the best way to do it, but if you must, you can do this
instead:
BEGIN {
do 'lib1.lib';
}
That uses more memory though.
- Perrin
Re: defined, but undefined
Posted by Frantzcy Paisible <fr...@softvoyage.com>.
Yes, I saw that, but was kind off trying to avoid it.
Is it the "only" way ? I have lots f "legacy" code in those lib file.
Frantzcy
On 24 Sep 2003 16:53:35 -0400,Perrin Harkins <pe...@elem.com> wrote:
> On Wed, 2003-09-24 at 16:44, Frantzcy Paisible wrote:
> > ScriptB will break on "Undefined subroutine &Apache::ROOT::cgi_2dbin::ScriptB_2ecgi::read_query_string"
>
> http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs
>
> You need to make your perl4-style .lib files into real perl5 modules
> with package declarations.
>
> - Perrin
--
Unreachability is bliss
Re: defined, but undefined
Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2003-09-24 at 16:44, Frantzcy Paisible wrote:
> ScriptB will break on "Undefined subroutine &Apache::ROOT::cgi_2dbin::ScriptB_2ecgi::read_query_string"
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs
You need to make your perl4-style .lib files into real perl5 modules
with package declarations.
- Perrin