Apr 17, 2004, 1:10 PM
Post #2 of 4
(3785 views)
Permalink
Hi Søren,
several ways:
1) in your asp file:
..
do 'test.pl';
subroutine();
..
or "do 'path/test.pl'" if test.pl is in another path than your asp script.
2) in your apache.conf:
..
PerlRequire path/test.pl
..
important: test.pl must return a true value e.g. must end with "1;" and
your subroutine(s) must be
prepended with the package name you gave in the "PerSetVar GlobalPackage"
directive,
e.g. in test.pl:
..
sub GP::testsub {
..
and call it in your asp:
..
GP::testsub();
..
3) convert the test.pl to the perl module test.pm.
Please read "man perlmod" for this, there also exists a script
"pl2pm" (at least i think, this is the name?) which converts a pl file to a
pm file.
4) in your test.pl:
remove the "#!/usr/bin/perl" (or similar) line and put a "<%" at the begin
and a "%>" at the end of the file
and rename it "test.inc" (for example)
In your asp:
..
$Response->Include ('test.inc")
..
(of course before calling the subrouine)
May be there are more ways..
Helmut
> Hi all,
>
> Is it possible to include/use an external PERL module in an ASP page?
> I have a ASP page that needs to access subroutines placed in a PERL file.
>
> E.g. test.asp needs to use test.pl in order to access the subroutine test.
>
> -----------
> Apache server
> Apache:ASP
> Win2000 Server
> -----------
>
> /Soren
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org