====== CGI Programming on SDF ====== Aside from putting Javascript in your web pages that run in visitors' to your web pages browsers, you can run server side programs called from browsers. This is referred to as "CGI Programming" (CGI stands for "Common Gateway Interface") which you can do here on SDF. Here is good starter information in the SDF FAQ system: https://sdf.org/?faq?WEB?02 Here are some further tips: * [[cgi_passing_parameters|Passing parameters to a CGI script]] - example of setting up a CGI script that can process parameters in the URL * [[https://hea-www.harvard.edu/~fine/Tech/cgi-safe.html |Safe CGI]] - at the User level, you can run CGI scripts in your web space, but it can be tricky, so you should consult this guide * if you want to try creating CGI with the **bash** shell language, [[http://bashlib.sourceforge.net/ |bashlib]] is an old tool that may help * If you are interested in **Perl CGI** programming: * [[https://metacpan.org/dist/CGI/view/lib/CGI.pod#CGI.pm-HAS-BEEN-REMOVED-FROM-THE-PERL-CORE| **Don't use the old CGI.pm for perl CGI anymore**]] - **At ARPA level, you can write CGI scripts in perl**, but you shouldn't use old perl CGI package recipes to do so, because like bash CGI, it's not very safe. Instead, use one of the following modern replacements: * Use //CGI::Tiny//, a non-framework modern replacement for standalone perl CGI: [[https://metacpan.org/pod/CGI::Alternatives#BUT-I-DON'T-WANT-TO-USE-A-FRAMEWORK | Perl CGI But I Don't Want to Use a Framework]]. You can easily install in your user perl library, and it works great! Mojo Templates are installed on both the SDF cluster and on the metaarray, and CGI::Tiny works with (safe) templates to prevent XSS, plus [[https://metacpan.org/dist/CGI-Tiny/view/lib/CGI/Tiny/Cookbook.pod#Templating | it works with other template engines]] which the docs have examples for. * Use [[https://metacpan.org/pod/CGI::Alternatives#Plack-As-A-Run-On-Demand-CGI-Script| Plack]], it can be set up in your SDF space and run as CGI even though it's designed around a web framework and its own webservers. * Mojolicious and Mojolicious Lite are well-known Perl CGI frameworks, but at present do not work on SDF.