I believe this should aid you a little:
http://search.cpan.org/author/DROLSKY/HTML-Mason-1.13/lib/HTML/Mason.pm

for putting Perl into HTML directly ( like PHP, ASP )
----- Original Message -----
From: "Mike Craig" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 19, 2002 10:04 PM
Subject: How can I call a Perl function from HTML?


> Hi all,
>
> I have a perl function that I would like to call from inside a JavaScript
> function in a Web page. I want to pass it a string param and return an
> integer. The function is shown here is fabricated just to reduce the
example
> to the bare minimum.
>
> #!/usr/bin/perl
>
> sub SomeFunction {
>     $StrVar = $_[0];
> #Some test on the param passed
> if ($StrVar eq 'This is a test')
> return 1;
> else
> return 0;
> }
>
> What I would like to do is to call my function from inside some JavaScript
> i.e.
>
> <SCRIPT LANGUAGE="JavaScript">
> <!-- Begin
>
> function Ok(SomeString){
> if (SomeFunction(SomeString))
> return true;
> else
> return false;
> }
>
> //-->
> </SCRIPT>
>
> ///////////////
> I would appreciate it if you can tell me how I can ensure the Perl
function
> is available in the JavaScript and if there is anything I need to do to
> ensure the parameter is passed correctly.
>
>
> In JavaScript I can save the script on the server and call in the
functions
> into the page with the following
>
> <SCRIPT SRC="Functions.js" LANGUAGE="JavaScript" TYPE="text/javascript">
> <!--
> //-->
> </SCRIPT>
>
> <SCRIPT LANGUAGE="JavaScript">
> <!-- Begin
>
> function Ok(SomeString){
> if (SomeFunctionInJs(SomeString)) //Some test
> return true;
> else
> return false;
> }
>
> //-->
> </SCRIPT>
>
////////////////////////////////////////////////////////////////////////////
>
> Best regards
>
>
> Mike Craig
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to