[Athens-pm] cgi-html linking .... [EN Version]
Antonis Faragitakis
skatoulininis at yahoo.com
Fri Feb 21 05:55:19 CST 2003
thanks Philip, this is the answer i was looking for!
thanks for the last comments too!
Antonis
--- Philip Lees <pjlees at ics.forth.gr> wrote:
>
> I want that links when they are clicked to call
> some
> code from inside the perl script (in this case
> "login.pl" script). How can i do that, without
> the
> html's <A> tag!?
>
> This is confusing - a clickable link means that
> there _must be_ an <A>
> tag.
>
> There are two ways of invoking a perl (or other
> CGI)
> script from a Web
> page:
>
> 1. Use a form with one or more Submit buttons.
> Specify your script name
> for the form's 'action' parameter and use fields
> (hidden fields if
> necessary) to pass parameters to your script.
>
> 2. Use a direct link, e.g.
>
> <a>href="my_script.pl?
> argument1=string;argument2=123;argument3=no">
> Click this</a>
>
> If your arguments can contain spaces or strange
> characters you should
> pass them through the URI::Escape module to be
> sure
> the link will work
> on all browsers.
>
> It may be useful for you to look at the OpenECG
> Web
> site (which I
> maintain :-] ):
>
> http://www.openecg.net
>
> The main part of the site is handled by just one
> Perl script, which is
> passed arguments that tell it what to display for
> each link.
>
> The code in your login.pl script looks fine. A
> couple of comments:
>
> my %levels = (0 => "\"the bastard\"",
> 1 => "\"just another user\"",
> 2 => "\"configure it!\"");
>
> If you use single quotes you don't need to do the
> escaping, e.g.
>
> my %levels = (0 => '"the bastard"',
>
> But that's too hard to read, so use q:
>
> my %levels = (0 => q("the bastard"),
>
> Same here:
>
> $cgi->p('You\'re not logged in.',
>
> $cgi->p( q(You're not logged in.),
>
> It's good that you check the success of open:
>
> open (USERCOUNT, $file) or die ("Cannot open
> $file")
>
> but if it ever fails, you won't know why. Get the
> error message from
> perl:
>
> open (USERCOUNT, $file) or die ("Cannot open
> $file:
> $!")
>
> I hope this is of some help.
>
> Philip
> --
> Philip Lees
> Working Group on Cardiology
> ICS-FORTH, Science and Technology Park of Crete
> Vassilika Vouton, P.O. Box 1385, GR 711 10
> Heraklion, Crete, GREECE
>
> tel.: +30-2810-391680, fax: +30-2810-391601,
> e-mail:
> pjlees at ics.forth.gr
More information about the Athens-pm
mailing list