Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Why is the module Gtk2::Unique? Shouldn't the libunique work for all app types even if not using Gtk2? I don't write Gtk2 applications but it will be interesting to have a common easy way how to make sure scripts are running just once. Like cron jobs, etc. Is this possible with libunique and/or Gtk2::Unique?

    • by potyl (8582) on 2009.05.17 14:32 (#68604) Journal

      The module is in the prefix Gtk2 because that's was suggested in the perl-gtk IRC channel. The name was even proposed by the creator of libunique.

      Nevertheless, the namespace is not a sign of the dependencies required but more of where the module belongs to. Although this particular module does require that an application is given a Gtk2::Window handle. I haven't looked at the C library so I don't really know why this is needed. I will ask the creator of the C library why is a Gtk2::Window handle required.

      In the meanwhile if your server is running has D-Bus running then you can implement the same functionality through D-Bus. Keep in mind that libunique purpose is to make sure that there's a single instance of the application running and performing the tasks. This means that when a program detects that there's already an instance running it should send a message to the first instance and ask it to performed the requested task. Of course you can use the module for ensuring that the application is having a single instance running and to simply return when the application is already running.

      • I got a reply from libunique's creator. The purpose of the library is truly to help GUI based programs to ensure an unique instance. Since it is aimed at GUIs the default implementation of libunique provides some custom actions that apply only to a GUI (ex: bring forwards the main window of the application when a message is received).

        A command line application that would like to have the same benefits could either use D-Bus and try to register a service name. Service names are unique in D-Bus. Another appro