Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 17th, 2007, 9:20 PM   #1
ibanex22
Newbie
 
Join Date: Feb 2007
Posts: 2
Rep Power: 0 ibanex22 is on a distinguished road
Send a message via AIM to ibanex22
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!
ibanex22 is offline   Reply With Quote
Old Feb 17th, 2007, 9:57 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Feb 18th, 2007, 11:27 AM   #3
ibanex22
Newbie
 
Join Date: Feb 2007
Posts: 2
Rep Power: 0 ibanex22 is on a distinguished road
Send a message via AIM to ibanex22
would it? is there a safe/other way to do it?
ibanex22 is offline   Reply With Quote
Old Mar 22nd, 2007, 5:32 PM   #4
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
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?"
mackenga is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:47 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC