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

I wanna to develop an application which allows access to UNIX/X applications from web browsers in Perl. I am need of some direction. I am Intermediate level C,C++ programmer. working past two months in Perl
cheers Rock

Replies are listed 'Best First'.
Re: XWindows in Perl
by ambrus (Abbot) on Oct 22, 2004 at 17:03 UTC

    You might just want to use VNC.

    VNC is a program that allows you to run an X server (or a Windows session) on a server machine, and display the output on a different machine (even one with a different os). That is, it's the graphics equivalent of an ssh server and client.

    VNC also has a way to use through a browser. If it's enabled, the VNC server behaves as a https server, where clients can connect and do the operations through javascript. This means that you don't have to install anything on the client machine. The disadvantage of the javascript way is that it's slow, even slower than otherwise.

    VNC is secure, and is free software.

    As such an application has to be an X server, I don't think you could get good performance if you want to reimplement it in perl. It requires a fast machine (and network too, you can only use VNC on intranet) as is. It would be even slower in perl.

      i second the VNC recommendation, but it is not secure. you have to handle the security yourself by SSH tunneling. there is no encryption on the VNC session, it might be hard to decode the stream and reap your passwords, but there's nothing preventing doing so.
Re: XWindows in Perl
by gman (Friar) on Oct 22, 2004 at 16:11 UTC
    Most UNIX application are able to process command line
    options. Through a CGI you could script something for that.
    But to actually throw an X window back to the client the
    client must be running an X server.
    see Re: telnet login script from W2K to unix box

    Sorry, I don't know of a way to "reproduce" a Xwindow or GUI
    through the browser without possibly running some
    type of Java applet that can emulate an X server and
    tunnel that through the http connection.
        WeirdX works well. I have used it with xlib apps and with Gtk2-perl apps. The latter sounds like what you want. Be sure to set the proper applet params, though.
        Yes, u are correct. I am looking something like Wired X. Problem is I donot know java. I am looking for GTK-perl. Thanx for your timely advice.
        cheers Rock
Re: XWindows in Perl
by jordanh (Chaplain) on Oct 22, 2004 at 17:27 UTC
    The only X Windows access from web browsers that I'm aware of is through something that was once called Broadway/XWeb, but I've never really seen anything use this.

    I thought Broadway seemed like such a neat idea, back in 1997-1998, but it seems to have turned into something of a dead-end. I doubt that there are working plug-ins for recent browsers.

    I bet you are actually trying to access to some X applications through a web interface. There are toolkits for interfacing to X-applications directly for testing purposes, that might allow you to interface a web app to an X app, but I doubt that such a thing would be a good idea.

    If these X-apps have APIs and/or some standard database you could access, there might be some direction there toward a perl/web-app.

Re: XWindows in Perl
by zentara (Cardinal) on Oct 23, 2004 at 13:40 UTC
    Well it's not exactly what you want with gtk, but there was an attempt to do this with Perl/Tk called the perlplus plugin for Netscape and Mozilla. Get it and test it perlplus

    Now it has alot of problems, especially with security, which make it useless for general purpose use, because you need to specify a security-cgi location specific to each plug-in. Which means that everyone would have to have a plug-in for EACH different web-site. However, if you read about how it is done, there is a general purpose method for creating plug-ins for Mozilla, and maybe that is what you might want to look into.

    But in general, I think it is better to just design a custom app, which the end-users can download and run, connecting to your site through sockets, or your web-server, giving you a GUI connection.


    I'm not really a human, but I play one on earth. flash japh

      Dear Zentara!
      Thanx for your rejoinder. I have to use this application for Network Management Domain, where I am dealing with bandwidth utilization, health of networking devices and many more such things. The catch is, A Network Engineer should be able look various statistics from any remote location. Hence web browser thing is required.
      Given you the scenario, I am expect more inputs from you on this topic.
      Thanx in advance.

      cheers Rock
Re: XWindows in Perl
by TedPride (Priest) on Oct 22, 2004 at 15:08 UTC
    Sounds like you want to pass form data as system commands, which is potentially dangerous. The only really secure way to do this is to connect through a secure server (https://) and check for user name and password before running the command. You can also check to make sure the referring URL is relatively secure:
    exit if $ENV{'HTTP_REFERER'} !~ /^https:/;
    See CGI.pm and related CGI:: modules for how to handle form data.

    EDIT: If what you want is an interface between the web browser and unix shell, bypassing Apache or other web server software entirely, then ignore this post.