Mailing List Archive

use perl modules in Apache::ASP
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
Re: use perl modules in Apache::ASP [ In reply to ]
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
Re: use perl modules in Apache::ASP [ In reply to ]
Hi S=F8ren,

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=20
"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,
> =20
> 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.
> =20
> E.g. test.asp needs to use test.pl in order to access the subroutine =
test.
> =20
> -----------
> Apache server
> Apache:ASP
> Win2000 Server
> -----------
> =20
> /Soren
> =20
>


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
RE: use perl modules in Apache::ASP [ In reply to ]
Great!

Thanks guys! Your suggestions were very helpful. I can now make it work.

/Søren



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org