Hi Jaak,
I think I can help you:
J> as I wrote:
J> I made a module testModule.pm
J> sub test {
J> print OUT "just testing..."; }
J> and test.html
J> [+ &test; +]
You could try to use a Object Oriented approach sin you are usin
EmbperlObject, like this:
in Module.pm:
package MyModule;
new {
my $class = shift;
return bless {}, $class;
}
test {
my $self = shift;
return 'String returned';
}
other functions...
In the html files you can use the [++] to print values:
[- use MyModule;
$obj = new MyModule;
-]
<html>
...
<p>[+ $obj->test +]</p>
...
</html>
J> I use file main.epl where:
J> [- use testModule ; -]
J> [- Execute ('*') -]
J> Now when I call test.html. Program cannot find testModule.pm
J> (when I use testModule on the same page it's OK).
J> How can I define testModule.pm for site wide use?
To solve this put the object in the $req variable returned as the
first argument in @_ to every page you load, this way they become
"Globals":
in main.epl:
[- use MyModule; # Or if you use mod_perl you should use [!!]
# instead
$req = shift;
$obj = new MyModule;
$req->{obj} = $obj; # This way you can retrieve the object in any
# file you Execute
-]
...
[- Execute ('*') -]
...
In other files:
[-
$req = shift;
$obj = $req->{obj};
-]
[+ $obj->test +]
Good luck,
Luiz Fernando B. Ribeiro
----------------------------
At Home - Design e Internet
[EMAIL PROTECTED]
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]