Running Perlscript on the client site

Posted by Abdulla Chekfa on Thu 23 Jan 2003 12:23 AM — 3 posts, 23,601 views.

USA #0
I am accessing an .shtml page on my web server running on W2K.

I built it using perl program, the page is an html page,
with embedded perl script.
Below is the content of the page.
I am not able to call Play_onclick when I press
"Play" button
Any Suggestion.

Note:
- when I use onclick= "script.Play_onclick()", or "window.script.Play_onclick()"
I am getting script is undefined.It looks that the my browser is not recognizing my script.


-when I move the page into client site and run as
localhost/records.shtml.
I had no problem executing the build in perl script.

Any suggestion, I had tried everything for the last 2 days.
without any luck.
Thanks,


======================
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>UpdatePage</title>
</head>
<body topmargin="100" leftmargin="100">

<script LANGUAGE="PerlScript">
$window->alert("HI! from PerlScript");
</script>
<script LANGUAGE="PerlScript">
sub Main::Play_onClick(){
my $_ItemRef= $window->document->Main;
$_SetRef=[ #This is an array of referencde but do not asking why:-)
$_ItemRef->Ess ->{'value'}, #0
$_ItemRef->Sss ->{'value'}, #1
$_ItemRef->Emmm->{'value'}, #2
$_ItemRef->Smmm->{'value'}, #3

$_ItemRef->EDD->{'value'}, #4
$_ItemRef->SDD->{'value'}, #5

$_ItemRef->EMM->{'value'}, #6
$_ItemRef->SMM->{'value'}, #7

$_ItemRef->Ehh->{'value'}, #8
$_ItemRef->Shh->{'value'}, #9

$_ItemRef->EYYYY->{'value'}, #10
$_ItemRef->SYYYY->{'value'} #11
];
# Below came out as a reference to an Array
my $_String= [
" End:ss ",
" Start:ss ",
" End:mm ",
" Start:mm "
];
my $_Message= "Please: Enter number between 0-59 for";
my $_Item;

foreach $_Item (0..3)
{
if ( ($$_SetRef[$_Item] > 59) || ( $$_SetRef[$_Item] < 0 ))
{
$_Message = $_Message .$$_String[$_Item]."field";
$window->alert( $_Message);
return;
}
}

$_String= [ # This is came out as a reference to an Array
" End:DD ",
" Start:DD ",
];
$_Message= "Please: Enter number between 1-31 for";

foreach $_Item (4..5)
{
if ( ($$_SetRef[$_Item] > 31) || ( $$_SetRef[$_Item] < 1 )) # we need a special day for Feb
{
$_Message = $_Message .$$_String[$_Item - 4]."field";
$window->alert( $_Message);
return;
}

}

$_String= [ # This is came out as a reference to an Array
" End:MM ",
" Start:MM ",
];
$_Message= "Please: Enter number between 1-12 for";

foreach $_Item (6..7)
{
if ( ($$_SetRef[$_Item] > 12) || ( $$_SetRef[$_Item] < 1 ))
{
$_Message = $_Message .$$_String[$_Item - 6]."field";
$window->alert( $_Message);
return;
}
}

$_String= [ # This is came out as a reference to an Array
" End:hh ",
" Start:hh ",
];
$_Message= "Please: Enter number between 00-23 for";

foreach $_Item (8..9)
{
if ( ($$_SetRef[$_Item] > 23) || ( $$_SetRef[$_Item] < 00 ))
{
$_Message = $_Message .$$_String[$_Item - 8]."field";
$window->alert( $_Message);
return;
}
}

$_String= [ # This is came out as a reference to an Array
" End:YYYY ",
" Start:YYYY ",
];
$_Message= "Please: Enter number between 2000-3000 for";

foreach $_Item (10..11)
{
if ( ($$_SetRef[$_Item] > 3000) || ( $$_SetRef[$_Item] < 2000 ))
{
$_Message = $_Message .$$_String[$_Item - 10]."field";
$window->alert( $_Message);
return;
}
}
}#endof PlayImages

#sub Play_onclick(){
# $window->alert("Hello World");
# Play_onClick()
#}
</script>
<form method="POST" name="Main">

<p align="center">Start:<input type="text" name="SYYYY" size="4" maxlength="4" style="text-align: Center" value= 2003>:
<input type="text" name="SMM" size="4" maxlength="2" style="text-align: Center" value= 01>:
<input type="text" name="SDD" size="4" maxlength="2" style="text-align: Center" value= 14>:
<input type="text" name="Shh" size="4" maxlength="2" style="text-align: Center" value= 09>:
<input type="text" name="Smmm" size="4" maxlength="2" style="text-align: Center" value= 26>:
<input type="text" name="Sss" size="4" maxlength="2" style="text-align: Center" value= 20>
<input type="submit" value="Update" name="B1" ></p>
<p align="center"><font face="Times New Roman" size="2">YYYY:MM:DD:hh:mm:ss</font></p>
<p align="center">End :<input type="text" name="EYYYY" size="4" maxlength="4" style="text-align: Center" value= 2003>:
<input type="text" name="EMM" size="4" maxlength="2" style="text-align: Center" value= 01>:
<input type="text" name="EDD" size="4" maxlength="2" style="text-align: Center" value= 22>:
<input type="text" name="Ehh" size="4" maxlength="2" style="text-align: Center" value= 16>:
<input type="text" name="Emmm" size="4" maxlength= "2" style="text-align: Center" value= 15>:
<input type="text" name="Ess" size="4" maxlength="2" style="text-align: Center" value= 09>
<input name="Play" type=Button value=" Play " onClick= "script.Play_onClick()"></input>
</p>
</form>


</body>
</html>

==================== End of page================
USA #1
I was ablt to solve my own problem, I thought it may be a good idea to pass the solution so others can benefit from.

It turns out that the default setup for perlscipt, I am using the latest version for Activestate, in the registry is as follow:

HKEY_LOCAL_MACHNE\SOFTWARE\ActiveState\perlscript\1.0
REG_DWORD:EnabledZones= 0x0010(default)

values:
-Enable all 0x0001
-Eable local 0x0010
-Enable Internet 0x0020
-Enable Trusted 0x0040
-Enable Restricted 0x0080 ( for the perverse)

All what I need to do is use Enable Trusted, user has to be very careful to use Enable all and Enable Internet.
Then, I enterd my own server IP as trusted in the IE browser.
Now I can have my perscript executed like a charm.
USA #2
...I hope I never have to anything with PERL *dies*