Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ASP

use perl modules in Apache::ASP

 

 

ModPerl asp RSS feed   Index | Next | Previous | View Threaded


soren at tauberlassen

Apr 17, 2004, 8:20 AM

Post #1 of 4 (2002 views)
Permalink
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


hz at hzlabs

Apr 17, 2004, 1:10 PM

Post #2 of 4 (1824 views)
Permalink
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 [at] perl
For additional commands, e-mail: asp-help [at] perl


hz at hzlabs

Apr 19, 2004, 2:11 AM

Post #3 of 4 (1851 views)
Permalink
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 [at] perl
For additional commands, e-mail: asp-help [at] perl


soren at tauberlassen

Apr 19, 2004, 12:12 PM

Post #4 of 4 (1879 views)
Permalink
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 [at] perl
For additional commands, e-mail: asp-help [at] perl

ModPerl asp RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.