PyrexKidd has asked for the wisdom of the Perl Monks concerning the following question:

Personally I prefer to run everything from the CLI.

I have written a number of tools that I run from the CLI. My `uppers` have requested that I make my CLI tools available for use by the "non-geek guys" (Dunno if you can tell but the VP of operations is a sales guy...)

What are my options as far as Interfacing with Perl? I've seen the ability to write Perl in PHP, but at that point I'd be learning a new language anyway, so it would make more sense to just write it in PHP right? I've seen something about MOD_Perl, but I'm not sure how to use it for writing web pages.

My thinking is a web interface would be the easiest/best as the server is already running an Apache server, but I am not set on any one approach.

Any thoughts would be greatly appreciated.

Replies are listed 'Best First'.
Re: Perl UI?
by marto (Cardinal) on Oct 14, 2010 at 15:43 UTC
Re: Perl UI?
by AndyZaft (Hermit) on Oct 14, 2010 at 15:20 UTC
    There is no need to involve PHP if you don't want to. Your first step probably should be to look into simple CGI driven pages (mod_perl is one place to start). Once you understand the concept it will take you no time to create an interface that calls your tools and spits back result into HTML instead of STDOUT. If you need inline code in HTML like PHP, JSP, ASP does you can look for embPerl and similar solutions.
Re: Perl UI?
by zentara (Cardinal) on Oct 14, 2010 at 16:43 UTC
    a number of tools that I run from the CLI.....available for use by the "non-geek guys"

    You mentioned PhP, but do you also require that they run it thru a web interface? I mean, if they are commandline programs, would a simple GUI (Graphical User Interface) be ok, so they could run the program on their own computers? If so, you have a wide choice of GUI toolkits to choose from.

    There is Tk, Tkx, Gtk2, and Wx just for starters. You could write simple little programs that let the non-geeks click on a button to run some CLI of yours. It would be alot easier than dealing with all the permissions problems that a web based program will present.

    I'm just mentioning it. Do the non-geeks have the need to run the program from anywhere on the internet? If not, why expose your CLI program to the world?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Perl UI?
by dwm042 (Priest) on Oct 14, 2010 at 18:43 UTC
    This might fit in the overkill category, but I went from knowing nothing about Catalyst to having a running DNS zone file editor in Catalyst, with differing user and admin access, in 7 days. This, while recovering from a hernia operation.

    Catalyst is a stunningly fast development platform for a web app, and lends itself to combined CGI-web tools, by the nature of its design.

    And to those who have advocated jQuery and jQuery UI, I lend a hearty ++ to that idea as well.
    David.
Re: Perl UI?
by Khen1950fx (Canon) on Oct 14, 2010 at 17:28 UTC
Re: Perl UI?
by PyrexKidd (Monk) on Oct 14, 2010 at 19:21 UTC

    Wow, thanks for all of your comments, this atleast gives me a direction to start. Any one have any recommendations for tutorials. I am inundated with Google results for these search queries.

    As far as Web based vs. user based,

    Mainly the tools are designed for administering my FTP server and the config files that live there. For instance I have one that extracts information and generates a report. To facilitate this as a standalone package it would require the app to talk to the server, complicating the whole process--(download necessary files, make changes, upload modified files)--whereas with an app that lives on the same server is able to access and display the necessary information.

    The second issue I have with a stand alone app is porting it to multiple platforms. Obviously the server is a Linux OS, and I personally run Linux, however, Most of my users are Winblows users, and I have one MAC user. From what I understand Perl doesn't work well in Winblows, thus making an OS port a large scale if not futile effort. I could write it all in C++ or Java, but again I run into the issue of the application being required to download all the necessary files, make the changes, then upload the newly configured files.

    That being said, I acknowledge the potential security risk of exposing the admin tools to the world. But then again, if the app is constantly uploading and downloading files from the server, this creates a security risk as well, agree? Any one have any suggestions on security, I have been lead to believe that .hataccess is less than secure.

    Again, thanks for all of your help. I don't really have any experience in building web pages or UI's for that matter (maybe it's laziness, but I find I type alot quicker then I move my mouse around, so I've never needed to build a UI).

    Finally, and pardon my ignorance, I thought CGI was mainly designed for database management and obtaining user information. Someone please set me straight, but I guess I'm missing something. I found this tutorial:

    http://www.cgi101.com

    Anyone have a better tutorial?

      There are 2 general approaches to dynamic web content:
      • Farm your needs out to an external program. CGI and ISAPI are two protocols that support this approach.
      • Build an interpreter into your web server. PHP and mod_perl are two examples of this.
      CGI is the simplest approach, but as it launches a separate process for each request and can be inefficient in high traffic environments.

      ISAPI, PHP and mod_perl are faster but run in the same process space as the web server.

      FastCGI may be a good compromise if CGI is too burdensome.

Re: Perl UI?
by jakeease (Friar) on Oct 14, 2010 at 23:47 UTC

    If you wind up creating a lot of HTML, etc., Perl Template Toolkit can be helpful in keeping the UI and the data separated cleanly.