Hi all,
I have written a handler to take care of requests and there is something
unexpected [to me, anyway :-) ] happening which may be my fault, but I
was wondering if someone can explain it to me. Perhaps there is a
problem with my programming style.
The code is long, so I'll briefly mention what I think is relevant
[hopefully I don't leave anything out]. I have a handler called
myHandler.pl:
-----
## File myHandler.pm
package myHandler;
use lib 'my Path';
use myOwnFunctions; ## Located in "my Path"
my $ah = HTML::Mason::ApacheHandler -> new (...);
sub handler {
my $r = shift;
$ah -> handle_request ($r);
}
1;
-----
In the file myOwnFunctions.pl:
----
package myOwnFunctions;
sub myFunction {
}
1;
-----
So in an HTML file that will be processed by Mason, I call "myFunction
()" and it says it is undefined. This surprised me since I indicated
that I am using myOwnFunctions in the handler with the "use" directive.
Is that not the way to do it? So, then I thought I should call
myFunction as:
myOwnFunctions::myFunction ()
and that gave me an error. By accident, I typed:
myHandler::myFunction ()
and that worked... I don't quite know why. I presume I have done a
mistake somewhere. Or is this how it should be?
Thanks!
Ray