•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 423,490 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,685 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 1010 | Replies: 4
![]() |
•
•
Join Date: Jun 2008
Posts: 11
Reputation:
Rep Power: 1
Solved Threads: 0
Hi there,
I'm trying to open up a text file read info from it, alter it and write back the alterations when a user clicks on the save button, but I've hit two issues:-
1) I can't open the file for write access as I don't have permissions - can I alter a files permissions during a program using chmod? I've tried to alter it by hand in an ftp window (to 755 from 666) but it just stays the same.
2) A button (in perl) calls a java function only as far as I can find out, can I use it to call a perl function instead? if so could I have an example like this:-
update_file() being the perl sub that I'd like to call.
If I can't do this and have to call a java function can I then call the perl sub from there instead, I've tried it like this but it doesn't do anything so I'm presuming it doesn't work:-
many thanks in advance for your help
Sarah
I'm trying to open up a text file read info from it, alter it and write back the alterations when a user clicks on the save button, but I've hit two issues:-
1) I can't open the file for write access as I don't have permissions - can I alter a files permissions during a program using chmod? I've tried to alter it by hand in an ftp window (to 755 from 666) but it just stays the same.
2) A button (in perl) calls a java function only as far as I can find out, can I use it to call a perl function instead? if so could I have an example like this:-
print "<button type=button onClick=\"update_file()\">Save1</button>";
update_file() being the perl sub that I'd like to call.
If I can't do this and have to call a java function can I then call the perl sub from there instead, I've tried it like this but it doesn't do anything so I'm presuming it doesn't work:-
print "function update_file ()\n";
print "{";
print "update_input_filehandle_with_local_text ()";
print "}\n";many thanks in advance for your help
Sarah
javascript and perl are two entirely different things. Perl has no concept of javascript and the same is true in reverse. What you need to do is a send some data to your perl script via a CGI form and use that data to tell your perl script what to do, like run a certain subroutine in your perl script.
As far as the chmod goes, it is possible to change file permission with perl, use perls chmod function.
http://perldoc.perl.org/functions/chmod.html
As far as the chmod goes, it is possible to change file permission with perl, use perls chmod function.
http://perldoc.perl.org/functions/chmod.html
Last edited by KevinADC : Jun 12th, 2008 at 8:58 pm.
javascript can only communicate with the perl script via the form. Do whatever you want with the javascript, but it has to set a form field to some value and then send the form data back to the perl script to process the data. Perl then accepts the data, processes it, and sends data back to the browser. But there is never any direct interaction between perl and javascript, they operate in two different environments, they can only communicate via the form.
Perl can print javascript while it outputs html back to the web browser and fill in javascript code with whatever data is needed by the javascript to run in the web browser, but once perl outputs the html/javascript code to the web browser it has no concept of what occurs after that until some form data is sent back to the perl script via the form.
There is also AJAX which is a blending of javascript and CGI scripting, but the process is essentially the same as described above although the interaction in the web browser looks different.
Perl can print javascript while it outputs html back to the web browser and fill in javascript code with whatever data is needed by the javascript to run in the web browser, but once perl outputs the html/javascript code to the web browser it has no concept of what occurs after that until some form data is sent back to the perl script via the form.
There is also AJAX which is a blending of javascript and CGI scripting, but the process is essentially the same as described above although the interaction in the web browser looks different.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: plz help...urgent
- Next Thread: Can you have any idea or algorithm about permutation of Keywords in Perl.



Linear Mode