>> Is this a pure CGI environment, 

Yes!

>> or are you running under mod_perl or similar? 

No!

>> Are you sure there is no package statement before the declaration of usedLater? 

None except the one saying "package FooModule;".

>> Are you positive there are no typos?

Yes, I am. This is because I haven't written the code but it is part of a module that 
other people have reported be work for them. I have posted it.

To me the 1.000.000 USD question would be: Is there any way to debug this? Like for 
example print a list of all known subs at a given point in time?

Torsten

-----Ursprüngliche Nachricht-----
Von: Bob Showalter [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 13. September 2004 18:50
An: 'Schlabach, Torsten'; '[EMAIL PROTECTED]'
Betreff: RE: Undefined subroutine [...] called at [...] though sub and rou tine exist


Schlabach, Torsten wrote:
> Dear list,
> 
> I have a problem with Perl and I have no idea at all how to search for 
> it.
> 
> I have a CGI script that is calling a perl module. One function in 
> that module uses a sub which is defined only later in the source, but 
> there is a forward declaration available for the function with sub.
> Conceptionally this looks like this:   
> 
> FooModule.pm:
> 
> package FooModule;
> 
> sub usedLater;
> 
> sub theFunctionCalledFromoutside{
> 
> ...
> 
> ...
> 
> usedLater( $argument );
> 
> }
> 
> sub usedLater{
> 
> [... some code ...]
> 
> }
> 
> 1;
> 
> The call
> 
> usedLater( $argument );
> 
> leads to this errror
> 
> Undefined subroutine &FooModule::usedLater called at ...
> 
> Any idea where to search? This is code I did not write myself and 
> others have reported it worked for them unter Perl 5.8.1. I have 
> 5.8.0. I also tried with 5.8.5, but got the same error, so this does
> not look like a Perl version issue.   

The forward declaraction is not necessary. There's nothing in the snippet you posted 
to explain the error; it should be working.

Is this a pure CGI environment, or are you running under mod_perl or similar? Are you 
sure there is no package statement before the declaration of usedLater? Are you 
positive there are no typos?

--
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