http://www.perlmonks.org?node_id=1034936

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

Dear Monks,

I am developing a Perl/C pipeline which is placed on an UNIX server. At the moment I am accessing it in Windows through Putty, providing simple command line arguments.

I need to however make it easy to use for non-computer savvy people who use Linux/mac/windows. I am quite good in in making the software work but have no experience in cross-platforms compatibility, networks or GUIs.

Does anyone have any idea what would be the best approach? The user need to submit a string and select multiple options. The program will then run for 2-3 days so it would be nice if there was a way to see the progress, cancel the script and see if it is finished. After it's done I need to visualize the data which atm I provide in excel spreadsheet.

I was thinking about an JavaScript webpage with all the options but don't know is people will be able to access it easily in Windows. Maybe a Java or a Perl GUI?

A multi-platform desktop app that connects to a server would be absolutely ideal but I have no idea how difficult it is to do for someone with limited knowledge of distributed systems.

Any ideas are welcome. I spend a lot of time developing the pipeline but it won't be used a lot unless I make it incredibly easy to access. Thanks in advance for your advice. I am open to learning new stuff and spending 1 or 2 months on it.

  • Comment on Cross-platform GUI for UNIX based scripts

Replies are listed 'Best First'.
Re: Cross-platform GUI for UNIX based scripts
by RichardK (Parson) on May 23, 2013 at 13:46 UTC

    What about turning it into a web app using one of the many frameworks? Then you don't have to care what platform the users are on, as long as they've got a browser.

    I'd use Mojolicious, Mojolicious::Lite is a really nice, simple and quick way to get started, but there are lots of other frameworks you could try.

      So the app would be on a user specified server to which the webpage would connect to? Seems like something very easy to do if I understand correctly.

        Yes, run the web app on the server where you want to service to run, then the users can point their browsers to its URL.

Re: Cross-platform GUI for UNIX based scripts
by LanX (Saint) on May 23, 2013 at 13:35 UTC
    Depends... Tk (or a web-app) are the usual suspect...

    ... but if I understand your requirements right, you should consider using curses to have quick and efficient results.

    It's a TUI¹ not a GUI, which should be sufficient for you. (see Curses::UI)

    Like this you only need a terminal emulation on Win or Mac.

    And you can reconnect to long running sessions thru Putty and even automate the connection.

    Just spares yourself of the headaches of ...

    • portability and
    • access control,
    • HTML templates,
    • Ajax protocol
    • synchronizing client and server updates
    • user complaining about ugly Tk design...

    my 2¢...

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    ¹) Text User Interface which approaches the features of a GUI

      Hm might be the easiest way, thanks. People really love fancy GUIs though and few share my love to command lines.
        > People really love fancy GUIs though and few share my love to command lines.

        You didn't give us much information about the context.

        TUIs are semantically not much different from GUIs, it's just the optics and Tk is nowadays far from common taste, especially when confronted with Win/Mac folks.

        Anyway the other client/server approaches will produce overhead, if you need to duplicate features which are already provided by ssh/putty.

        For instance "user authentication":

        • Does security matter?

        • Who's allowed to use/connect to your web-app?

        • Who's account is used to start your process?

        • Who is in charge for necessary port forwardings?

        • and so on ...

        Maybe your use case is plain vanilla and security doesn't matter!

        But better be sure of the features needed when replacing ssh/putty as a tool and the amount of time you are able to invest.

        I've seen too many badly maintained GUI's/ web-apps because the amount of work to keep everything up to date was underestimated.

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Re: Cross-platform GUI for UNIX based scripts
by taint (Chaplain) on May 23, 2013 at 13:16 UTC
    Greetings,
    No disrespect intended, but generally speaking, the *NIX crowd tend to be pretty savvy
    when it comes to "tech stuff". That said, if you have any experience in Perl, you might
    want to look into the tk, or gtk Perl bindings/toolkits. Basically put; they allow you
    to incorporate buttons, and other widgets into your Perl applications, that will run
    on other platforms easily. It would also be worth looking into using CGI. There a massive
    collection of freely available modules that provide the "progress-bars" you noted, as well as Jason.
    Simply running a search on CPAN for
    http://search.cpan.org/search?query=tk&mode=all tk. Provided a few hundred possibilies.
    http://search.cpan.org/search?query=gtk&mode=all gtk, gave much the same.

    HTH

    --chris

    #!/usr/bin/perl -Tw
    use perl::always;
    my perl_version = "5.12.4";
    print $perl_version;
      Thanks Chris I will have a look. The majority of the people who will use it are windows based with no experience of UNIX. They haven't even used putty before which makes it a bit of a headache for me.
Re: Cross-platform GUI for UNIX based scripts
by Zzenmonk (Sexton) on May 24, 2013 at 07:15 UTC

    Hi,

    All the above are pertinent for your problem. The solution you choose depend on the user population you address. I am realizing tailor made application for companies and chose the web-application solution.

    Depending on the user population I use JavaScript to improve the user experience. If the user population is made of professionals I validate the data only on the server and do not use JavaScript for this purpose. This lowers the development costs.

    My solutions base on:

    • Apache web server (available also for windows)
    • Apache mod_perl if I need performance is required (probably not your case)
    • HTTPS for security if required
    • PERL or Strawberry PERL for windows
    • CGI::Session module for user authentication
    • CGI.pm to support the development of the application.
    • CSS for the page layout.
    • JavaScript for a high conviviality

    A good part of my web-app page set up is listed here http://www.perlmonks.org/?node_id=1029920.

    The back end of you application can be provided either by the PERL native functions, various PERL modules (i.e. File::Copy) or by the PERL system() instruction (watch your steps with this!).

    Hope it helps

    K

    The best medicine against depression is a cold beer!

      After reading all the comments I am straying towards your solution as I have experience in web design.

      The server I am currently working on is a secure, proxied one. In your approach do you create a webpage on the server that users connect to through their desktop browser (providing the password etc. if needed)?

      I was thinking about a website that initiates the software after which the user can log off. When logging back the user can see the progress or if the process is done, the results. I don't think it would be difficult to set up?

      Thanks for your advice, it's really helpful.

        Hi

        First notice that my solution need a higher development effort than some other listed here. I would recommend to create the web app on an other server for security reasons. You should have a look at the SSL modules on CPAN to pass the UNIX command to the target server.

        I would authenticate the user to the web app with CGI::session and use an PK system to authenticate the web-app to the target server. Eventually jail the account you are using on the target server. Keep the validity time of the cookies of CGI::session short to avoid session theft as far as possible.

        Once the user is authenticated I would prepare the UNIX command on the web-app server and pass it to the UNIX server with SSH. If you build a good system (i.e. PERL best practice!) you will be able to reuse the web-app for several UNIX servers.

        PS: Never assume a user will log out. Keep the validity of the session short. I use for example 10 minutes for a login screen.

        K

        The best medicine against depression is a cold beer!
Re: Cross-platform GUI for UNIX based scripts
by karlgoethebier (Abbot) on May 24, 2013 at 14:11 UTC
    «Any ideas are welcome»

    OK, if so - and you want that your GUI looks really cool, please take a look at Flex as well as ActionScript.

    IMHO this stuff has some benefits:

    1. Very easy handling of that asynchronous HTTP stuff
    2. Nice data binding concept
    3. ActionScript is how JavaScript should be: typification, class keyword, no need to use prototype. It is a nice language.
    4. Each class you create can have two incarnations: (M)XML and ActionScript code. This goes far beyond that "MarkUp for the Visual Things/Code For The Logic" approach. You can very easily do something similar to Code-Behind.
    5. If you do this and then think about doing some "micro MVC" stuff, things become interesting. Do the basic layout in MXML. Write your classes in ActionScript, based on <s:Group>. E.g. one containing a button, another a data grid for displaying your data and one with some of the XML list objects of Flex for the data and a http service for the fetch as a kind of delegate. A group doesn't listen for any events by default. edit: Bullshit, forgot my own cheated stuff ;-( So overwrite the built-in event dispatcher class see example below, define your custom events , build the listeners and the corresponding handlers, instantiate your AS classes as MXML and the fun begins...

    (Simplified, i know...)

    edit: Example:

    The price you have to pay for this: it's Shockwave/Flash :-(

    OK, nobody is perfect.

    You can do this stuff using vi or emacs or better use FlashBuilder, a tool based on Eclipse. Some free GUIs are around - i didn' use them yet.

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Hm nice idea. I was once developing within a group that created all the visual side in Flex. It does not seem to dfficult to learn. Thanks for the idea
Re: Cross-platform GUI for UNIX based scripts
by sam_bakki (Pilgrim) on May 27, 2013 at 11:55 UTC

    Hi

    If you AIM for perl based cross platform GUI, Go for GTK. You can develop GUI in GTK Glade GUI builder and only write call backs in perl (Kind of VB approach). I develop many perl based GUI in Perl GTK+, The great http://www.sisyphusion.tk/ repo has perl GTK PPMs for Windows too.

    For code examples and screen shots have a look at http://code.google.com/p/saaral-soft-search-spider/

    Thanks & Regards,
    Bakkiaraj M
    My Perl Gtk2 technology demo project - http://code.google.com/p/saaral-soft-search-spider/ , contributions are welcome.

      Thanks, will have a look as well. Great ideas guys.