![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
perl cgi 'clickable' link
i am wondering if anyone knows how to make a "clickable" link that issues a perl command. something to the effect of...
print "<a href='perl command...'>command</a>"; i am trying to have clickable links to print values in perl. thanks! |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Why would you want to open your server up to rule by any client?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Newbie
|
would it? is there a safe/other way to do it?
|
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
You can do something like:
<A href="cginame?arg=value&arg2=value2">link</A> which will send a GET request to a Perl CGI script with some options in it. If you were crazy, you could have a CGI that expected to be passed Perl code to run in this way but any user could just tap in the URL of your CGI and pass in some perl of their choice and have your server run it, which is what DaWei was getting at. The whole idea with CGI is that there's the server side stuff and the client side stuff and the CGIs you provide and what they do with the arguments you pass them allow you to decide what it is possible for the outside world to ask for. First, understand the divide between the server (trusted) and client (could be any scum and probably will be). Your CGI provides an operation that scum can do outside in the world wide wild west that will cause something to happen in the green and pleasant land of your server. You need to think about the project you're working on and the problem you're trying to solve and figure out what things the browser is going to have to ask the server to do, and how to handle all of those things in a safe way. If your problem seems to require doing a lot of little random snippets of Perl like this instead of a few well defined operations of this kind then you're probably either not thinking about the problem properly, or trying to do something that's just basically inadviseable. It sounds to me like what you really want to do is probably just use Perl like people use PHP and ASP, with the files on the server looking basically like HTML files with bits of imperative code embedded in them. The difference is that with PHP and ASP, the code is interpreted at the server side and then its output is pumped to the client which is safe (well nothing's safe with ASP but that's another story). This means you never run code that the user might have tampered with and the user doesn't see the code you did run. Normal Perl CGIs are not done in this style. The idea is that you write a Perl program and that program outputs the (usually HTML most of the time) data that gets shipped to the client by the web server. If you'd like to use Perl in a way that looks and works more like PHP, you might be interested in embperl - google for it and you'll find it. Personally I don't like it - tends to lead to unmaintainable code if you have a lot of it - but a lot of people do and it might suit your purpose. Hope this helps.
__________________
"I'm not a genius. Why do I have to suffer?" |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bash or Perl? | titaniumdecoy | Other Scripting Languages | 9 | Jan 30th, 2006 4:42 PM |
| A simple perl script | satimis | Perl | 3 | Aug 15th, 2005 9:31 AM |
| Singly Linked List Help | Firebar | Java | 3 | May 22nd, 2005 10:56 AM |
| Why do most shared hosting services offer php not perl? | Jonnno | Perl | 5 | May 19th, 2005 3:56 PM |
| Learning and Programming Perl | G.I.Josh | Perl | 2 | Mar 23rd, 2005 1:48 PM |