in reply to Re^2: using perl on server side for secure connections
in thread using perl on server side for secure connections

I have never executed a CGI script before so I don't know if this is a perfectly good script that I don't know how to work.

CGI is a protocol for exchange of data between client and server over HTTP (that's a simplification). The important part here is the "over HTTP" bit. If you are intending to run this script over the web then you'll most likely want to construct a form (which may be static) to go with this script which will then be the form handler. There's more about CGI in the Tutorials section.

Conversely, if you are not intending to use a script like this over HTTP then it would be better and simpler not to use CGI in the first place.

It's not immediately clear to me from reading this thread what your ultimate goal is.

  • Comment on Re^3: using perl on server side for secure connections

Replies are listed 'Best First'.
Re^4: using perl on server side for secure connections
by Aldebaran (Curate) on Sep 18, 2018 at 01:35 UTC

    Thank you for the reference, hippo, I was able to do a couple things that move my aspirations forward. I use a bash script to set the envelope conditions, wrap the perl upload, and wrap the output with monastery tags. It doesn't quite work but I get enough output to move forward.

    Here is a listing of the uploaded file:

    remote dir is /perlmonks/scripts/cgi . .. 1.color.cgi -------cat uploaded file #!/usr/bin/perl -wT use 5.011; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # declare the colors hash: my %colors = ( red => "#ff0000", green=> "#00ff00", blue => "#0000ff", black => "#000000", white => "#ffffff" ); # print the html headers print header; print start_html("Colors"); foreach my $color (keys %colors) { print "<font color=\"$colors{$color}\">$color</font>\n"; } print end_html; __END__

    This is the result of the filename as a command:

    -------executing 1.color.cgi Content-Type: text/html; charset=ISO-8859-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>Colors</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <font color="#000000">black</font> <font color="#ffffff">white</font> <font color="#00ff00">green</font> <font color="#0000ff">blue</font> <font color="#ff0000">red</font> </body> </html>

    And this completes the goal I had for this thread, to upload and execute a perl CGI script. Thanks all for comments,