473,665 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running Perl Script from within javascript

von
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want to write
that data to a text file on my server via a Perl script (that I also already
have).

Both scripts work great - I just don't know how to make them work together.

Is this even possible?

Thanks in advance for all input.

:)
Jul 23 '05 #1
6 5366
von spilled the following:
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want to
write that data to a text file on my server via a Perl script (that I also
already have).

Both scripts work great - I just don't know how to make them work
together.

Is this even possible?

Thanks in advance for all input.

:)


Sort of....you can open a window or an iframe from javascript, and you can
post a form. So you can send parmeters serverside in a GET or load a form
from the server, populate it then POST it. The latter solution, although
more laborious, saves a lot of messing around with URL encoding.

HTH

C.
Jul 23 '05 #2
von
Thanks for your input Colin.

What I really want to accomplish is to take, say ...

=============== ====
'Function Data1 ()'
{
[script here];

}
=============== ====

and then send the results of 'Data1' to a text file on my server - all
without any windows popping up and without requiring any user input.

:)
"Colin McKinnon"
<co************ **********@ntlw orld.deletemeun lessURaBot.com> wrote in
message news:tp******** *******@newsfe5-win.ntli.net...
von spilled the following:
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want to
write that data to a text file on my server via a Perl script (that I
also
already have).

Both scripts work great - I just don't know how to make them work
together.

Is this even possible?

Thanks in advance for all input.

:)


Sort of....you can open a window or an iframe from javascript, and you can
post a form. So you can send parmeters serverside in a GET or load a form
from the server, populate it then POST it. The latter solution, although
more laborious, saves a lot of messing around with URL encoding.

HTH

C.

Jul 23 '05 #3

"von" <vo*@vonvon.com > wrote in message
news:N4******** ************@co mcast.com...
Thanks for your input Colin.

What I really want to accomplish is to take, say ...

=============== ====
'Function Data1 ()'
{
[script here];

}
=============== ====

and then send the results of 'Data1' to a text file on my server - all
without any windows popping up and without requiring any user input.

:)

XMLHTTPRequest

Jul 23 '05 #4
How much data? If a small amount then

var i=new Image();
i.src="pathtoyo urscript.pl?dat a=" + yourdata;

will work fine. But the HTTPRequest path is more robust....

Tim.

"von" <vo*@vonvon.com > wrote in message
news:Z-*************** *****@comcast.c om...
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want
to write that data to a text file on my server via a Perl script
(that I also already have).

Both scripts work great - I just don't know how to make them work
together.

Is this even possible?

Thanks in advance for all input.

:)

Jul 23 '05 #5
This is a bit rough but will allow you to send moderate amounts of
data and get back a status response.

Tim
<HTML>
<HEAD>
<TITLE>Cookie Remote Scripting</TITLE>

<SCRIPT type="text/javascript">

var ErrorTimeoutSec =1.5;
var CookieName="cTe st";
var tOut=null;
var NoResponse="No response";
var sImage=null;

function doIt(sMsg){
delCookie(Cooki eName);
var sURL="getInfo.a sp?v="+escape(s Msg)+"&x="+esca pe(new Date());
sImage=new Image();
sImage.onload=f unction(){showM sg(true)};
tOut=window.set Timeout("showMs g(false)", ErrorTimeoutSec *1000);
sImage.src=sURL ;
}

function delCookie(key){
var d = new Date();
d.setDate(d.get Date() - 2);
document.cookie = key+'=deleted; expires='+d.toG MTString()+';';
}
function showMsg(bOK){
sImage=null;
if(tOut)window. clearTimeout(tO ut);
var el=document.get ElementById('sA nswer');
if(bOK){
el.innerHTML=ge tCookie(CookieN ame);
}else{
el.innerHTML=No Response;
}
}
function getCookie(sName ) {

var dc = document.cookie ;
var arrC=dc.split(" ;");
var tc;
var retVal="No value"

for(x=0;x<arrC. length;x++){
tc=arrC[x].split("=");
tc[0]=tc[0].replace(" ","")
if(tc[0]==sName)retVal = unescape(tc[1]);
}

return retVal;
}

</SCRIPT>
</HEAD>
<BODY>
<input type="text" size=20 id='vInput' value="blah">
<A href="#"
onclick="doIt(d ocument.getElem entById('vInput ').value);retur n false">
Call</a><br />
<span id='sAnswer'></span>
</BODY>
</HTML>


"von" <vo*@vonvon.com > wrote in message
news:Z-*************** *****@comcast.c om...
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want
to write that data to a text file on my server via a Perl script
(that I also already have).

Both scripts work great - I just don't know how to make them work
together.

Is this even possible?

Thanks in advance for all input.

:)


Jul 23 '05 #6
von
Thanks Tim.

I sent you an email.

What I am actually doing is generating a small amount of data via the
Javascript - for example an IP address (though that is not it) and then I
want to send that piece of information to a log - that can be viewed via a
URL.

The script works great when outputting this info to the screen - but I want
it sent to a file to store.

I don't really want it writing back to the screen so the response is not
necessary. I also want this completely invisible to the user.

Thanks for all your input Tim. :)
-Von
"Tim Williams" <sa************ @THISpacbell.ne t> wrote in message
news:W2******** *********@newss vr24.news.prodi gy.net...
This is a bit rough but will allow you to send moderate amounts of data
and get back a status response.

Tim
<HTML>
<HEAD>
<TITLE>Cookie Remote Scripting</TITLE>

<SCRIPT type="text/javascript">

var ErrorTimeoutSec =1.5;
var CookieName="cTe st";
var tOut=null;
var NoResponse="No response";
var sImage=null;

function doIt(sMsg){
delCookie(Cooki eName);
var sURL="getInfo.a sp?v="+escape(s Msg)+"&x="+esca pe(new Date());
sImage=new Image();
sImage.onload=f unction(){showM sg(true)};
tOut=window.set Timeout("showMs g(false)", ErrorTimeoutSec *1000);
sImage.src=sURL ;
}

function delCookie(key){
var d = new Date();
d.setDate(d.get Date() - 2);
document.cookie = key+'=deleted; expires='+d.toG MTString()+';';
}
function showMsg(bOK){
sImage=null;
if(tOut)window. clearTimeout(tO ut);
var el=document.get ElementById('sA nswer');
if(bOK){
el.innerHTML=ge tCookie(CookieN ame);
}else{
el.innerHTML=No Response;
}
}
function getCookie(sName ) {

var dc = document.cookie ;
var arrC=dc.split(" ;");
var tc;
var retVal="No value"

for(x=0;x<arrC. length;x++){
tc=arrC[x].split("=");
tc[0]=tc[0].replace(" ","")
if(tc[0]==sName)retVal = unescape(tc[1]);
}

return retVal;
}

</SCRIPT>
</HEAD>
<BODY>
<input type="text" size=20 id='vInput' value="blah">
<A href="#" onclick="doIt(d ocument.getElem entById('vInput ').value);retur n
false"> Call</a><br />
<span id='sAnswer'></span>
</BODY>
</HTML>


"von" <vo*@vonvon.com > wrote in message
news:Z-*************** *****@comcast.c om...
Is it possible to run a Perl script from within a javascript?

I have an existing javascript that provides some data - and I want to
write that data to a text file on my server via a Perl script (that I
also already have).

Both scripts work great - I just don't know how to make them work
together.

Is this even possible?

Thanks in advance for all input.

:)



Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2782
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone take a look at the code and tell me why I am getting Apache Server errors in the code below (Part A), when I modify the code as shown in part B the errors go but the JS does not run ?? Part A.
6
15887
by: Richard Trahan | last post by:
I want a js function to call a Perl script residing on a server. The Perl script will return a string, to be used by the js. Pseudo code: <script> stringvar = perlfunc_on_server(stringarg) document.write(stringvar) </script> Can stringvar above be a url?
10
2555
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all the capabilities of what I have available. I can learn the details myself I think. I am trying to set this up to be as simple to use as possible since others will be importing data on a weekly or daily basis. I need to import some text files,...
2
6747
by: Gemma M | last post by:
Hi, I have a C# program which obtains a string from a database containing VBScript, or JavaScript, or Perl script, and I want C# to be able to run it. In VB6 (COM), I used MSScriptControl.ScriptControl from scrrun.dll ("Microsoft Scripting Runtime"). Is there an equivalent in C#? Or, will I have to use a PIA on scrrun.dll?
3
2158
by: Nathan Gilbert | last post by:
I am wanting to use javascript to select between different *.css files dependent on the user's browser. I am also wanting to generate the html document containing this javascript dynamically using PERL. So far, I have the javascript that does what I want to do, and it works fine as long as the the page was not generated by PERL. My problem is that when the javascript/html is generated by my PERL scripts the javascript never gets...
0
1418
by: 123jainmin | last post by:
When I ran a perl script named script.pl which have the the follwing line: system("echo hostname = $HOSTNAME > /tmp/myinfo"); I have another shell script script.ksh which simply call script.pl within the script. the permission on script.ksh is: -rwsr-sr-x WHen I ran script.ksh, I got the error message: Insecure dependency in `` while running setuid at script.pl line 4. If I do not use $HOSTNAME in script.pl, I have no trouble at all. Could...
1
3609
by: bpejman | last post by:
Hi Everyone, I've been reading and searching the web for days trying to figure out how exactly you can access and read a Perl array or hash from within JavaScript. I've been reading that JSON is the way to go, but non explain exactly how. If you can help me out, I would really appreciate it. Here's the scenario I have... I have a perl file called index.pl and in this file I have the below code. I know that arrays are converted to...
12
1712
by: Peter Michaux | last post by:
I'm writing a server-side web application framework using Mozilla's Rhino JavaScript engine. My two primary motivations are so I can write code on server and client sides without needing to switch gears mentally and so that the server and client can share code. The types of code sharing I know I can use immediately are form validations and html previews. For form validation, I'll be able to specify the regexp for what is an email address...
3
3900
by: happyse27 | last post by:
Hi All, I am creating the perl script using html form(with embedded javascript inside). When using this html form with javascript alone, it works where the form validation will pop up javascript windows to say the field is not keyed into properly. However, when i convert this html(with javascript inside) into perl script, the perl script did not validate when i keyed incorrect data in the form and it straight away executed perl script...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.